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

📄 circuitchanges.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
								for(int j=start; j<=i; j++)									segment[j-start] = points[j];								area += GenMath.getAreaOfPoints(segment);								start = i+2;							}						}					} else					{						area = GenMath.getAreaOfPoints(points);					}				}				pureAreas.put(ni, new Double(area));				root = RTNode.linkGeom(null, root, ni);			}			// now find the redundant ones			for(NodeInst ni : allPures)			{				Double nodeArea = pureAreas.get(ni);				Rectangle2D nodeRect = ni.getBounds();				for(RTNode.Search sea = new RTNode.Search(nodeRect, root, false); sea.hasNext(); )				{					NodeInst neighbor = (NodeInst)sea.next();					if (neighbor == ni) continue;					Double neighborArea = pureAreas.get(neighbor);					if (neighborArea.doubleValue() < nodeArea.doubleValue()) continue;					if (redundantPures.contains(neighbor)) continue;					PolyBase [] neighborPolys = neighbor.getProto().getTechnology().getShapeOfNode(neighbor);					PolyBase neighborPoly = neighborPolys[0];					if (neighborPoly.contains(nodeRect))					{						redundantPures.add(ni);						break;					}				}			}		}		// show them		wnd.clearHighlighting();		for(NodeInst ni : redundantPures)			wnd.addElectricObject(ni, cell);		wnd.finishedHighlighting();		System.out.println("Highlighted " + redundantPures.size() + " redundant pure-layer nodes");	}	/**	 * Method to return a Rectangle that describes the orthogonal box in this Poly.	 * @return the Rectangle that describes this Poly.	 * If the Poly is not an orthogonal box, returns null.	 * IT IS NOT PERMITTED TO MODIFY THE RETURNED RECTANGLE	 * (because it is taken from the internal bounds of the Poly).	 */	public static boolean isBox(Point2D [] points)	{		if (points.length == 4)		{		} else if (points.length == 5)		{			if (points[0].getX() != points[4].getX() || points[0].getY() != points[4].getY()) return false;		} else return false;		// make sure the polygon is rectangular and orthogonal		if (points[0].getX() == points[1].getX() && points[2].getX() == points[3].getX() &&			points[0].getY() == points[3].getY() && points[1].getY() == points[2].getY())		{			return true;		}		if (points[0].getX() == points[3].getX() && points[1].getX() == points[2].getX() &&			points[0].getY() == points[1].getY() && points[2].getY() == points[3].getY())		{			return true;		}		return false;	}	/****************************** MAKE A NEW VERSION OF A CELL ******************************/	public static void newVersionOfCell(Cell cell)	{		// disallow if in Project Management		int status = Project.getCellStatus(cell);		if (status != Project.NOTMANAGED)		{			JOptionPane.showMessageDialog(TopLevel.getCurrentJFrame(),				"This cell is part of a project.  To get a new version of it, check it out.", "Cannot Make New Version",				JOptionPane.ERROR_MESSAGE);			return;		}		new CellChangeJobs.NewCellVersion(cell);	}	/****************************** MOVE SELECTED OBJECTS ******************************/	/**	 * Method to move the selected geometry by (dX, dY).	 */	public static void manyMove(double dX, double dY)	{        WindowFrame wf = WindowFrame.getCurrentWindowFrame();        if (wf == null) return;        Cell cell = wf.getContent().getCell();        Highlighter highlighter = wf.getContent().getHighlighter();        if (highlighter == null) return;        List<Highlight2> highlighted = highlighter.getHighlights();        // prevent mixing cell-center and non-cell-center        int nonCellCenterCount = 0;        Highlight2 cellCenterHighlight = null;        List<ElectricObject> highlightedEObjs = new ArrayList<ElectricObject>();        for(Highlight2 h : highlighted)        {        	if (!h.isHighlightEOBJ()) continue;        	ElectricObject eObj = h.getElectricObject();    		highlightedEObjs.add(eObj);        	if (eObj instanceof NodeInst)        	{        		NodeInst ni = (NodeInst)eObj;        		if (ni.getProto() == Generic.tech().cellCenterNode) cellCenterHighlight = h; else        			nonCellCenterCount++;        	} else nonCellCenterCount++;        }        if (cellCenterHighlight != null && nonCellCenterCount != 0)        {        	System.out.println("Cannot move the Cell-center along with other objects.  Cell-center will not be moved.");        	highlighted.remove(cellCenterHighlight);        }        List<DisplayedText> highlightedText = highlighter.getHighlightedText(true);		if (!highlightedEObjs.isEmpty() || !highlightedText.isEmpty())            new CircuitChangeJobs.ManyMove(cell, highlightedEObjs, highlightedText, dX, dY);	}	/****************************** CHANGE CELL EXPANSION ******************************/	private static HashSet<NodeInst> expandFlagBit;	/**	 * Method to change the expansion of the selected instances.	 * @param unExpand true to unexpand the instances (draw them as black boxes),	 * false to expand them (draw their contents).	 * @param amount the number of levels of hierarchy to expand/unexpand.	 * If negative, prompt for an amount.	 */	public static void DoExpandCommands(boolean unExpand, int amount)	{		if (amount < 0)		{			Object obj = JOptionPane.showInputDialog("Number of levels to " + (unExpand ? "unexpand" : "expand"), "1");			if (obj != null) amount = TextUtils.atoi((String)obj);			if (amount <= 0) return;		}		List<NodeInst> list = MenuCommands.getSelectedNodes();		expandFlagBit = new HashSet<NodeInst>();		if (unExpand)		{			for(NodeInst ni : list)			{				if (!ni.isCellInstance()) continue;				{					if (ni.isExpanded())						setUnExpand(ni, amount);				}			}		}		for(NodeInst ni : list)		{			if (unExpand) doUnExpand(ni); else				doExpand(ni, amount, 0);			EditWindow.expansionChanged(ni.getParent());		}		expandFlagBit = null;		EditWindow.clearSubCellCache();		EditWindow.repaintAllContents();	}	/**	 * Method to recursively expand the cell "ni" by "amount" levels.	 * "sofar" is the number of levels that this has already been expanded.	 */	private static void doExpand(NodeInst ni, int amount, int sofar)	{		if (!ni.isExpanded())		{			// expanded the cell			ni.setExpanded();			// if depth limit reached, quit			if (++sofar >= amount) return;		}		// explore insides of this one		if (!ni.isCellInstance()) return;		Cell cell = (Cell)ni.getProto();		for(Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); )		{			NodeInst subNi = it.next();			if (!subNi.isCellInstance()) continue;			// ignore recursive references (showing icon in contents)			if (subNi.isIconOfParent()) continue;			doExpand(subNi, amount, sofar);		}	}	private static void doUnExpand(NodeInst ni)	{		if (!ni.isExpanded()) return;		if (!ni.isCellInstance()) return;		Cell cell = (Cell)ni.getProto();		for(Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); )		{			NodeInst subNi = it.next();			if (!subNi.isCellInstance()) continue;			// ignore recursive references (showing icon in contents)			if (subNi.isIconOfParent()) continue;			if (subNi.isExpanded()) doUnExpand(subNi);		}		// expanded the cell		if (expandFlagBit.contains(ni))		{			ni.clearExpanded();		}	}	private static int setUnExpand(NodeInst ni, int amount)	{		expandFlagBit.remove(ni);		if (!ni.isExpanded()) return(0);		int depth = 0;		if (ni.isCellInstance())		{			Cell cell = (Cell)ni.getProto();			for(Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); )			{				NodeInst subNi = it.next();				if (!subNi.isCellInstance()) continue;				// ignore recursive references (showing icon in contents)				if (subNi.isIconOfParent()) continue;				if (subNi.isExpanded())					depth = Math.max(depth, setUnExpand(subNi, amount));			}			if (depth < amount) expandFlagBit.add(ni);		}		return depth+1;	}	/****************************** LIBRARY CHANGES ******************************/	/**	 * Method to implement the "List Libraries" command.	 */	public static void listLibrariesCommand()	{		System.out.println("----- Libraries: -----");		int k = 0;		for (Library lib : Library.getVisibleLibraries())		{			if (lib.isHidden()) continue;			StringBuffer infstr = new StringBuffer();			infstr.append(lib.getName());			if (lib.isChanged())			{				infstr.append("*");				k++;			}			if (lib.getLibFile() != null)				infstr.append(" (disk file: " + lib.getLibFile() + ")");			System.out.println(infstr.toString());			// see if there are dependencies			Set<String> dummyLibs = new HashSet<String>();			HashSet<Library> markedLibs = new HashSet<Library>();			for(Iterator<Cell> cIt = lib.getCells(); cIt.hasNext(); )			{				Cell cell = cIt.next();				for(Iterator<NodeInst> nIt = cell.getNodes(); nIt.hasNext(); )				{					NodeInst ni = nIt.next();					if (!ni.isCellInstance()) continue;					Cell subCell = (Cell)ni.getProto();					String pt = subCell.getVarValue(LibraryFiles.IO_TRUE_LIBRARY, String.class);					if (pt != null)					{						dummyLibs.add(pt);					}					markedLibs.add(subCell.getLibrary());				}			}			for(Iterator<Library> lIt = Library.getLibraries(); lIt.hasNext(); )			{				Library oLib = lIt.next();				if (oLib == lib) continue;				if (!markedLibs.contains(oLib)) continue;				System.out.println("   Makes use of cells in " + oLib);				infstr = new StringBuffer();				infstr.append("      These cells make reference to that library:");				for(Iterator<Cell> cIt = lib.getCells(); cIt.hasNext(); )				{					Cell cell = cIt.next();					boolean found = false;					for(Iterator<NodeInst> nIt = cell.getNodes(); nIt.hasNext(); )					{						NodeInst ni = nIt.next();						if (!ni.isCellInstance()) continue;						Cell subCell = (Cell)ni.getProto();						if (subCell.getLibrary() == oLib) { found = true;   break; }					}					if (found) infstr.append(" " + cell.noLibDescribe());				}				System.out.println(infstr.toString());			}			for(String dummyLibName : dummyLibs)			{				System.out.println("   Has dummy cells that should be in library " + dummyLibName);				infstr = new StringBuffer();				infstr.append("      Instances of these dummy cells are in:");				for(Iterator<Cell> cIt = lib.getCells(); cIt.hasNext(); )				{					Cell cell = cIt.next();					boolean found = false;					for(Iterator<NodeInst> nIt = cell.getNodes(); nIt.hasNext(); )					{						NodeInst ni = nIt.next();						if (!ni.isCellInstance()) continue;						Cell subCell = (Cell)ni.getProto();						String libName = subCell.getVarValue(LibraryFiles.IO_TRUE_LIBRARY, String.class);						if (dummyLibName.equals(libName)) { found = true;   break; }					}					if (found) infstr.append(" " + cell.noLibDescribe());				}				System.out.println(infstr.toString());			}		}		if (k != 0) System.out.println("   (* means library has changed)");	}	/**	 * Method to implement the "Rename Current Technology" command.	 */	public static void renameCurrentTechnology()	{		Technology tech = Technology.getCurrent();		String techName = tech.getTechName();		String val = JOptionPane.showInputDialog("New Name of Technology " + techName + ":", techName);		if (val == null) return;		if (val.equals(techName)) return;		new CircuitChangeJobs.RenameTechnology(tech, val);	}	/**	 * Method to implement the "Rename Library" command.	 */	public static void renameLibrary(Library lib)	{		String val = JOptionPane.showInputDialog("New Name of Library:", lib.getName());		if (val == null) return;		new CircuitChangeJobs.RenameLibrary(lib, val);	}	/**	 * Method to implement the "Repair Librariesy" command.	 */	public static void checkAndRepairCommand(boolean repair)	{		new CircuitChangeJobs.CheckAndRepairJob(repair);	}    /****************************** DELETE UNUSED NODES ******************************/    /**     * Method to remove nodes containing metal layers that have been disabled.     * If library is null, then check all existing libraries     */    public static void removeUnusedLayers(Library lib)    {        // kick the delete job//        new RemoveUnusedLayers(lib);    }}

⌨️ 快捷键说明

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