📄 jelib.java
字号:
if (reader != null) reader.realizeCellsRecursively(subCell, recursiveSetupFlag, null, 0); } } EPoint size = n.size; if (np instanceof PrimitiveNode) { PrimitiveNode pn = (PrimitiveNode)np; Technology tech = pn.getTechnology(); Technology.SizeCorrector sizeCorrector = sizeCorrectors.get(tech); if (sizeCorrector == null) { sizeCorrector = tech.getSizeCorrector(cc.version, projectSettings, true, false); sizeCorrectors.put(tech, sizeCorrector); } size = sizeCorrector.getSizeFromDisk(pn, size.getLambdaX(), size.getLambdaY()); } if (np == null) { CellId dummyCellId = (CellId)protoId; String protoName = dummyCellId.cellName.toString(); Library cellLib = database.getLib(dummyCellId.libId); if (cellLib == null) { Input.errorLogger.logError(cc.fileName + ", line " + line + ", Creating dummy library " + prefixName, cell, -1); cellLib = Library.newInstance(prefixName, null); } Cell dummyCell = cellLib.findNodeProto(protoName); if (dummyCell != null && dummyCell.getVar(IO_DUMMY_OBJECT) == null) dummyCell = null; if (dummyCell == null) { dummyCell = Cell.makeInstance(cellLib, protoName); if (dummyCell == null) { Input.errorLogger.logError(cc.fileName + ", line " + line + ", Unable to create dummy cell " + protoName + " in " + cellLib, cell, -1); continue; } Input.errorLogger.logError(cc.fileName + ", line " + line + ", Creating dummy cell " + protoName + " in " + cellLib, cell, -1); } Rectangle2D bounds = parser.externalCells.get(dummyCellId.toString()); if (bounds == null) { Input.errorLogger.logError(cc.fileName + ", line " + line + ", Warning: cannot find information about external cell " + dummyCellId, cell, -1); NodeInst.newInstance(Generic.tech().invisiblePinNode, new Point2D.Double(0,0), 0, 0, dummyCell); } else { NodeInst.newInstance(Generic.tech().invisiblePinNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), dummyCell); } // mark this as a dummy cell dummyCell.newVar(IO_TRUE_LIBRARY, prefixName); dummyCell.newVar(IO_DUMMY_OBJECT, protoName); np = dummyCell; } // create the node NodeInst ni = NodeInst.newInstance(cell, np, n.nodeName, n.nameTextDescriptor, n.anchor, size, n.orient, n.flags, n.techBits, n.protoTextDescriptor, Input.errorLogger); if (ni == null) { Input.errorLogger.logError(cc.fileName + ", line " + (cc.lineNumber + line) + " (" + cell + ") cannot create node " + n.protoId, cell, -1); continue; } // add variables realizeVariables(ni, n.vars); // insert into map of disk names n.ni = ni; } // place all exports for (JelibParser.ExportContents e: cc.exports) { int line = e.line; PortInst pi = figureOutPortInst(cell, e.originalPort.externalId, e.originalNode, e.pos, cc.fileName, line); if (pi == null) continue; // create the export Export pp = Export.newInstance(cell, e.exportId, e.exportUserName, e.nameTextDescriptor, pi, e.alwaysDrawn, e.bodyOnly, e.ch, errorLogger); if (pp == null) { Input.errorLogger.logError(cc.fileName + ", line " + (cc.lineNumber + line) + " (" + cell + ") cannot create export " + e.exportUserName, pi.getNodeInst(), cell, null, -1); continue; } // add variables in tail fields realizeVariables(pp, e.vars); } // next place all arcs for(JelibParser.ArcContents a: cc.arcs) { int line = a.line; ArcProto ap = findArcProto(a.arcProtoId); if (ap == null) { if (ap == null) ap = cell.getTechnology().convertOldArcName(a.arcProtoId.name); if (ap == null) { Input.errorLogger.logError(cc.fileName + ", line " + (cc.lineNumber + line) + " (" + cell + ") cannot find arc " + a.arcProtoId, cell, -1); continue; } } Technology tech = ap.getTechnology(); Technology.SizeCorrector sizeCorrector = sizeCorrectors.get(tech); if (sizeCorrector == null) { sizeCorrector = tech.getSizeCorrector(cc.version, projectSettings, true, false); sizeCorrectors.put(tech, sizeCorrector); } long gridExtendOverMin = sizeCorrector.getExtendFromDisk(ap, a.diskWidth); PortInst headPI = figureOutPortInst(cell, a.headPort.externalId, a.headNode, a.headPoint, cc.fileName, line); if (headPI == null) continue; PortInst tailPI = figureOutPortInst(cell, a.tailPort.externalId, a.tailNode, a.tailPoint, cc.fileName, line); if (tailPI == null) continue; ArcInst ai = ArcInst.newInstance(cell, ap, a.arcName, a.nameTextDescriptor, headPI, tailPI, a.headPoint, a.tailPoint, gridExtendOverMin, a.angle, a.flags); if (ai == null) { List<Geometric> geomList = new ArrayList<Geometric>(); geomList.add(headPI.getNodeInst()); geomList.add(tailPI.getNodeInst()); Input.errorLogger.logError(cc.fileName + ", line " + line + " (" + cell + ") cannot create arc " + a.arcProtoId, geomList, null, cell, 2); continue; } realizeVariables(ai, a.vars); } cc.filledIn = true; } /** * Method to find the proper PortInst for a specified port on a node, at a given position. * @param cell the cell in which this all resides. * @param portName the name of the port (may be an empty string if there is only 1 port). * @param n the node. * @param pos the position of the port on the node. * @param lineNumber the line number in the file being read (for error reporting). * @return the PortInst specified (null if none can be found). */ private PortInst figureOutPortInst(Cell cell, String portName, JelibParser.NodeContents n, Point2D pos, String fileName, int lineNumber) { NodeInst ni = n != null ? n.ni : null; if (ni == null) { Input.errorLogger.logError(fileName + ", line " + lineNumber + " (" + cell + ") cannot find node " + n.nodeName, cell, -1); return null; } PortInst pi = null; PortProto pp = findPortProto(ni.getProto(), portName); if (pp != null) pi = ni.findPortInstFromProto(pp); // primitives use the name match// if (!ni.isCellInstance()) return pi;// // make sure the port can handle the position// if (pi != null && pos != null)// {// Poly poly = pi.getPoly();// if (!(poly.isInside(pos) || poly.polyDistance(pos.getX(), pos.getY()) < TINYDISTANCE))// {// NodeProto np = ni.getProto();// Input.errorLogger.logError(fileName + ", line " + lineNumber +// " (" + cell + ") point (" + pos.getX() + "," + pos.getY() + ") does not fit in " +// pi + " which is centered at (" + poly.getCenterX() + "," + poly.getCenterY() + ")", new EPoint(pos.getX(), pos.getY()), cell, -1);// if (np instanceof Cell)// pi = null;// }// } if (pi != null) return pi; // see if this is a dummy cell Variable var = null; Cell subCell = null; if (ni.isCellInstance()) { subCell = (Cell)ni.getProto(); var = subCell.getVar(IO_TRUE_LIBRARY); if (pos == null) pos = parser.externalExports.get(subCell.getId().newPortId(portName)); } if (pos == null) pos = ni.getAnchorCenter(); if (var == null) { // not a dummy cell: create a pin at the top level NodeInst portNI = NodeInst.newInstance(Generic.tech().universalPinNode, pos, 0, 0, cell); if (portNI == null) { Input.errorLogger.logError(fileName + ", line " + lineNumber + ", Unable to create dummy node in " + cell + " (cannot create source node)", cell, -1); return null; } Input.errorLogger.logError(fileName + ", line " + lineNumber + ", Port "+portName+" on "+ni.getProto() + " renamed or deleted, still used on node "+n.nodeName+" in " + cell, portNI, cell, null, -1); return portNI.getOnlyPortInst(); } // a dummy cell: create a dummy export on it to fit this String name = portName; if (name.length() == 0) name = "X"; Point2D.Double tpos = new Point2D.Double(); ni.transformIn().transform(pos, tpos); NodeInst portNI = NodeInst.newInstance(Generic.tech().universalPinNode, tpos, 0, 0, subCell); if (portNI == null) { Input.errorLogger.logError(fileName + ", line " + lineNumber + ", Unable to create export " + name + " on dummy " + subCell + " (cannot create source node)", cell, -1); return null; } PortInst portPI = portNI.getOnlyPortInst(); Export export = Export.newInstance(subCell, portPI, name, null, false); if (export == null) { Input.errorLogger.logError(fileName + ", line " + lineNumber + ", Unable to create export " + name + " on dummy " + subCell, cell, -1); return null; } pi = ni.findPortInstFromProto(export); Input.errorLogger.logError(fileName + ", line " + lineNumber + ", Creating export " + name + " on dummy " + subCell, cell, -1); return pi; } Technology findTechnology(TechId techId) { TechPool techPool = database.getTechPool(); Technology tech = techPool.getTech(techId); if (tech == null && techId.techName.equals("tsmc90")) tech = techPool.getTech(idManager.newTechId("cmos90")); return tech; } PrimitiveNode findPrimitiveNode(PrimitiveNodeId primitiveNodeId) { TechPool techPool = database.getTechPool(); PrimitiveNode pn = techPool.getPrimitiveNode(primitiveNodeId); if (pn == null && primitiveNodeId.techId.techName.equals("tsmc90")) pn = findPrimitiveNode(idManager.newTechId("cmos90").newPrimitiveNodeId(primitiveNodeId.name)); if (pn == null) { Technology tech = findTechnology(primitiveNodeId.techId); if (tech != null) pn = tech.convertOldNodeName(primitiveNodeId.name); } return pn; } ArcProto findArcProto(ArcProtoId arcProtoId) { TechPool techPool = database.getTechPool(); ArcProto ap = techPool.getArcProto(arcProtoId); if (ap == null && arcProtoId.techId.techName.equals("tsmc90")) ap = findArcProto(idManager.newTechId("cmos90").newArcProtoId(arcProtoId.name)); return ap; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -