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

📄 change.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
				}			}			// delete old pins and copy their names to the new ones			for(NodeInst ni : changePins)			{				if (!ni.hasExports())				{					String niName = ni.getName();					ni.kill();					NodeInst newNi = newNodes.get(ni);					newNi.setName(niName);				}			}		}		private NodeProto [] contactStack = new NodeProto[100];		private ArcProto [] contactStackArc = new ArcProto[100];		/**		 * Method to examine end "end" of arc "ai" and return a node at that position which		 * can connect to arcs of type "ap".  This may require creation of one or more contacts		 * to change layers.		 */		private PortInst makeContactStack(ArcInst ai, int end, ArcProto ap)		{			NodeInst lastNi = ai.getPortInst(end).getNodeInst();			PortProto lastPp = ai.getPortInst(end).getPortProto();			PortInst lastPi = lastNi.findPortInstFromProto(lastPp);			Point2D center = ai.getLocation(end);			Cell cell = ai.getParent();//			// first see if it can be replaced by a simple pin//			boolean allSame = true;//			for(Iterator<Connection> it = lastNi.getConnections(); it.hasNext(); )//			{//				Connection con = it.next();//				ArcInst aiOnNode = con.getArc();//				if (aiOnNode == ai) continue;//				if (aiOnNode.getProto() != ap) allSame = false;//			}//			if (allSame)//			{//				PrimitiveNode np = ap.findOverridablePinProto();//				if (lastNi.getProto() == np) return lastPi;//				NodeInst newNi = NodeInst.makeInstance(np, center, np.getDefWidth(), np.getDefHeight(), cell);//				if (newNi == null) return null;//				PortInst thisPi = newNi.getOnlyPortInst();//				return thisPi;//			}			Set<ArcProto> markedArcs = new HashSet<ArcProto>();			int depth = findPathToArc(lastPp, ap, 0, markedArcs);			if (depth < 0) return null;			// create the contacts			for(int i=0; i<depth; i++)			{				ArcProto typ = contactStackArc[i];				double wid = ai.getLambdaBaseWidth();				double xS = contactStack[i].getDefWidth();				double yS = contactStack[i].getDefHeight();				SizeOffset so = contactStack[i].getProtoSizeOffset();				xS = Math.max(xS - so.getLowXOffset() - so.getHighXOffset(), wid) + so.getLowXOffset() + so.getHighXOffset();				yS = Math.max(yS - so.getLowYOffset() - so.getHighYOffset(), wid) + so.getLowYOffset() + so.getHighYOffset();				NodeInst newNi = NodeInst.makeInstance(contactStack[i], center, xS, yS, cell);				if (newNi == null) return null;				PortInst thisPi = newNi.findPortInstFromProto(contactStack[i].getPort(0));				ArcInst newAi = ArcInst.newInstanceBase(typ, wid, thisPi, lastPi, center, center, null, ai.getAngle());				lastPi = thisPi;				if (newAi == null) return null;				newAi.setFixedAngle(true);			}			return lastPi;		}		/**		 * Method to compute an array of contacts and arcs that connects a port to an arcproto.		 * @param pp the original port.		 * @param ap the destination arcproto.		 * @param depth the location in the contact array to fill.		 * @param markedArcs a set of Arcprotos that have been used in the search.		 * @return the new size of the contact array.		 */		private int findPathToArc(PortProto pp, ArcProto ap, int depth, Set<ArcProto> markedArcs)		{			// see if the connection is made			if (pp.connectsTo(ap)) return depth;			// look for a contact			PrimitiveNode bestNp = null;			ArcProto bestAp = null;			int bestDepth = 0;			Technology tech = ap.getTechnology();			for(Iterator<PrimitiveNode> it = tech.getNodes(); it.hasNext(); )			{				PrimitiveNode nextNp = it.next();				PrimitiveNode.Function fun = nextNp.getFunction();				if (fun != PrimitiveNode.Function.CONTACT) continue;				// see if this contact connects to the destination				PortProto nextPp = nextNp.getPort(0);				ArcProto [] connections = nextPp.getBasePort().getConnections();				ArcProto found = null;				for(int i=0; i<connections.length; i++)				{					ArcProto thisAp = connections[i];					if (thisAp.getTechnology() != tech) continue;					if (markedArcs.contains(thisAp)) continue;					if (pp.connectsTo(thisAp)) { found = thisAp;   break; }				}				if (found == null) continue;				// this contact is part of the chain				contactStack[depth] = nextNp;				markedArcs.add(found);				int newDepth = findPathToArc(nextPp, ap, depth+1, markedArcs);				markedArcs.remove(found);				if (newDepth < 0) continue;				if (bestNp == null || newDepth < bestDepth)				{					bestDepth = newDepth;					bestNp = nextNp;					bestAp = found;				}			}			if (bestNp != null)			{				contactStack[depth] = bestNp;				contactStackArc[depth] = bestAp;				markedArcs.add(bestAp);				int newDepth = findPathToArc(bestNp.getPort(0), ap, depth+1, markedArcs);				markedArcs.remove(bestAp);				return newDepth;			}			return -1;		}	}	private String getLibSelected()	{		return (String)librariesPopup.getSelectedItem();	}	/** This method is called from within the constructor to	 * initialize the form.	 * WARNING: Do NOT modify this code. The content of this method is	 * always regenerated by the Form Editor.	 */	private void initComponents()//GEN-BEGIN:initComponents    {        java.awt.GridBagConstraints gridBagConstraints;        changeOption = new javax.swing.ButtonGroup();        done = new javax.swing.JButton();        apply = new javax.swing.JButton();        listPane = new javax.swing.JScrollPane();        changeSelected = new javax.swing.JRadioButton();        changeConnected = new javax.swing.JRadioButton();        changeInCell = new javax.swing.JRadioButton();        changeInLibrary = new javax.swing.JRadioButton();        changeEverywhere = new javax.swing.JRadioButton();        changeNodesWithArcs = new javax.swing.JCheckBox();        showPrimitives = new javax.swing.JCheckBox();        showCells = new javax.swing.JCheckBox();        ignorePortNames = new javax.swing.JCheckBox();        jLabel1 = new javax.swing.JLabel();        librariesPopup = new javax.swing.JComboBox();        allowMissingPorts = new javax.swing.JCheckBox();        getContentPane().setLayout(new java.awt.GridBagLayout());        setTitle("Change");        setName("");        addWindowListener(new java.awt.event.WindowAdapter()        {            public void windowClosing(java.awt.event.WindowEvent evt)            {                closeDialog(evt);            }        });        done.setText("Done");        done.addActionListener(new java.awt.event.ActionListener()        {            public void actionPerformed(java.awt.event.ActionEvent evt)            {                done(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 10;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(done, gridBagConstraints);        apply.setText("Apply");        apply.addActionListener(new java.awt.event.ActionListener()        {            public void actionPerformed(java.awt.event.ActionEvent evt)            {                apply(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 3;        gridBagConstraints.gridy = 10;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(apply, gridBagConstraints);        listPane.setMinimumSize(new java.awt.Dimension(150, 22));        listPane.setPreferredSize(new java.awt.Dimension(150, 22));        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 0;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.gridheight = 10;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.weighty = 1.0;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(listPane, gridBagConstraints);        changeSelected.setText("Change selected ones only");        changeOption.add(changeSelected);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 0;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 2, 4);        getContentPane().add(changeSelected, gridBagConstraints);        changeConnected.setText("Change all connected to this");        changeOption.add(changeConnected);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 1;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(2, 4, 2, 4);        getContentPane().add(changeConnected, gridBagConstraints);        changeInCell.setText("Change all in this cell");        changeOption.add(changeInCell);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 2;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(2, 4, 2, 4);        getContentPane().add(changeInCell, gridBagConstraints);        changeInLibrary.setText("Change all in this library");        changeOption.add(changeInLibrary);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 3;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(2, 4, 2, 4);        getContentPane().add(changeInLibrary, gridBagConstraints);        changeEverywhere.setText("Change all in all libraries");        changeOption.add(changeEverywhere);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 4;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(2, 4, 10, 4);        getContentPane().add(changeEverywhere, gridBagConstraints);        changeNodesWithArcs.setText("Change nodes with arcs");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 5;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(10, 4, 4, 4);        getContentPane().add(changeNodesWithArcs, gridBagConstraints);        showPrimitives.setText("Show primitives");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 6;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(showPrimitives, gridBagConstraints);        showCells.setText("Show cells");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 7;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(showCells, gridBagConstraints);        ignorePortNames.setText("Ignore port names");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 8;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(ignorePortNames, gridBagConstraints);        jLabel1.setText("Library:");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 10;        getContentPane().add(jLabel1, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 1;        gridBagConstraints.gridy = 10;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(librariesPopup, gridBagConstraints);        allowMissingPorts.setText("Allow missing ports");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 9;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(allowMissingPorts, gridBagConstraints);        pack();    }//GEN-END:initComponents	private void done(java.awt.event.ActionEvent evt)//GEN-FIRST:event_done	{//GEN-HEADEREND:event_done		closeDialog(null);	}//GEN-LAST:event_done	private void apply(java.awt.event.ActionEvent evt)//GEN-FIRST:event_apply	{//GEN-HEADEREND:event_apply		doTheChange();		libSelected = (String)librariesPopup.getSelectedItem();	}//GEN-LAST:event_apply	/** Closes the dialog */	private void closeDialog(java.awt.event.WindowEvent evt)//GEN-FIRST:event_closeDialog	{		Highlighter.removeHighlightListener(this);		setVisible(false);		dispose();		theDialog = null;	}//GEN-LAST:event_closeDialog    // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JCheckBox allowMissingPorts;    private javax.swing.JButton apply;    private javax.swing.JRadioButton changeConnected;    private javax.swing.JRadioButton changeEverywhere;    private javax.swing.JRadioButton changeInCell;    private javax.swing.JRadioButton changeInLibrary;    private javax.swing.JCheckBox changeNodesWithArcs;    private javax.swing.ButtonGroup changeOption;    private javax.swing.JRadioButton changeSelected;    private javax.swing.JButton done;    private javax.swing.JCheckBox ignorePortNames;    private javax.swing.JLabel jLabel1;    private javax.swing.JComboBox librariesPopup;    private javax.swing.JScrollPane listPane;    private javax.swing.JCheckBox showCells;    private javax.swing.JCheckBox showPrimitives;    // End of variables declaration//GEN-END:variables}

⌨️ 快捷键说明

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