📄 readabledump.java
字号:
int xoff = 0, yoff = 0; int numNodes = 0; if (nil != null) numNodes = nil.protoType.length; for(int j=0; j<numNodes; j++) { // convert to new style NodeProto np = nil.protoType[j]; if (np == Generic.tech().cellCenterNode) { realizeNode(nil, j, xoff, yoff, lambda, cell, np); xoff = (nil.lowX[j] + nil.highX[j]) / 2; yoff = (nil.lowY[j] + nil.highY[j]) / 2; break; } } Point2D offset = new Point2D.Double(xoff, yoff); // create the rest of the nodes for(int j=0; j<numNodes; j++) { NodeProto np = nil.protoType[j]; if (np == null) continue; if (np == Generic.tech().cellCenterNode) continue; realizeNode(nil, j, xoff, yoff, lambda, cell, np); } return offset; } private void realizeExports(Cell cell, int cellIndex) { ExportList el = exportList[cellIndex]; int numExports = 0; if (el != null) numExports = el.exportList.length; CellId cellId = cell.getId(); // Try to create ExportIds in alphanumeric order TreeSet<String> exportNames = new TreeSet<String>(TextUtils.STRING_NUMBER_ORDER); for (int j = 0; j < numExports; j++) exportNames.add(el.exportName[j]); for (String exportName: exportNames) cell.getId().newPortId(exportName); for(int j=0; j<numExports; j++) { NodeInst subNi = nodeInstList[cellIndex].theNode[el.exportSubNode[j]]; PortInst pi = findProperPortInst(subNi, el.exportSubPort[j]); int userBits = el.exportUserBits[j]; boolean alwaysDrawn = ImmutableExport.alwaysDrawnFromElib(userBits); boolean bodyOnly = ImmutableExport.bodyOnlyFromElib(userBits); PortCharacteristic characteristic = ImmutableExport.portCharacteristicFromElib(userBits); ExportId exportId = cellId.newPortId(Name.findName(el.exportName[j]).toString()); Export pp = Export.newInstance(cell, exportId, null, el.exportNameDescriptor[j], pi, alwaysDrawn, bodyOnly, characteristic, errorLogger); el.exportList[j] = pp; if (pp == null) continue; realizeVariables(pp, el.exportVars[j]); } } /** * Method to find the PortInst associated with a named port on a NodeInst. * Does the proper conversion of old port names if necessary. * @param ni the NodeInst to explore. * @param portName the name of the port on that NodeInst. * @return the PortInst, null if not found. */ private PortInst findProperPortInst(NodeInst ni, String portName) { NodeProto np = ni.getProto(); PortProto pp = findPortProto(np, portName);// PortProto pp = np.findPortProto(portName); // convert special port names if (pp == null && !ni.isCellInstance()) { Technology tech = np.getTechnology(); pp = tech.convertOldPortName(portName, (PrimitiveNode)np); } if (pp == null) return null; return ni.findPortInstFromProto(pp); } private void realizeArcs(Cell cell, int cellIndex) { ArcInstList ail = arcInstList[cellIndex]; int numArcs = 0; if (ail != null) numArcs = ail.arcProto.length; double lambda = cellLambda[cellIndex]; double xoff = nodeProtoOffX[cellIndex]; double yoff = nodeProtoOffY[cellIndex]; // create the arcs for(int j=0; j<numArcs; j++) { ArcProto ap = ail.arcProto[j]; String name = ail.arcInstName[j]; long gridExtendOverMin = getSizeCorrector(ap.getTechnology()).getExtendFromDisk(ap, ail.arcWidth[j] / lambda); NodeInst arcHeadNode = nodeInstList[cellIndex].theNode[ail.arcHeadNode[j]]; NodeInst arcTailNode = nodeInstList[cellIndex].theNode[ail.arcTailNode[j]]; if (!arcHeadNode.isLinked() || !arcTailNode.isLinked()) continue; PortInst headPortInst = findProperPortInst(arcHeadNode, ail.arcHeadPort[j]); PortInst tailPortInst = findProperPortInst(arcTailNode, ail.arcTailPort[j]); if (ap == null || headPortInst == null || tailPortInst == null) continue; double headX = (ail.arcHeadX[j]-xoff) / lambda; double headY = (ail.arcHeadY[j]-yoff) / lambda; double tailX = (ail.arcTailX[j]-xoff) / lambda; double tailY = (ail.arcTailY[j]-yoff) / lambda; EPoint headPt = new EPoint(headX, headY); EPoint tailPt = new EPoint(tailX, tailY); int userBits = ail.arcUserBits[j]; // make checks Poly poly = headPortInst.getPoly(); if (!poly.isInside(headPt)) System.out.println("Cell " + cell.describe(true) + ", " + ap + " head at (" + ail.arcHeadX[j] + "," + ail.arcHeadY[j] + ") not in port"); poly = tailPortInst.getPoly(); if (!poly.isInside(tailPt)) System.out.println("Cell " + cell.describe(true) + ", " + ap + " tail at (" + ail.arcTailX[j] + "," + ail.arcTailY[j] + ") not in port"); ArcInst ai = ArcInst.newInstance(cell, ap, name, ail.arcNameDescriptor[j], headPortInst, tailPortInst, headPt, tailPt, gridExtendOverMin, ImmutableArcInst.angleFromElib(userBits), ImmutableArcInst.flagsFromElib(userBits)); ail.arcList[j] = ai;// ELIBConstants.applyELIBArcBits(ai, userBits); if (ai == null) { String msg = "ERROR: "+cell + ": arc " + name + " could not be created"; System.out.println(msg); Input.errorLogger.logError(msg, cell, 1); continue; }// if (gridExtendOverMin < 0) {// String msg = "WARNING: "+cell + ": arc " + ai.getName() + " width is less than minimum by " + DBMath.gridToLambda(-2*gridExtendOverMin);// System.out.println(msg);// Input.errorLogger.logWarning(msg, ai, cell, null, 2);// } realizeVariables(ai, ail.arcVars[j]); } } private boolean getKeyword() throws IOException { int filePostionDelta = 0; // get only delta in file since byteCount exists // skip leading blanks int c = 0; for(;;) { c = lineReader.read(); if (c == -1) return true; filePostionDelta++; if (c != ' ') break; } // collect the word int cindex = 0; boolean inQuote = false; if (c == '"') inQuote = true; if (keywordArray == null) { keywordArrayLen = 500; keywordArray = new char[keywordArrayLen]; } keywordArray[cindex++] = (char)c; for(;;) { c = lineReader.read(); if (c == -1) return true; filePostionDelta++; if (c == '\n' || (c == ' ' && !inQuote)) break; if (c == '"' && (cindex == 0 || keywordArray[cindex-1] != '^')) inQuote = !inQuote; if (cindex >= keywordArrayLen) { int newKeywordArrayLen = keywordArrayLen * 2; char [] newKeywordArray = new char[newKeywordArrayLen]; for(int i=0; i<keywordArrayLen; i++) newKeywordArray[i] = keywordArray[i]; keywordArray = newKeywordArray; keywordArrayLen = newKeywordArrayLen; } keywordArray[cindex++] = (char)c; } keyWord = new String(keywordArray, 0, cindex); updateProgressDialog(filePostionDelta);// if (progress != null && fileLength > 0)// {// progress.setProgress((int)(filePosition * 100 / fileLength));// } return false; } // --------------------------------- LIBRARY PARSING METHODS --------------------------------- /** * a new library is introduced (keyword "****library") * This should be the first keyword in the file */ private void keywordNewLib() { // set defaults// mainCell = -1; varPos = INVTOOL; curTech = null; textLevel = INLIB; } /** * get the file's Electric version number (keyword "version") */ private void keywordVersn() { version = Version.parseVersion(keyWord);// emajor = version.getMajor();// eminor = version.getMinor();// edetail = version.getDetail(); // for versions before 6.03q, convert MOSIS CMOS technology names convertMosisCmosTechnologies = version.compareTo(Version.parseVersion("6.03q")) < 0;// convertMosisCmosTechnologies = false;// if (emajor < 6 ||// (emajor == 6 && eminor < 3) ||// (emajor == 6 && eminor == 3 && edetail < 17))// {// convertMosisCmosTechnologies = true;// System.out.println(" Converting MOSIS CMOS technologies (mocmossub => mocmos)");// } // for Electric version 4 or earlier, scale lambda by 20 scaleLambdaBy20 = version.compareTo(Version.parseVersion("5")) < 0;// if (emajor <= 4) lambda *= 20; // mirror bits rotationMirrorBits = version.compareTo(Version.parseVersion("7.01")) >= 0;// if (emajor > 7 || (emajor == 7 && eminor >= 1)) } /** * get the number of tools (keyword "aids") */ private void keywordLibKno() { bitCount = 0; toolList = new Tool[Integer.parseInt(keyWord)]; } /** * get the name of the tool (keyword "aidname") */ private void keywordLibAiN() { curTool = Tool.findTool(keyWord); toolList[bitCount++] = curTool; } /** * get the number of toolbits (keyword "aidbits") */ private void keywordLibAiB() { bitCount = 0; } /** * get tool information for the library (keyword "bits") */ private void keywordLibBit() { if (bitCount == 0) libBits = TextUtils.atoi(keyWord); bitCount++; } /** * get the number of toolbits (keyword "userbits") */ private void keywordLibUsb() { libBits = TextUtils.atoi(keyWord); } /** * get the number of technologies (keyword "techcount") */ private void keywordLibTe() { varPos = INVTECHNOLOGY; bitCount = 0; int numTechs = Integer.parseInt(keyWord); techList = new Technology[numTechs]; lambdaValues = new int[numTechs]; } /** * get the name of the technology (keyword "techname") */ private void keywordLibTeN() { curTech = Technology.findTechnology(keyWord); techList[bitCount++] = curTech; } /** * get lambda values for each technology in library (keyword "lambda") */ private void keywordLambda() { int lam = Integer.parseInt(keyWord); // for version 4.0 and earlier, scale lambda by 20 if (scaleLambdaBy20) lam *= 20;// if (emajor <= 4) lam *= 20; lambdaValues[bitCount-1] = lam; } /** * get the number of cells in this library (keyword "cellcount") */ private void keywordLibCC() { varPos = INVLIBRARY; nodeProtoCount = Integer.parseInt(keyWord); if (nodeProtoCount == 0) return; // allocate a list of node prototypes for this library nodeProtoList = new Cell[nodeProtoCount]; allCellsArray = new Cell[nodeProtoCount]; cellLambda = new double[nodeProtoCount]; nodeProtoOffX = new double[nodeProtoCount]; nodeProtoOffY = new double[nodeProtoCount]; cellLowX = new int[nodeProtoCount]; cellHighX = new int[nodeProtoCount]; cellLowY = new int[nodeProtoCount]; cellHighY = new int[nodeProtoCount]; nodeProtoTypeList = new String[nodeProtoCount][]; nodeInstList = new LibraryFiles.NodeInstList[nodeProtoCount]; arcInstList = new ArcInstList[nodeProtoCount]; exportList = new ExportList[nodeProtoCount]; cellNames = new CellName[nodeProtoCount]; cellGroups = new int[nodeProtoCount]; cellTechNames = new String[nodeProtoCount]; cellCreationDates = new int[nodeProtoCount]; cellRevisionDates = new int[nodeProtoCount]; cellUserbits = new int[nodeProtoCount]; cellVars = new Variable[nodeProtoCount][]; cellLibPaths = new String[nodeProtoCount]; } /** * get the main cell of this library (keyword "maincell") */ private void keywordLibMS() {// mainCell = Integer.parseInt(keyWord); } /** * get a view (keyword "view") */ private void keywordLibVie() { int openCurly = keyWord.indexOf('{'); if (openCurly < 0) { System.out.println("Error on line "+lineReader.getLineNumber()+": missing '{' in view name: " + keyWord); return; } String fullName = keyWord.substring(0, openCurly); String abbrev = keyWord.substring(openCurly+1); int closeCurly = abbrev.indexOf('}'); if (closeCurly < 0) { System.out.println("Error on line "+lineReader.getLineNumber()+": missing '}' in view name: " + keyWord);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -