📄 toolmenu.java
字号:
new EMenuItem("Do _Compaction") { public void run() { Compaction.compactNow(); }}), //------------------- Others SEPARATOR, new EMenuItem("List _Tools") { public void run() { listToolsCommand(); }}, // mnemonic keys available: ABCDEFGHIJKLMNOPQ STUVWXYZ new EMenu("Lang_uages", new EMenuItem("_Run Java Bean Shell Script") { public void run() { javaBshScriptCommand(); }})); } // ---------------------------- Tools Menu Commands ---------------------------- // Logical Effort Tool public static void optimizeEqualGateDelaysCommand(boolean newAlg) { EditWindow curEdit = EditWindow.needCurrent(); if (curEdit == null) return; LETool letool = LETool.getLETool(); if (letool == null) { System.out.println("Logical Effort tool not found"); return; } // set current cell to use global context curEdit.setCell(curEdit.getCell(), VarContext.globalContext, null); // optimize cell for equal gate delays if (curEdit.getCell() == null) { System.out.println("No current cell"); return; } letool.optimizeEqualGateDelays(curEdit.getCell(), curEdit.getVarContext(), newAlg); } /** Print Logical Effort info for highlighted nodes */ public static void printLEInfoCommand() { EditWindow wnd = EditWindow.needCurrent(); if (wnd == null) return; Highlighter highlighter = wnd.getHighlighter(); VarContext context = wnd.getVarContext(); if (highlighter.getNumHighlights() == 0) { System.out.println("Nothing highlighted"); return; } for (Highlight2 h : highlighter.getHighlights()) { if (!h.isHighlightEOBJ()) continue; ElectricObject eobj = h.getElectricObject(); if (eobj instanceof PortInst) { PortInst pi = (PortInst)eobj; pi.getInfo(); eobj = pi.getNodeInst(); } if (eobj instanceof NodeInst) { NodeInst ni = (NodeInst)eobj; LETool.printResults(ni, context); } } } public static void backAnnotateCommand() { EditWindow wnd = EditWindow.needCurrent(); if (wnd == null) return; Cell cell = wnd.getCell(); if (cell == null) return; BackAnnotateJob job = new BackAnnotateJob(cell); job.startJob(); } /** * Method to handle the "List Layer Coverage", "Coverage Implant Generator", polygons merge * except "List Geometry on Network" commands. */ public static void layerCoverageCommand(LayerCoverageTool.LCMode func, GeometryHandler.GHMode mode) { Cell curCell = WindowFrame.needCurCell(); if (curCell == null) return; LayerCoverageTool.layerCoverageCommand(func, mode, curCell, true); } private static class BackAnnotateJob extends Job { private Cell cell; public BackAnnotateJob(Cell cell) { super("BackAnnotate", User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER); this.cell = cell; } public boolean doIt() throws JobException { Cell[] schLayCells = NccUtils.findSchematicAndLayout(cell); if (schLayCells == null) { System.out.println("Could not find schematic and layout cells for "+cell.describe(true)); return false; } if (cell.getView() == View.LAYOUT) { // check if layout cells match, if not, replace schLayCells[1] = cell; } // run NCC, get results NccOptions options = new NccOptions(); NccResults results = Ncc.compare(schLayCells[0], null, schLayCells[1], null, options, this); // get result of comparison of top schematic and layout Cells NccResult result = results.getResultFromRootCells(); if (!result.match()) { System.out.println("Ncc failed, can't back-annotate"); return false; } // find all wire models in schematic int wiresUpdated = 0; ArrayList<Network> networks = new ArrayList<Network>(); HashMap<Network,NodeInst> map = new HashMap<Network,NodeInst>(); // map of networks to associated wire model nodeinst for (Iterator<NodeInst> it = schLayCells[0].getNodes(); it.hasNext(); ) { NodeInst ni = it.next(); Variable var = ni.getParameterOrVariable(LENetlister.ATTR_LEWIRE); if (var == null) continue; var = ni.getParameterOrVariable(LENetlister.ATTR_L); if (var == null) { System.out.println("No attribute L on wire model "+ni.describe(true)+", ignoring it."); continue; } // grab network wire model is on PortInst pi = ni.getPortInst(0); if (pi == null) continue; Netlist netlist = schLayCells[0].getNetlist(NccNetlist.SHORT_RESISTORS); Network schNet = netlist.getNetwork(pi); networks.add(schNet); map.put(schNet, ni); } // sort networks by name Collections.sort(networks, new TextUtils.NetworksByName()); // update wire models for (Network schNet : networks) { // find equivalent network in layouy Equivalence equiv = result.getEquivalence(); HierarchyEnumerator.NetNameProxy proxy = equiv.findEquivalentNet(VarContext.globalContext, schNet); if (proxy == null) { System.out.println("No matching network in layout for "+schNet.getName()+", ignoring"); continue; } Network layNet = proxy.getNet(); Cell netcell = layNet.getParent(); // get wire length HashSet<Network> nets = new HashSet<Network>(); nets.add(layNet); LayerCoverageTool.GeometryOnNetwork geoms = LayerCoverageTool.listGeometryOnNetworks(netcell, nets, false, GeometryHandler.GHMode.ALGO_SWEEP); double length = geoms.getTotalWireLength(); // update wire length NodeInst ni = map.get(schNet); ni.updateVar(LENetlister.ATTR_L, new Double(length)); wiresUpdated++; System.out.println("Updated wire model "+ni.getName()+" on layout network "+proxy.toString()+" to: "+length+" lambda"); } System.out.println("Updated "+wiresUpdated+" wire models in "+schLayCells[0]+" from layout "+schLayCells[1]); return true; } } public static void clearSizesNodableCommand() { EditWindow wnd = EditWindow.needCurrent(); if (wnd == null) return; Highlighter highlighter = wnd.getHighlighter(); if (highlighter.getNumHighlights() == 0) { System.out.println("Nothing highlighted"); return; } for (Highlight2 h : highlighter.getHighlights()) { if (!h.isHighlightEOBJ()) continue; ElectricObject eobj = h.getElectricObject(); if (eobj instanceof PortInst) { PortInst pi = (PortInst)eobj; pi.getInfo(); eobj = pi.getNodeInst(); } if (eobj instanceof NodeInst) { NodeInst ni = (NodeInst)eobj; LETool.clearStoredSizesJob(ni); } } System.out.println("Sizes cleared"); } public static void clearSizesCommand() { for (Library lib : Library.getVisibleLibraries()) { LETool.clearStoredSizesJob(lib); } System.out.println("Sizes cleared"); } private static final double COEFFICIENTMETAL = 0.25; private static final double COEFFICIENTPOLY = 0.25; private static final double COEFFICIENTDIFF = 0.7; public static void estimateDelaysCommand() { Cell cell = WindowFrame.needCurCell(); if (cell == null) return; System.out.println("Delay estimation for each network is a ratio of the following:"); System.out.println(" Numerator is the sum of these layers on the network:"); System.out.println(" Transistor widths"); System.out.println(" Diffusion half-perimeter, weighted by " + COEFFICIENTDIFF); System.out.println(" Polysilicon half-perimeter, weighted by " + COEFFICIENTPOLY); System.out.println(" Metal half-perimeter, weighted by " + COEFFICIENTMETAL); System.out.println(" Denominator is the width of transistors on the network"); System.out.println(" Separate results are computed for N and P transistors, as well as their sum"); System.out.println("-----------------------------------------------------------------------------"); Netlist nl = cell.acquireUserNetlist(); for(Iterator<Network> it = nl.getNetworks(); it.hasNext(); ) { Network net = it.next(); Set<Network> nets = new HashSet<Network>(); nets.add(net); LayerCoverageTool.GeometryOnNetwork geoms = LayerCoverageTool.listGeometryOnNetworks(cell, nets, false, GeometryHandler.GHMode.ALGO_SWEEP); LayerCoverageTool.TransistorInfo p_gate = geoms.getPGate(); LayerCoverageTool.TransistorInfo n_gate = geoms.getNGate(); LayerCoverageTool.TransistorInfo p_active = geoms.getPActive(); LayerCoverageTool.TransistorInfo n_active = geoms.getNActive(); // compute the numerator, starting with gate widths double numerator = p_gate.width + n_gate.width; if (numerator == 0) continue; System.out.println("Network " + net.describe(true) + " ratio computation:"); System.out.println(" N Gate width = " + n_gate.width + ", P Gate width = " + p_gate.width); // numerator also sums half-perimeter of each layer List<Layer> layers = geoms.getLayers(); List<Double> halfPerimeters = geoms.getHalfPerimeters(); for(int i=0; i<layers.size(); i++) { Layer layer = layers.get(i); Layer.Function fun = layer.getFunction(); if (!fun.isDiff() && !fun.isMetal() && !fun.isPoly()) continue; if (fun.isGatePoly()) continue; Double halfPerimeter = halfPerimeters.get(i); double coefficient = COEFFICIENTDIFF; if (fun.isMetal()) coefficient = COEFFICIENTMETAL; if (fun.isPoly()) coefficient = COEFFICIENTPOLY; double result = halfPerimeter.doubleValue() * coefficient; System.out.println(" Layer " + layer.getName() + " half-perimeter is " + TextUtils.formatDouble(halfPerimeter.doubleValue()) + " x " + coefficient + " = " + TextUtils.formatDouble(result)); numerator += result; } System.out.println(" Numerator is the sum of these factors (" + TextUtils.formatDouble(numerator) + ")"); // show the results double pdenominator = p_active.width; double ndenominator = n_active.width; if (ndenominator == 0) System.out.println(" N denominator undefined"); else System.out.println(" N denominator = " + ndenominator + ", ratio = " + TextUtils.formatDouble(numerator/ndenominator)); if (pdenominator == 0) System.out.println(" P denominator undefined"); else System.out.println(" P denominator = " + pdenominator + ", ratio = " + TextUtils.formatDouble(numerator/pdenominator)); if (ndenominator+pdenominator == 0) System.out.println(" N+P Denominator undefined"); else System.out.println(" N+P Denominator = " + (ndenominator+pdenominator) + ", ratio = " + TextUtils.formatDouble(numerator/(ndenominator+pdenominator))); } } public static void addLEAttribute() { EditWindow wnd = EditWindow.needCurrent(); if (wnd == null) return; Highlighter highlighter = wnd.getHighlighter(); List<DisplayedText> textlist = highlighter.getHighlightedText(true); for (DisplayedText text : textlist) { if (text.getElectricObject() instanceof Export) { new AddLEAttribute((Export)text.getElectricObject()); return; } } } private static class AddLEAttribute extends Job { private Export ex; protected AddLEAttribute(Export ex) { super("Add LE Attribute", User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -