📄 toolmenu.java
字号:
this.ex = ex; startJob(); } public boolean doIt() throws JobException { TextDescriptor td = TextDescriptor.getAnnotationTextDescriptor().withDispPart(TextDescriptor.DispPos.NAMEVALUE).withOff(-1.5, -1); ex.newVar(LENetlister.ATTR_le, new Double(1.0), td); return true; } } public static void loadLogicalEffortLibraries() { if (Library.findLibrary("purpleGeneric180") != null) return; URL url = LibFile.getLibFile("purpleGeneric180.jelib"); new FileMenu.ReadLibrary(url, FileType.JELIB, null); } /** * Method to handle the "Show Network" command. */ public static void showNetworkCommand() { EditWindow wnd = EditWindow.needCurrent(); if (wnd == null) return; Cell cell = wnd.getCell(); if (wnd == null) return; Highlighter highlighter = wnd.getHighlighter(); highlighter.showNetworks(cell); // 3D display if available WindowFrame.show3DHighlight(); highlighter.finished(); } /** * Method to handle the "List Networks" command. */ public static void listNetworksCommand() { Cell cell = WindowFrame.getCurrentCell(); if (cell == null) return; Netlist netlist = cell.acquireUserNetlist(); if (netlist == null) { System.out.println("Sorry, a deadlock aborted netlist display (network information unavailable). Please try again"); return; } int total = 0; for(Iterator<Network> it = netlist.getNetworks(); it.hasNext(); ) { Network net = it.next(); String netName = net.describe(false); if (netName.length() == 0) continue; StringBuffer infstr = new StringBuffer(); infstr.append("'" + netName + "'");// if (net->buswidth > 1)// {// formatinfstr(infstr, _(" (bus with %d signals)"), net->buswidth);// } boolean connected = false; for(Iterator<ArcInst> aIt = net.getArcs(); aIt.hasNext(); ) { ArcInst ai = aIt.next(); if (!connected) { connected = true; infstr.append(", on arcs:"); } infstr.append(" " + ai.describe(true)); } boolean exported = false; for(Iterator<Export> eIt = net.getExports(); eIt.hasNext(); ) { Export pp = eIt.next(); if (!exported) { exported = true; infstr.append(", with exports:"); } infstr.append(" " + pp.getName()); } System.out.println(infstr.toString()); total++; } if (total == 0) System.out.println("There are no networks in this cell"); } /** * Method to handle the "List Connections On Network" command. */ public static void listConnectionsOnNetworkCommand() { Cell cell = WindowFrame.needCurCell(); if (cell == null) return; EditWindow wnd = EditWindow.needCurrent(); if (wnd == null) return; Highlighter highlighter = wnd.getHighlighter(); Set<Network> nets = highlighter.getHighlightedNetworks(); Netlist netlist = cell.acquireUserNetlist(); if (netlist == null) { System.out.println("Sorry, a deadlock aborted query (network information unavailable). Please try again"); return; } for(Network net : nets) { System.out.println("Network " + net.describe(true) + ":"); int total = 0; for(Iterator<Nodable> nIt = netlist.getNodables(); nIt.hasNext(); ) { Nodable no = nIt.next(); NodeProto np = no.getProto(); HashMap<Network,HashSet<Object>> portNets = new HashMap<Network,HashSet<Object>>(); for(Iterator<PortProto> pIt = np.getPorts(); pIt.hasNext(); ) { PortProto pp = pIt.next(); if (pp instanceof PrimitivePort && ((PrimitivePort)pp).isIsolated()) { NodeInst ni = (NodeInst)no; for(Iterator<Connection> cIt = ni.getConnections(); cIt.hasNext(); ) { Connection con = cIt.next(); ArcInst ai = con.getArc(); Network oNet = netlist.getNetwork(ai, 0); HashSet<Object> ports = portNets.get(oNet); if (ports == null) { ports = new HashSet<Object>(); portNets.put(oNet, ports); } ports.add(pp); } } else { int width = 1; if (pp instanceof Export) { Export e = (Export)pp; width = netlist.getBusWidth(e); } for(int i=0; i<width; i++) { Network oNet = netlist.getNetwork(no, pp, i); HashSet<Object> ports = portNets.get(oNet); if (ports == null) { ports = new HashSet<Object>(); portNets.put(oNet, ports); } ports.add(pp); } } } // if there is only 1 net connected, the node is unimportant if (portNets.size() <= 1) continue; HashSet<Object> ports = portNets.get(net); if (ports == null) continue; if (total == 0) System.out.println(" Connects to:"); String name = null; if (no instanceof NodeInst) name = ((NodeInst)no).describe(false); else { name = no.getName(); } for (Object obj : ports) { PortProto pp = (PortProto)obj; System.out.println(" Node " + name + ", port " + pp.getName()); total++; } } if (total == 0) System.out.println(" Not connected"); } } /** * Method to handle the "List Exports On Network" command. */ public static void listExportsOnNetworkCommand() { Cell cell = WindowFrame.needCurCell(); if (cell == null) return; EditWindow wnd = EditWindow.needCurrent(); if (wnd == null) return; Highlighter highlighter = wnd.getHighlighter(); Set<Network> nets = highlighter.getHighlightedNetworks(); Netlist netlist = cell.acquireUserNetlist(); if (netlist == null) { System.out.println("Sorry, a deadlock aborted query (network information unavailable). Please try again"); return; } for(Network net : nets) { System.out.println("Network " + net.describe(true) + ":"); // find all exports on network "net" HashSet<Export> listedExports = new HashSet<Export>(); System.out.println(" Going up the hierarchy from " + cell + ":"); if (findPortsUp(netlist, net, cell, listedExports)) break; System.out.println(" Going down the hierarchy from " + cell + ":"); if (findPortsDown(netlist, net, listedExports)) break; } } /** * Method to handle the "List Exports Below Network" command. */ public static void listExportsBelowNetworkCommand() { Cell cell = WindowFrame.needCurCell(); if (cell == null) return; EditWindow wnd = EditWindow.needCurrent(); if (wnd == null) return; Highlighter highlighter = wnd.getHighlighter(); Set<Network> nets = highlighter.getHighlightedNetworks(); Netlist netlist = cell.acquireUserNetlist(); if (netlist == null) { System.out.println("Sorry, a deadlock aborted query (network information unavailable). Please try again"); return; } for(Network net : nets) { System.out.println("Network " + net.describe(true) + ":"); // find all exports on network "net" if (findPortsDown(netlist, net, new HashSet<Export>())) break; } } /** * helper method for "telltool network list-hierarchical-ports" to print all * ports connected to net "net" in cell "cell", and recurse up the hierarchy. * @return true if an error occurred. */ private static boolean findPortsUp(Netlist netlist, Network net, Cell cell, HashSet<Export> listedExports) { // look at every node in the cell for(Iterator<PortProto> it = cell.getPorts(); it.hasNext(); ) { Export pp = (Export)it.next(); int width = netlist.getBusWidth(pp); for(int i=0; i<width; i++) { Network ppNet = netlist.getNetwork(pp, i); if (ppNet != net) continue; if (listedExports.contains(pp)) continue; listedExports.add(pp); System.out.println(" Export " + pp.getName() + " in " + cell); // code to find the proper instance Cell instanceCell = cell.iconView(); if (instanceCell == null) instanceCell = cell; // ascend to higher cell and continue for(Iterator<CellUsage> uIt = instanceCell.getUsagesOf(); uIt.hasNext(); ) { CellUsage u = uIt.next(); Cell superCell = u.getParent(); Netlist superNetlist = cell.acquireUserNetlist(); if (superNetlist == null) { System.out.println("Sorry, a deadlock aborted query (network information unavailable). Please try again"); return true; } for(Iterator<Nodable> nIt = superNetlist.getNodables(); nIt.hasNext(); ) { Nodable no = nIt.next(); if (no.getProto() != cell) continue; Network superNet = superNetlist.getNetwork(no, pp, i); if (findPortsUp(superNetlist, superNet, superCell, listedExports)) return true; } } } } return false; } /** * helper method for "telltool network list-hierarchical-ports" to print all * ports connected to net "net" in cell "cell", and recurse down the hierarchy * @return true on error. */ private static boolean findPortsDown(Netlist netlist, Network net, HashSet<Export> listedExports) { // look at every node in the cell for(Iterator<Nodable> it = netlist.getNodables(); it.hasNext(); ) { Nodable no = it.next();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -