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

📄 celllists.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        // counting arcs        for(Iterator<ArcInst> it = cell.getArcs(); it.hasNext(); )        {			ArcInst ai = it.next();            ArcProto ap = ai.getProto();            GenMath.MutableInteger count = arcCount.get(ap);			if (count == null)			{				count = new GenMath.MutableInteger(0);				arcCount.put(ap, count);			}			count.increment();        }    }	/**	 * This method implements the command to list instances in this Cell.	 */	public static void listCellInstancesCommand()	{		Cell curCell = WindowFrame.needCurCell();		if (curCell == null) return;		// count the number of instances in this cell		Map<Cell,GenMath.MutableInteger> nodeCount = new HashMap<Cell,GenMath.MutableInteger>();		for(Iterator<NodeInst> it = curCell.getNodes(); it.hasNext(); )		{			NodeInst ni = it.next();			if (!ni.isCellInstance()) continue;			GenMath.MutableInteger count = nodeCount.get(ni.getProto());			if (count == null)			{				count = new GenMath.MutableInteger(0);				nodeCount.put((Cell)ni.getProto(), count);			}			count.increment();		}		// show the results		boolean first = true;		for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )		{			Library lib = it.next();			for(Iterator<Cell> cIt = lib.getCells(); cIt.hasNext(); )			{				Cell cell = cIt.next();				GenMath.MutableInteger count = nodeCount.get(cell);				if (count == null) continue;				if (first)					System.out.println("Instances appearing in " + curCell);				first = false;				String line = "   " + count.intValue() + " instances of " + cell + " at";				for(Iterator<NodeInst> nIt = curCell.getNodes(); nIt.hasNext(); )				{					NodeInst ni = nIt.next();					if (ni.getProto() != cell) continue;					line += " (" + ni.getAnchorCenterX() + "," + ni.getAnchorCenterY() + ")";				}				System.out.println(line);			}		}		if (first)			System.out.println("There are no instances in " + curCell);	}	/**	 * This method implements the command to count the number of transistors	 * from this current Cell.	 */	public static void numberOfTransistorsCommand()	{		Cell curCell = WindowFrame.needCurCell();		if (curCell == null) return;		TransistorSearch.countNumberOfTransistors(curCell);	}	/**	 * This method implements the command to list the usage of the current Cell.	 */	public static void listCellUsageCommand(boolean recursive)	{		Cell c = WindowFrame.needCurCell();		if (c == null) return;		Map<Cell,Map<Cell,GenMath.MutableInteger>> nodeCount = new HashMap<Cell,Map<Cell,GenMath.MutableInteger>>();		List<Cell> cellsToConsider = new ArrayList<Cell>();		cellsToConsider.add(c);		for(int i=0; i<cellsToConsider.size(); i++)		{			Cell bottom = cellsToConsider.get(i);			// count the number of instances in this cell			for(Iterator<NodeInst> nIt = bottom.getInstancesOf(); nIt.hasNext(); )			{				NodeInst ni = nIt.next();				Cell top = ni.getParent();				if (recursive)				{					if (!cellsToConsider.contains(top)) cellsToConsider.add(top);				}				Map<Cell,GenMath.MutableInteger> tally = nodeCount.get(top);				if (tally == null)				{					tally = new HashMap<Cell,GenMath.MutableInteger>();					nodeCount.put(top, tally);				}				GenMath.MutableInteger instanceCount = tally.get(bottom);				if (instanceCount == null)				{					instanceCount = new GenMath.MutableInteger(0);					tally.put(bottom, instanceCount);				}				instanceCount.increment();			}			// count the number of instances in this cell's icon			if (bottom.getView() != View.ICON)			{				for(Iterator<Cell> it = bottom.getCellGroup().getCells(); it.hasNext(); )				{					Cell iconCell = it.next();					if (iconCell.getView() != View.ICON) continue;					for(Iterator<NodeInst> nIt = iconCell.getInstancesOf(); nIt.hasNext(); )					{						NodeInst ni = nIt.next();						if (ni.isIconOfParent()) continue;						Cell top = ni.getParent();						if (recursive)						{							if (!cellsToConsider.contains(top)) cellsToConsider.add(top);						}						Map<Cell,GenMath.MutableInteger> tally = nodeCount.get(top);						if (tally == null)						{							tally = new HashMap<Cell,GenMath.MutableInteger>();							nodeCount.put(top, tally);						}						GenMath.MutableInteger instanceCount = tally.get(bottom);						if (instanceCount == null)						{							instanceCount = new GenMath.MutableInteger(0);							tally.put(bottom, instanceCount);						}						int arraySize = ni.getNameKey().busWidth();						if (arraySize > 1) instanceCount.setValue(instanceCount.intValue() + arraySize); else							instanceCount.increment();					}				}			}		}		// show the results		if (nodeCount.size() == 0)		{			System.out.println("Cell " + c.describe(true) + " is not used anywhere");			return;		}		if (recursive) System.out.println("Cell " + c.describe(true) + " recursive usage:"); else			System.out.println("Cell " + c.describe(true) + " usage:");		for(Iterator<Library> it = Library.getLibraries(); it.hasNext(); )		{			Library lib = it.next();			for(Iterator<Cell> cIt = lib.getCells(); cIt.hasNext(); )			{				Cell cell = cIt.next();				Map<Cell,GenMath.MutableInteger> tally = nodeCount.get(cell);				if (tally == null) continue;				for(Cell bottom : tally.keySet())				{					GenMath.MutableInteger count = tally.get(bottom);					System.out.println("  " + cell + " has " + count.intValue() + " instances of " + bottom);				}			}		}	}	/**	 * This method implements the command to describe the current Cell.	 */	public static void describeThisCellCommand()	{		Cell curCell = WindowFrame.needCurCell();		if (curCell == null) return;		int maxLen = curCell.describe(false).length();		printHeaderLine(maxLen);		String line = makeCellLine(curCell, maxLen);		System.out.println(line);		// also give range of X and Y		ERectangle bounds = curCell.getBounds();		System.out.println("Cell runs from " + TextUtils.formatDouble(bounds.getMinX()) + " <= X <= " +			TextUtils.formatDouble(bounds.getMaxX()) + " and " + TextUtils.formatDouble(bounds.getMinY()) +			" <= Y <= " + TextUtils.formatDouble(bounds.getMaxY()));	}	private static void printHeaderLine(int maxLen)	{		String header = "Cell";		for(int i=4; i<maxLen; i++) header += "-";		header += "Version--------Creation date";		header += "---------------Revision Date--------------Size-------Usage--L-I-S-D";		System.out.println(header);	}	/** 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.	 */    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents    private void initComponents() {        java.awt.GridBagConstraints gridBagConstraints;        whichCells = new javax.swing.ButtonGroup();        ordering = new javax.swing.ButtonGroup();        destination = new javax.swing.ButtonGroup();        cancel = new javax.swing.JButton();        ok = new javax.swing.JButton();        jLabel1 = new javax.swing.JLabel();        allCells = new javax.swing.JRadioButton();        onlyCellsUsedElsewhere = new javax.swing.JRadioButton();        onlyCellsNotUsedElsewhere = new javax.swing.JRadioButton();        onlyCellsUnderCurrent = new javax.swing.JRadioButton();        onlyPlaceholderCells = new javax.swing.JRadioButton();        jSeparator1 = new javax.swing.JSeparator();        jLabel2 = new javax.swing.JLabel();        onlyThisView = new javax.swing.JCheckBox();        views = new javax.swing.JComboBox();        alsoIconViews = new javax.swing.JCheckBox();        jSeparator2 = new javax.swing.JSeparator();        jLabel3 = new javax.swing.JLabel();        excludeOlderVersions = new javax.swing.JCheckBox();        excludeNewestVersions = new javax.swing.JCheckBox();        jSeparator3 = new javax.swing.JSeparator();        jLabel4 = new javax.swing.JLabel();        orderByName = new javax.swing.JRadioButton();        orderByDate = new javax.swing.JRadioButton();        orderByStructure = new javax.swing.JRadioButton();        jSeparator4 = new javax.swing.JSeparator();        jLabel5 = new javax.swing.JLabel();        displayInMessages = new javax.swing.JRadioButton();        saveToDisk = new javax.swing.JRadioButton();        evaluateNumerically = new javax.swing.JCheckBox();        getContentPane().setLayout(new java.awt.GridBagLayout());        setTitle("Cell Lists");        setName("");        addWindowListener(new java.awt.event.WindowAdapter() {            public void windowClosing(java.awt.event.WindowEvent evt) {                closeDialog(evt);            }        });        cancel.setText("Cancel");        cancel.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                cancel(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 25;        gridBagConstraints.weightx = 0.5;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(cancel, gridBagConstraints);        ok.setText("OK");        ok.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                ok(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 1;        gridBagConstraints.gridy = 25;        gridBagConstraints.weightx = 0.5;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(ok, gridBagConstraints);        jLabel1.setText("Which cells:");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 0;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(jLabel1, gridBagConstraints);        whichCells.add(allCells);        allCells.setText("All cells");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 1;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 20, 0, 4);        getContentPane().add(allCells, gridBagConstraints);        whichCells.add(onlyCellsUsedElsewhere);        onlyCellsUsedElsewhere.setText("Only those used elsewhere");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 2;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(0, 20, 0, 4);        getContentPane().add(onlyCellsUsedElsewhere, gridBagConstraints);        whichCells.add(onlyCellsNotUsedElsewhere);        onlyCellsNotUsedElsewhere.setText("Only those not used elsewhere");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 3;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(0, 20, 0, 4);        getContentPane().add(onlyCellsNotUsedElsewhere, gridBagConstraints);        whichCells.add(onlyCellsUnderCurrent);        onlyCellsUnderCurrent.setText("Only those under current cell");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 4;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(0, 20, 0, 4);        getContentPane().add(onlyCellsUnderCurrent, gridBagConstraints);        whichCells.add(onlyPlaceholderCells);        onlyPlaceholderCells.setText("Only placeholder cells");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 5;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(0, 20, 4, 4);        getContentPane().add(onlyPlaceholderCells, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 6;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        getContentPane().add(jSeparator1, gridBagConstraints);        jLabel2.setText("View filter:");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 7;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(jLabel2, gridBagConstraints);        onlyThisView.setText("Show only this view:");        onlyThisView.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                onlyThisViewActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 8;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 20, 0, 4);        getContentPane().add(onlyThisView, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 9;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(2, 40, 4, 4);        getContentPane().add(views, gridBagConstraints);        alsoIconViews.setText("Also include icon views");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 10;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 20, 4, 4);        getContentPane().add(alsoIconViews, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 11;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        getContentPane().add(jSeparator2, gridBagConstraints);        jLabel3.setText("Version filter:");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 12;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        getContentPane().add(jLabel3, gridBagConstraints);        excludeOlderVersions.setText("Exclude older versions");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 13;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 20, 0, 4);        getContentPane().add(excludeOlderVersions, gridBagConstraints);

⌨️ 快捷键说明

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