📄 def.java
字号:
return(tmpb); } return name; } private boolean readPin(Cell cell) throws IOException { // get the pin name String key = mustGetKeyword("PIN"); if (key == null) return true; String pinName = translateDefName(key); PortCharacteristic portCharacteristic = null; NodeProto np = null; Point2D ll = null, ur = null, xy = null; boolean haveCoord = false; GetOrientation orient = null; for(;;) { // get the next keyword key = mustGetKeyword("PIN"); if (key == null) return true; if (key.equals("+")) { key = mustGetKeyword("PIN"); if (key == null) return true; if (key.equalsIgnoreCase("NET")) { key = mustGetKeyword("net name"); if (key == null) return true; continue; } if (key.equalsIgnoreCase("DIRECTION")) { key = mustGetKeyword("DIRECTION"); if (key == null) return true; if (key.equalsIgnoreCase("INPUT")) portCharacteristic = PortCharacteristic.IN; else if (key.equalsIgnoreCase("OUTPUT")) portCharacteristic = PortCharacteristic.OUT; else if (key.equalsIgnoreCase("INOUT")) portCharacteristic = PortCharacteristic.BIDIR; else if (key.equalsIgnoreCase("FEEDTHRU")) portCharacteristic = PortCharacteristic.BIDIR; else { reportError("Unknown direction (" + key + ")"); return true; } continue; } if (key.equalsIgnoreCase("USE")) { key = mustGetKeyword("USE"); if (key == null) return true; if (key.equalsIgnoreCase("SIGNAL")) ; else if (key.equalsIgnoreCase("POWER")) portCharacteristic = PortCharacteristic.PWR; else if (key.equalsIgnoreCase("GROUND")) portCharacteristic = PortCharacteristic.GND; else if (key.equalsIgnoreCase("CLOCK")) portCharacteristic = PortCharacteristic.CLK; else if (key.equalsIgnoreCase("TIEOFF")) ; else if (key.equalsIgnoreCase("ANALOG")) ; else { reportError("Unknown usage (" + key + ")"); return true; } continue; } if (key.equalsIgnoreCase("LAYER")) { key = mustGetKeyword("LAYER"); if (key == null) return true; if (!schImport) { GetLayerInformation li = getLayerInformation(key); if (li.pin == null) { reportError("Unknown layer (" + key + ")"); return true; } np = li.pin; } ll = readCoordinate(); if (ll == null) return true; ur = readCoordinate(); if (ur == null) return true; continue; } if (key.equalsIgnoreCase("PLACED") || key.equalsIgnoreCase("FIXED")) { // get pin location and orientation xy = readCoordinate(); if (xy == null) return true; orient = new GetOrientation(); haveCoord = true; continue; } continue; } if (key.equals(";")) break; } if (schImport) { ArcProto apTry = null; for(Iterator<ArcProto> it = Technology.getCurrent().getArcs(); it.hasNext(); ) { apTry = it.next(); if (apTry.getName().equals("wire")) break; } if (apTry == null) { reportError("Unable to resolve pin component"); return true; } for(Iterator<PrimitiveNode> it = Technology.getCurrent().getNodes(); it.hasNext(); ) { PrimitiveNode loc_np = it.next(); // must have just one port if (loc_np.getNumPorts() != 1) continue; // port must connect to both arcs PortProto pp = loc_np.getPort(0); if (pp.connectsTo(apTry)) { np = loc_np; break; } } } // all factors read, now place the pin if (np != null && haveCoord) { // determine the pin size AffineTransform trans = orient.orient.pureRotate(); trans.transform(ll, ll); trans.transform(ur, ur); double sX = Math.abs(ll.getX() - ur.getX()); double sY = Math.abs(ll.getY() - ur.getY()); double cX = (ll.getX() + ur.getX()) / 2 + xy.getX(); double cY = (ll.getY() + ur.getY()) / 2 + xy.getY(); // make the pin NodeInst ni = NodeInst.makeInstance(np, new Point2D.Double(cX, cY), sX, sY, cell); if (ni == null) { reportError("Unable to create pin"); return true; } PortInst pi = ni.findPortInstFromProto(np.getPort(0)); Export e = Export.newInstance(cell, pi, pinName, portCharacteristic); if (e == null) { reportError("Unable to create pin name"); return true; } } return false; } /*************** COMPONENTS ***************/ private boolean readComponents(Cell cell) throws IOException { if (ignoreToSemicolon("COMPONENTS")) return true; for(;;) { // get the next keyword String key = mustGetKeyword("COMPONENTs"); if (key == null) return true; if (key.equals("-")) { if (readComponent(cell)) return true; continue; } if (key.equalsIgnoreCase("END")) { key = getAKeyword(); break; } // ignore the keyword if (ignoreToSemicolon(key)) return true; } return false; } /** * cell is the parent cell */ private boolean readComponent(Cell cell) throws IOException { // get the component name and model name String key = mustGetKeyword("COMPONENT"); if (key == null) return true; String compName = key; key = mustGetKeyword("COMPONENT"); if (key == null) return true; String modelName = key; // find the named cell Cell np; if (cell.getView() != null) { np = getNodeProto(modelName, cell.getLibrary(), cell); } else { /* cell does not have a view yet, have no idea * what view we need, so just get the first one */ np = getNodeProto(modelName, cell.getLibrary()); } if (np == null) { reportError("Unknown cell (" + modelName + ")"); return true; } for(;;) { // get the next keyword key = mustGetKeyword("COMPONENT"); if (key == null) return true; if (key.equals("+")) { key = mustGetKeyword("COMPONENT"); if (key == null) return true; if (key.equalsIgnoreCase("PLACED") || key.equalsIgnoreCase("FIXED")) { // handle placement Point2D pt = readCoordinate(); if (pt == null) return true; double nx = pt.getX(); double ny = pt.getY(); Orientation or = FetchOrientation(); // place the node double sX = np.getDefWidth(); double sY = np.getDefHeight(); Variable prX = np.getVar(prXkey); double width=0; if (prX != null) { String tmps = prX.getPureValue(0); width = TextUtils.atof(tmps); } else { width = sX; //no PR boundary, use cell boundary } Variable prY = np.getVar(prYkey); double height=0; if (prY != null) { String tmps = prY.getPureValue(0); height = TextUtils.atof(tmps); } else { height = sY; //no PR boundary, use cell boundary } // DEF orientations require translations from Java orientations if (or.equals(Orientation.YRR)) { // FN DEF orientation nx = nx + width; } if (or.equals(Orientation.Y)) { // FS DEF orientation ny = ny + height; } if (or.equals(Orientation.RR)) { // S DEF orientation ny = ny + height; nx = nx + width; } if (or.equals(Orientation.RRR)) { // E DEF orientation ny = ny + width; } if (or.equals(Orientation.R)) { // W DEF orientation nx = nx + height; } if (or.equals(Orientation.YRRR)) { // FE DEF orientation } if (or.equals(Orientation.YR)) { // FW DEF orientation nx = nx + height; ny = ny + width; } Point2D npt = new Point2D.Double(nx,ny); NodeInst ni = NodeInst.makeInstance(np, npt, sX, sY, cell, or, compName, 0); if (ni == null) { reportError("Unable to create node"); return true; } continue; } continue; } if (key.equals(";")) break; } return false; } /*************** NETS ***************/ private boolean readNets(Cell cell, boolean special) throws IOException { if (special) specialNetsHT = new Hashtable<String,PortInst>(); else normalNetsHT = new Hashtable<String,PortInst>(); PortHT = new Hashtable<Double,List<NodeInst>>(); for(;;) { // get the next keyword String key = mustGetKeyword("NETs"); if (key == null) return true; if (key.equals("-")) { if (readNet(cell, special)) return true; continue; } if (key.equalsIgnoreCase("END")) { key = getAKeyword(); break; } // ignore the keyword if (ignoreToSemicolon(key)) return true; } connectSpecialNormalNets(); return false; } private PortInst connectGlobal(Cell cell, String portName) { PortInst pi = null; PortInst lastPi = null; NodeInst ni = null; PortProto pp = null; for(Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); ) { ni = it.next(); pp = ni.getProto().findPortProto(portName); if (pp == null) continue; pi = ni.findPortInstFromProto(pp); if (lastPi != null && IOTool.isDEFLogicalPlacement()) { //do connection ArcInst ai = ArcInst.makeInstance(Generic.tech().unrouted_arc, pi, lastPi); if (ai == null) { reportError("Could not create unrouted arc"); return null; } } lastPi = pi; } return lastPi; } /** * Look for special nets that need to be merged with normal nets * Synopsys Astro router places patches of metal in special nets * to cover normal nets as a method of filling notches */ private void connectSpecialNormalNets() { if (specialNetsHT == null) return; if (normalNetsHT == null) return; if (!IOTool.isDEFLogicalPlacement()) return; for (Enumeration enSpec = specialNetsHT.keys(); enSpec.hasMoreElements();) { String netName = (String)enSpec.nextElement(); PortInst specPi = specialNetsHT.get(netName); PortInst normalPi = null; if (normalNetsHT.containsKey(netName)) { normalPi = normalNetsHT.get(netName); if (normalPi != null) { // create a logical net between these two points ArcInst ai = ArcInst.makeInstance(Generic.tech().unrouted_arc, specPi, normalPi); if (ai == null) { reportError("Could not create unrouted arc"); return; } } } } } private ViaDef checkForVia(String key) { ViaDef vd = null; for(vd = firstViaDef; vd != null; vd = vd.nextViaDef) if (key.equalsIgnoreCase(vd.viaName)) break; if (vd == null) { // see if the via name is from the LEF file for(vd = firstViaDefFromLEF; vd != null; vd = vd.nextViaDef) if (key.equalsIgnoreCase(vd.viaName)) break; } return vd; } private boolean readNet(Cell cell, boolean special) throws IOException { if (!PLACEDEFNETS) { ignoreToSemicolon("NET"); return false; } if (schImport && special) { // when doing schematic import, ignore special nets ignoreToSemicolon("NET"); return false; } // get the net name String key = mustGetKeyword("NET"); if (key == null) return true; String netName = translateDefName(key); // save this so net can be placed in hashtable // get the next keyword key = mustGetKeyword("NET"); if (key == null) return true; // scan the "net" statement boolean adjustPinLocPi = false; boolean adjustPinLocLastPi = false; boolean wantPinPairs = true; boolean connectAllComponents = false; String wildcardPort = null; double lastX = 0, lastY = 0; double curX = 0, curY = 0; double specialWidth = 0; boolean pathStart = true; PortInst lastLogPi = null; PortInst lastPi = null; GetLayerInformation li = null; boolean foundCoord = false; boolean stackedViaFlag = false; for(;;) { // examine the next keyword if (key.equals(";")) { if (lastPi != null) { // remember at least one physical port instance for this net! if (special) specialNetsHT.put(netName,lastPi); else normalNetsHT.put(netName,lastPi); } if (lastLogPi != null && lastPi != null && IOTool.isDEFLogicalPlacement()) { // connect logical network and physical network so that DRC passes ArcInst ai = ArcInst.makeInstance(Generic.tech().unrouted_arc, lastPi, lastLogPi); if (ai == null) { reportError("Could not create unrouted arc"); return true; } } break; } if (key.equals("+")) { wantPinPairs = false; if (schImport) { // ignore the remainder ignoreToSemicolon("NET"); break; } key = mustGetKeyword("NET"); if (key == null) return true; if (key.equalsIgnoreCase("USE")) { // ignore "USE" keyword key = mustGetKeyword("NET"); if (key == null) return true; } else if (key.equalsIgnoreCase("ROUTED")) { // handle "ROUTED" keyword key = mustGetKeyword("NET"); if (key == null) return true; li = getLayerInformation(key); if (li.pin == null) { reportError("Unknown layer (" + key + ")"); return true; } pathStart = true; if (special) { // specialnets have width here key = mustGetKeyword("NET"); if (key == null) return true; specialWidth = convertDEFString(key); } } else if (key.equalsIgnoreCase("FIXED")) { // handle "FIXED" keyword key = mustGetKeyword("NET"); if (key == null) return true; li = getLayerInformation(key); if (li.pin == null) { reportError("Unknown layer (" + key + ")"); return true; } pathStart = true; } else if (key.equalsIgnoreCase("SHAPE")) { // handle "SHAPE" keyword key = mustGetKeyword("NET"); if (key == null) return true; } else if (key.equalsIgnoreCase("SOURCE")) { // handle "SOURCE" keyword key = mustGetKeyword("NET"); if (key == null) return true; } else if (key.equalsIgnoreCase("ORIGINAL")) { // handle "ORIGINAL" keyword key = mustGetKeyword("NET"); if (key == null) return true; } else { reportError("Cannot handle '" + key + "' nets"); return true; } // get next keyword key = mustGetKeyword("NET"); if (key == null) return true; continue; } // if still parsing initial pin pairs, do so if (wantPinPairs) { // it must be the "(" of a pin pair if (!key.equals("("))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -