📄 elib.java
字号:
if (header.magic <= ELIBConstants.MAGIC7) { // version 7 and later simply read the relevant data libUserBits = readBigInteger(); } else { // version 6 and earlier must sift through the information if (toolBCount >= 1) libUserBits = readBigInteger(); for(int i=1; i<toolBCount; i++) readBigInteger(); } // get the lambda values in the library for(int i=0; i<techCount; i++) { techLambda[i] = readBigInteger(); } // read the global namespace readNameSpace(); // read the library variables libVars = readVariables(); for (int i = 0; i < libVars.length; i++) { Variable var = libVars[i]; if (var == null || var.getKey() != Library.FONT_ASSOCIATIONS) continue; Object value = var.getObject(); if (!(value instanceof String[])) continue; setFontNames((String[])value); libVars[i] = null; } // read the tool variables for(int i=0; i<toolCount; i++) { toolVars[i] = readVariables(); } // read the technology variables for(int i=0; i<techCount; i++) { techVars[i] = readVariables(); } // read the arcproto variables for(int i=0; i<arcProtoCount; i++) readVariables(); // read the primitive nodeproto variables for(int i=0; i<primNodeProtoCount; i++) readVariables(); // read the primitive portproto variables for(int i=0; i<primPortProtoCount; i++) readVariables(); // read the view variables (version 9 and later) if (header.magic <= ELIBConstants.MAGIC9) { int count = readBigInteger(); for(int i=0; i<count; i++) { int j = readBigInteger(); View v = getView(j); if (v == null) System.out.println("View index " + j + " not found"); readVariables(); } } // setup fake cell structures (version 9 to 11) if (header.magic <= ELIBConstants.MAGIC9 && header.magic >= ELIBConstants.MAGIC11) { for(int i=0; i<cellCount; i++) { String thecellname = readString(); readVariables(); fakeCellList[i].cellName = convertCellName(thecellname); } } // read the cells exportIndex = 0; for(int i=0; i<nodeProtoCount; i++) { if (arcCounts[i] < 0 && nodeCounts[i] < 0) continue; if (readNodeProto(i)) { System.out.println("Error reading cell"); return true; } } // now read external cells for(int i=0; i<nodeProtoCount; i++) { if (arcCounts[i] >= 0 || nodeCounts[i] >= 0) continue; if (readExternalNodeProto(i)) { System.out.println("Error reading external cell"); return true; } } if (fc != null) { for (int cellIndex = 0; cellIndex < nodeProtoCount; cellIndex++) { if (arcCounts[cellIndex] >= 0 || nodeCounts[cellIndex] >= 0) { fc.localCells.add(cellProtoName[cellIndex]); } else { fc.externalCells.add(new LibraryStatistics.ExternalCell(cellLibraryPath[cellIndex], null, cellProtoName[cellIndex])); } } return false; } // read the cell contents: arcs and nodes int nodeIndex = 0, arcIndex = 0, geomIndex = 0; for(int cellIndex=0; cellIndex<nodeProtoCount; cellIndex++) { Cell cell = nodeProtoList[cellIndex]; firstNodeIndex[cellIndex] = nodeIndex; firstArcIndex[cellIndex] = arcIndex; if (header.magic > ELIBConstants.MAGIC5) { // versions 4 and earlier must read some geometric information int j = geomIndex; readGeom(geomType, geomMoreUp, j); j++; readGeom(geomType, geomMoreUp, j); j++; int top = j; readGeom(geomType, geomMoreUp, j); j++; int bot = j; readGeom(geomType, geomMoreUp, j); j++; for(;;) { readGeom(geomType, geomMoreUp, j); j++; if (geomMoreUp[j-1] == top) break; } geomIndex = j; for(int look = bot; look != top; look = geomMoreUp[look]) if (!geomType[look]) { if (readArcInst(arcIndex)) { System.out.println("Error reading arc"); Input.errorLogger.logError("Error reading arc index "+ arcIndex, cell, 1); return true; } arcIndex++; } else { if (readNodeInst(nodeIndex, cellIndex)) { System.out.println("Error reading node"); Input.errorLogger.logError("Error reading node index "+ nodeIndex, cell, 1); return true; } nodeIndex++; } } else { // version 5 and later find the arcs and nodes in linear order for(int j=0; j<arcCounts[cellIndex]; j++) { if (readArcInst(arcIndex)) { System.out.println("Error reading arc"); Input.errorLogger.logError("Error reading arc index "+ arcIndex, cell, 1); return true; } arcIndex++; } for(int j=0; j<nodeCounts[cellIndex]; j++) { if (readNodeInst(nodeIndex, cellIndex)) { System.out.println("Error reading node index " + nodeIndex + " in " + cell + " of " + lib); Input.errorLogger.logError("Error reading node index " + nodeIndex + " in " + cell + " of " + lib, cell, 1); return true; } nodeIndex++; } } } firstNodeIndex[nodeProtoCount] = nodeIndex; firstArcIndex[nodeProtoCount] = arcIndex; // library read successfully if (LibraryFiles.VERBOSE) System.out.println("Binary: finished reading data for " + lib); return false; } @Override Map<Cell,Variable[]> createLibraryCells(boolean onlyProjectSettings) { // setup pointers for technologies and primitives primNodeProtoCount = 0; primPortProtoCount = 0; arcProtoCount = 0; for(int techIndex=0; techIndex<techCount; techIndex++) { // get the technology TechId techId = techIdList[techIndex]; String name = techId.techName; Technology tech = findTechnologyName(name); boolean imosconv = false; if (name.equals("imos")) { tech = Technology.getMocmosTechnology(); imosconv = true; } if (tech == null) { // cannot figure it out: just pick the generic technology tech = Generic.tech(); techError[techIndex] = name; } else techError[techIndex] = null; techList[techIndex] = tech; // get the number of primitive node prototypes while (primNodeProtoCount < primitiveNodeIdList.length) { PrimitiveNodeId primitiveNodeId = primitiveNodeIdList[primNodeProtoCount]; if (primitiveNodeId.techId != techId) break; primNodeProtoOrig[primNodeProtoCount] = null; primNodeProtoError[primNodeProtoCount] = false; name = primitiveNodeId.name; if (imosconv) name = name.substring(6); PrimitiveNode pnp = tech.findNodeProto(name); if (pnp == null) { // automatic conversion of "Active-Node" in to "P-Active-Node" (MOSIS CMOS) if (name.equals("Active-Node")) pnp = tech.findNodeProto("P-Active-Node"); } if (pnp == null) { boolean advise = true; // look for substring name match at start of name for(Iterator<PrimitiveNode> it = tech.getNodes(); it.hasNext();) { PrimitiveNode opnp = it.next(); String primName = opnp.getName(); if (primName.startsWith(name) || name.startsWith(primName)) { pnp = opnp; break; } } // look for substring match at end of name if (pnp == null) { for(Iterator<PrimitiveNode> it = tech.getNodes(); it.hasNext();) { PrimitiveNode opnp = it.next(); String primName = opnp.getName(); if (primName.endsWith(name) || name.endsWith(primName)) { pnp = opnp; break; } } } // special cases: convert special primitives that are known to the technologies if (pnp == null) { pnp = tech.convertOldNodeName(name); if (pnp != null) advise = false; } // give up and use first primitive in this technology if (pnp == null) { Iterator<PrimitiveNode> it = tech.getNodes(); pnp = it.next(); } // construct the error message if (advise) { String errorMessage; if (techError[techIndex] != null) errorMessage = techError[techIndex]; else errorMessage = tech.getTechName(); errorMessage += ":" + name; primNodeProtoOrig[primNodeProtoCount] = errorMessage; primNodeProtoError[primNodeProtoCount] = true; } } primNodeProtoTech[primNodeProtoCount] = techIndex; primNodeProtoList[primNodeProtoCount] = pnp; // get the number of primitive port prototypes while (primPortProtoCount < primitivePortIdList.length) { PrimitivePortId primitivePortId = primitivePortIdList[primPortProtoCount]; if (primitivePortId.parentId != primitiveNodeId) break; primPortProtoError[primPortProtoCount] = null; name = primitivePortId.externalId; PrimitivePort pp = (PrimitivePort)pnp.findPortProto(name); // convert special port names if (pp == null) pp = tech.convertOldPortName(name, pnp); if (pp == null) { Iterator<PrimitivePort> it = pnp.getPrimitivePorts(); if (it.hasNext()) { pp = it.next(); if (!primNodeProtoError[primNodeProtoCount]) { String errorMessage = name + " on "; if (primNodeProtoOrig[primNodeProtoCount] != null) errorMessage += primNodeProtoOrig[primNodeProtoCount]; else { if (techError[techIndex] != null) errorMessage += techError[techIndex]; else errorMessage += tech.getTechName(); errorMessage += ":" + pnp.getName(); } primPortProtoError[primPortProtoCount] = errorMessage; } } } primPortProtoList[primPortProtoCount++] = pp; } primNodeProtoCount++; } // get the number of arc prototypes while (arcProtoCount < arcProtoIdList.length) { ArcProtoId arcProtoId = arcProtoIdList[arcProtoCount]; if (arcProtoId.techId != techId) break; arcProtoError[arcProtoCount] = null; name = arcProtoId.name; if (imosconv) name = name.substring(6); ArcProto ap = tech.findArcProto(name); if (ap == null) { ap = tech.convertOldArcName(name); } if (ap == null) { Iterator<ArcProto> it = tech.getArcs(); ap = it.next(); String errorMessage; if (techError[techIndex] != null) errorMessage = techError[techIndex]; else errorMessage = tech.getTechName();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -