⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 routingtab.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: RoutingTab.java * * Copyright (c) 2004 Sun Microsystems and Static Free Software * * Electric(tm) is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Electric(tm) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Electric(tm); see the file COPYING.  If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, Mass 02111-1307, USA. */package com.sun.electric.tool.user.dialogs.options;import com.sun.electric.database.text.TextUtils;import com.sun.electric.technology.ArcProto;import com.sun.electric.technology.Technology;import com.sun.electric.tool.Job;import com.sun.electric.tool.routing.Routing;import com.sun.electric.tool.user.dialogs.EDialog;import com.sun.electric.tool.user.menus.MenuCommands;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Insets;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.HashMap;import java.util.Iterator;import java.util.Map;import javax.swing.JCheckBox;import javax.swing.JLabel;import javax.swing.JPanel;/** * Class to handle the "Routing" tab of the Preferences dialog. */public class RoutingTab extends PreferencePanel{	/** Creates new form RoutingTab */	public RoutingTab(java.awt.Frame parent, boolean modal)	{		super(parent, modal);		initComponents();		// make all text fields select-all when entered	    EDialog.makeTextFieldSelectAllOnTab(sogMaxArcWidth);	    EDialog.makeTextFieldSelectAllOnTab(sogComplexityLimit);	}	/** return the panel to use for this preferences tab. */	public JPanel getPanel() { return routing; }	/** return the name of this preferences tab. */	public String getName() { return "Routing"; }	private ArcProto initRoutDefArc;	private JPanel sogArcList;	private Map<ArcProto,JCheckBox> sogFavorChecks, sogProhibitChecks;	private static boolean oneProcessorWarning = false;	private static boolean twoProcessorWarning = false;	/**	 * Method called at the start of the dialog.	 * Caches current values and displays them in the Routing tab.	 */	public void init()	{		// initilze for the stitcher that is running		boolean initRoutMimicOn = Routing.isMimicStitchOn();		boolean initRoutAutoOn = Routing.isAutoStitchOn();		if (!initRoutMimicOn && !initRoutAutoOn) routNoStitcher.setSelected(true);        else		{			if (initRoutMimicOn) routMimicStitcher.setSelected(true); else				routAutoStitcher.setSelected(true);		}		// initialize the "default arc" setting		for(Iterator<Technology> tIt = Technology.getTechnologies(); tIt.hasNext(); )		{			Technology tech = tIt.next();			routTechnology.addItem(tech.getTechName());			sogRouteTechnology.addItem(tech.getTechName());		}		routTechnology.addActionListener(new ActionListener()		{			public void actionPerformed(ActionEvent evt) { techChanged(); }		});		// the sea-of-gates section		sogFavorChecks = new HashMap<ArcProto,JCheckBox>();		sogProhibitChecks = new HashMap<ArcProto,JCheckBox>();		sogArcList = new JPanel();		sogRouteArcOptions.setViewportView(sogArcList);		sogRouteTechnology.addActionListener(new ActionListener()		{			public void actionPerformed(ActionEvent evt) { sogTechChanged(); }		});		sogRouteTechnology.setSelectedItem(Technology.getCurrent().getTechName());		sogMaxArcWidth.setText(TextUtils.formatDouble(Routing.getSeaOfGatesMaxWidth()));		sogComplexityLimit.setText(Integer.toString(Routing.getSeaOfGatesComplexityLimit()));		sogParallel.setSelected(Routing.isSeaOfGatesUseParallelRoutes());		sogParallel.addActionListener(new ActionListener()		{			public void actionPerformed(ActionEvent evt) { sogParallelChanged(); }		});		sogParallelDij.setSelected(Routing.isSeaOfGatesUseParallelFromToRoutes());		sogParallelDij.addActionListener(new ActionListener()		{			public void actionPerformed(ActionEvent evt) { sogParallelChanged(); }		});		routTechnology.setSelectedItem(Technology.getCurrent().getTechName());		routOverrideArc.addActionListener(new ActionListener()		{			public void actionPerformed(ActionEvent evt) { overrideChanged(); }		});		String prefArcName = Routing.getPreferredRoutingArc();		initRoutDefArc = null;		if (prefArcName.length() > 0)		{			initRoutDefArc = ArcProto.findArcProto(prefArcName);			routOverrideArc.setSelected(true);		} else		{			routOverrideArc.setSelected(false);		}		overrideChanged();		if (initRoutDefArc != null)		{			routTechnology.setSelectedItem(initRoutDefArc.getTechnology().getTechName());			routDefaultArc.setSelectedItem(initRoutDefArc.getName());		}		// auot routing section		routAutoCreateExports.setSelected(Routing.isAutoStitchCreateExports());		// mimic routing section		routMimicPortsMustMatch.setSelected(Routing.isMimicStitchMatchPorts());		routMimicPortsWidthMustMatch.setSelected(Routing.isMimicStitchMatchPortWidth());		routMimicNumArcsMustMatch.setSelected(Routing.isMimicStitchMatchNumArcs());		routMimicNodeSizesMustMatch.setSelected(Routing.isMimicStitchMatchNodeSize());		routMimicNodeTypesMustMatch.setSelected(Routing.isMimicStitchMatchNodeType());		routMimicNoOtherArcs.setSelected(Routing.isMimicStitchNoOtherArcsSameDir());		routMimicOnlyNewTopology.setSelected(Routing.isMimicStitchOnlyNewTopology());		routMimicInteractive.setSelected(Routing.isMimicStitchInteractive());        routMimicKeepPins.setSelected(Routing.isMimicStitchPinsKept());	}	private void overrideChanged()	{		boolean enableRest = routOverrideArc.isSelected();		// set other fields		routTechnology.setEnabled(enableRest);		routTechLabel.setEnabled(enableRest);		routDefaultArc.setEnabled(enableRest);		routArcLabel.setEnabled(enableRest);	}	/**	 * Method called when the technology (for default arcs) has changed.	 */	private void techChanged()	{		String techName = (String)routTechnology.getSelectedItem();		Technology tech = Technology.findTechnology(techName);		if (tech == null) return;		routDefaultArc.removeAllItems();		for(Iterator<ArcProto> it = tech.getArcs(); it.hasNext(); )		{			ArcProto ap = it.next();			routDefaultArc.addItem(ap.getName());		}		routDefaultArc.setSelectedIndex(0);	}	/**	 * Method called when either of the parallel sea-of-gate checkboxes changes.	 * Checks this against the number of processors and warns if not possible.	 */	private void sogParallelChanged()	{		int numberOfProcessors = Runtime.getRuntime().availableProcessors();		boolean twoPerRoute = sogParallelDij.isSelected();		boolean parallelRouting = sogParallel.isSelected();		if ((twoPerRoute || parallelRouting) && numberOfProcessors == 1 && !oneProcessorWarning)		{			oneProcessorWarning = true;			Job.getUserInterface().showInformationMessage("This computer has only one processor and cannot do parallel routing.",				"Not Enough Processors");			return;		}		if ((twoPerRoute && parallelRouting) && numberOfProcessors == 2 && !twoProcessorWarning)		{			twoProcessorWarning = true;			Job.getUserInterface().showInformationMessage(				"This computer has only two processors and so it can do either\n"+				"   'two processors per route' or 'multiple routes in parallel' but not both.\n"+				"It is recommended that two-processor machines use 'two processors per route'.",				"Not Enough Processors");			return;		}	}	/**	 * Method called when the "Sea of gates" technology has changed.	 */	private void sogTechChanged()	{		String techName = (String)sogRouteTechnology.getSelectedItem();		Technology tech = Technology.findTechnology(techName);		if (tech == null) return;		sogArcList = new JPanel();		sogRouteArcOptions.setViewportView(sogArcList);		sogArcList.setLayout(new GridBagLayout());		int i=0;		for(Iterator<ArcProto> it = tech.getArcs(); it.hasNext(); )		{			ArcProto ap = it.next();			if (!ap.getFunction().isMetal()) continue;			JLabel arcName = new JLabel(ap.getName());			GridBagConstraints gbc = new GridBagConstraints();			gbc.gridx = 0;   gbc.gridy = i;			gbc.anchor = GridBagConstraints.WEST;			gbc.weightx = 1;			gbc.insets = new Insets(0, 2, 0, 2);			sogArcList.add(arcName, gbc);			JCheckBox favorArc = sogFavorChecks.get(ap);			if (favorArc == null)			{				favorArc = new JCheckBox("Favor");				sogFavorChecks.put(ap, favorArc);				if (Routing.isSeaOfGatesFavor(ap)) favorArc.setSelected(true);			}			gbc = new GridBagConstraints();			gbc.gridx = 1;   gbc.gridy = i;			sogArcList.add(favorArc, gbc);			JCheckBox prohibitArc = sogProhibitChecks.get(ap);			if (prohibitArc == null)			{				prohibitArc = new JCheckBox("Prohibit");				sogProhibitChecks.put(ap, prohibitArc);				if (Routing.isSeaOfGatesPrevent(ap)) prohibitArc.setSelected(true);			}			gbc = new GridBagConstraints();			gbc.gridx = 2;   gbc.gridy = i;			sogArcList.add(prohibitArc, gbc);			i++;		}	}	/**	 * Method called when the "OK" panel is hit.	 * Updates any changed fields in the Routing tab.	 */	public void term()	{		boolean curMimic = routMimicStitcher.isSelected();		if (curMimic != Routing.isMimicStitchOn()) {			Routing.setMimicStitchOn(curMimic);            MenuCommands.menuBar().updateAllButtons();        }		boolean curAuto = routAutoStitcher.isSelected();		if (curAuto != Routing.isAutoStitchOn()) {			Routing.setAutoStitchOn(curAuto);            MenuCommands.menuBar().updateAllButtons();        }		// pick up sea-of-gates preferences		for(Iterator<ArcProto> it = sogFavorChecks.keySet().iterator(); it.hasNext(); )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -