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

📄 toolmenu.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            // only want complex nodes            if (!no.isCellInstance()) continue;            Cell subCell = (Cell)no.getProto();            // look at all wires connected to the node            for(Iterator<PortProto> pIt = subCell.getPorts(); pIt.hasNext(); )            {                Export pp = (Export)pIt.next();                int width = netlist.getBusWidth(pp);                for(int i=0; i<width; i++)                {                    Network oNet = netlist.getNetwork(no, pp, i);                    if (oNet != net) continue;                    // found the net here: report it                    if (listedExports.contains(pp)) continue;                    listedExports.add(pp);                    System.out.println("    Export " + pp.getName() + " in " + subCell);            		Netlist subNetlist = subCell.acquireUserNetlist();            		if (subNetlist == null)            		{            			System.out.println("Sorry, a deadlock aborted query (network information unavailable).  Please try again");            			return true;            		}                    Network subNet = subNetlist.getNetwork(pp, i);                    if (findPortsDown(subNetlist, subNet, listedExports)) return true;                }            }        }        return false;    }    /**     * Method to handle the "List Geometry On Network" command.     */    public static void listGeometryOnNetworkCommand(GeometryHandler.GHMode mode)    {	    Cell cell = WindowFrame.needCurCell();        if (cell == null) return;        EditWindow wnd = EditWindow.needCurrent();        if (wnd == null) return;        HashSet<Network> nets = (HashSet<Network>)wnd.getHighlighter().getHighlightedNetworks();        if (nets.isEmpty())        {            System.out.println("No network in " + cell + " selected");            return;        }        LayerCoverageTool.listGeometryOnNetworks(cell, nets, true, mode);    }    private static final double SQSIZE = 0.4;    /**     * Method to highlight every network in the current cell     * using a different color     */    private static void showAllNetworksCommand()    {        EditWindow wnd = EditWindow.needCurrent();        if (wnd == null) return;        Cell cell = wnd.getCell();        if (cell == null) return;        wnd.clearHighlighting();        Netlist nl = cell.acquireUserNetlist();        int colors = nl.getNumNetworks();        Color [] netColors = makeUniqueColors(colors);        int index = 0;		Highlighter h = wnd.getHighlighter();        for(Iterator<Network> it = nl.getNetworks(); it.hasNext(); )        {        	Network net = it.next();        	Iterator<ArcInst> aIt = net.getArcs();        	if (!aIt.hasNext()) continue;        	Color col = netColors[index++];        	for( ; aIt.hasNext(); )        	{        		ArcInst ai = aIt.next();                Point2D [] points = new Point2D[2];        		points[0] = ai.getHeadLocation();        		points[1] = ai.getTailLocation();        		Poly poly = new Poly(points);        		poly.setStyle(Poly.Type.OPENED);        		h.addPoly(poly, cell, col);        		if (ai.getHeadPortInst().getNodeInst().isCellInstance())        		{                    points = new Point2D[4];            		EPoint ctr = ai.getHeadLocation();            		points[0] = new EPoint(ctr.getX()-SQSIZE, ctr.getY()-SQSIZE);            		points[1] = new EPoint(ctr.getX()-SQSIZE, ctr.getY()+SQSIZE);            		points[2] = new EPoint(ctr.getX()+SQSIZE, ctr.getY()+SQSIZE);            		points[3] = new EPoint(ctr.getX()+SQSIZE, ctr.getY()-SQSIZE);            		poly = new Poly(points);            		poly.setStyle(Poly.Type.CLOSED);            		h.addPoly(poly, cell, col);        		}        		if (ai.getTailPortInst().getNodeInst().isCellInstance())        		{                    points = new Point2D[4];            		EPoint ctr = ai.getTailLocation();            		points[0] = new EPoint(ctr.getX()-SQSIZE, ctr.getY()-SQSIZE);            		points[1] = new EPoint(ctr.getX()-SQSIZE, ctr.getY()+SQSIZE);            		points[2] = new EPoint(ctr.getX()+SQSIZE, ctr.getY()+SQSIZE);            		points[3] = new EPoint(ctr.getX()+SQSIZE, ctr.getY()-SQSIZE);            		poly = new Poly(points);            		poly.setStyle(Poly.Type.CLOSED);            		h.addPoly(poly, cell, col);        		}        	}        }        wnd.finishedHighlighting();    }    /**     * Method to generate unique colors.     * Uses this pattern	 *	R: 100 110    111 202 202 112    11 23 23    11 24 24	 *	G: 010 101    202 111 022 121    23 11 32    24 11 42	 *	B: 001 011    022 022 111 211    32 32 11    42 42 11	 * Where:	 *  0=off	 *	1=the main color	 *	2=halfway between 1 and 0	 *	3=halfway between 1 and 2	 *	4=halfway between 2 and 0     * @param numColors the number of colors to generate     * @return an array of colors.     */	private static Color [] makeUniqueColors(int numColors)	{		int numRuns = (numColors+29) / 30;		Color [] colors = new Color[numColors];		int index = 0;		for(int i=0; i<numRuns; i++)		{			int c1 = 255 - 255/numRuns*i;			int c2 = c1 / 2;			int c3 = c2 / 2;			int c4 = (c1 + c2) / 2;			// combinations of color 1			if (index < numColors) colors[index++] = new Color(c1,  0,  0);			if (index < numColors) colors[index++] = new Color( 0, c1,  0);			if (index < numColors) colors[index++] = new Color( 0,  0, c1);			if (index < numColors) colors[index++] = new Color(c1, c1,  0);			if (index < numColors) colors[index++] = new Color( 0, c1, c1);			if (index < numColors) colors[index++] = new Color(c1,  0, c1);			// combinations of the colors 1 and 2			if (index < numColors) colors[index++] = new Color(c1, c2,  0);			if (index < numColors) colors[index++] = new Color(c1,  0, c2);			if (index < numColors) colors[index++] = new Color(c1, c2, c2);			if (index < numColors) colors[index++] = new Color(c2, c1,  0);			if (index < numColors) colors[index++] = new Color( 0, c1, c2);			if (index < numColors) colors[index++] = new Color(c2, c1, c2);			if (index < numColors) colors[index++] = new Color(c2,  0, c1);			if (index < numColors) colors[index++] = new Color( 0, c2, c1);			if (index < numColors) colors[index++] = new Color(c2, c2, c1);			// combinations of colors 1, 2, and 3			if (index < numColors) colors[index++] = new Color(c1, c2, c3);			if (index < numColors) colors[index++] = new Color(c1, c3, c2);			if (index < numColors) colors[index++] = new Color(c2, c1, c3);			if (index < numColors) colors[index++] = new Color(c3, c1, c2);			if (index < numColors) colors[index++] = new Color(c2, c3, c1);			if (index < numColors) colors[index++] = new Color(c3, c2, c1);			// combinations of colors 1, 2, and 4			if (index < numColors) colors[index++] = new Color(c1, c2, c4);			if (index < numColors) colors[index++] = new Color(c1, c4, c2);			if (index < numColors) colors[index++] = new Color(c2, c1, c4);			if (index < numColors) colors[index++] = new Color(c4, c1, c2);			if (index < numColors) colors[index++] = new Color(c2, c4, c1);			if (index < numColors) colors[index++] = new Color(c4, c2, c1);		}		return colors;	}    public static void listGeomsAllNetworksCommand() {        EditWindow wnd = EditWindow.needCurrent();        if (wnd == null) return;        Cell cell = wnd.getCell();        if (cell == null) return;        new ListGeomsAllNetworksJob(cell);    }    private static class ListGeomsAllNetworksJob extends Job {        private Cell cell;    	public ListGeomsAllNetworksJob(Cell cell) {            super("ListGeomsAllNetworks", User.getUserTool(), Job.Type.EXAMINE, null, null, Job.Priority.USER);            this.cell = cell;            startJob();        }        public boolean doIt() throws JobException {            Netlist netlist = cell.getNetlist();//            Netlist netlist = cell.getNetlist(true);            List<Network> networks = new ArrayList<Network>();            for (Iterator<Network> it = netlist.getNetworks(); it.hasNext(); ) {                networks.add(it.next());            }            // sort list of networks by name            Collections.sort(networks, new TextUtils.NetworksByName());            for (Network net : networks) {                HashSet<Network> nets = new HashSet<Network>();                nets.add(net);                LayerCoverageTool.GeometryOnNetwork geoms = LayerCoverageTool.listGeometryOnNetworks(cell, nets,                        false, GeometryHandler.GHMode.ALGO_SWEEP);                if (geoms.getTotalWireLength() == 0) continue;                System.out.println("Network "+net+" has wire length "+geoms.getTotalWireLength());            }            return true;        }    }	public static void showPowerAndGround()    {        Cell cell = WindowFrame.needCurCell();        if (cell == null) return;        EditWindow wnd = EditWindow.needCurrent();        if (wnd == null) return;        Highlighter highlighter = wnd.getHighlighter();//        Netlist netlist = cell.getUserNetlist();		Netlist netlist = cell.acquireUserNetlist();		if (netlist == null)		{			System.out.println("Sorry, a deadlock aborted query (network information unavailable).  Please try again");			return;		}        HashSet<Network> pAndG = new HashSet<Network>();        for(Iterator<PortProto> it = cell.getPorts(); it.hasNext(); )        {            Export pp = (Export)it.next();            if (pp.isPower() || pp.isGround())            {                int width = netlist.getBusWidth(pp);                for(int i=0; i<width; i++)                {                    Network net = netlist.getNetwork(pp, i);                    pAndG.add(net);                }            }        }        for(Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); )        {            NodeInst ni = it.next();            PrimitiveNode.Function fun = ni.getFunction();            if (fun != PrimitiveNode.Function.CONPOWER && fun != PrimitiveNode.Function.CONGROUND)                continue;            for(Iterator<Connection> cIt = ni.getConnections(); cIt.hasNext(); )            {                Connection con = cIt.next();                ArcInst ai = con.getArc();                int width = netlist.getBusWidth(ai);                for(int i=0; i<width; i++)                {                    Network net = netlist.getNetwork(ai, i);                    pAndG.add(net);                }            }        }        highlighter.clear();        for(Network net : pAndG)        {            highlighter.addNetwork(net, cell);        }        highlighter.finished();        if (pAndG.size() == 0)            System.out.println("This cell has no Power or Ground networks");    }	private static class RepairPowerAndGround extends Job    {        protected RepairPowerAndGround()        {            super("Repair Power and Ground", User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER);            startJob();        }        public boolean doIt() throws JobException        {			validatePowerAndGround(true);            return true;        }    }    public static void validatePowerAndGround(boolean repair)    {		if (repair) System.

⌨️ 快捷键说明

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