📄 readabledump.java
字号:
// if (mainCell >= 0)// Job.getUserInterface().setCurrentCell(lib, allCellsArray[mainCell]); return false; } //************************************* in library @Override Map<Cell,Variable[]> createLibraryCells(boolean onlyProjectSettings) { lib.erase(); lib.lowLevelSetUserBits(TextUtils.atoi(keyWord)); // this library came as readable dump, so don't automatically save it to disk lib.clearFromDisk(); realizeVariables(lib, libVars); HashMap<Cell,Variable[]> originalVars = new HashMap<Cell,Variable[]>(); for (int cellNumber = 0; cellNumber < nodeProtoCount; cellNumber++) { if (cellLibPaths[cellNumber] == null) finishCellInitialization(cellNumber, originalVars); else findExtCell(cellNumber); } return originalVars; } private void findExtCell(int cellNumber) { // get the library associated with that name String libPath = cellLibPaths[cellNumber]; Library elib = readExternalLibraryFromFilename(libPath, FileType.ELIB); // find the requested cell in the external library Cell cell = null; CellName curCellName = cellNames[cellNumber]; if (elib != null) { // find this cell in the external library cell = elib.findNodeProto(curCellName.toString()); if (cell != null) { // cell found: make sure it is valid if (cell.getRevisionDate().compareTo(ELIBConstants.secondsToDate(cellRevisionDates[cellNumber])) != 0) { System.out.println("Warning: " + cell + " in " + elib + " has been modified since its use in " + lib); } } } // see if a cell was found if (cell != null) { // cell found in external library: remember the external reference allCellsArray[cellNumber] = cell; nodeProtoList[cellNumber] = null; } else { // cell not found in external library: figure out the library name String elibName = null; if (elib != null) elibName = elib.getName(); else { File libFile = new File(libPath); elibName = libFile.getName(); int lastDotPos = elibName.lastIndexOf('.'); if (lastDotPos > 0) elibName = elibName.substring(0, lastDotPos); } // cell not found in library: issue warning System.out.println("Cannot find cell " + curCellName.toString() + " in library " + elibName + "...creating dummy version"); // rename the cell //curCellName.setName(curCellName.getName() + "FROM" + elibName); if (curCellName.getVersion() != 0) curCellName = CellName.parseName(curCellName.getName() + "FROM" + elibName + ";" + curCellName.getVersion() + curCellName.getView().getAbbreviationExtension()); else curCellName = CellName.parseName(curCellName.getName() + "FROM" + elibName + curCellName.getView().getAbbreviationExtension()); cellNames[cellNumber] = curCellName; finishCellInitialization(cellNumber, null); // schedule the cell to have two nodes (cell center and big "X") LibraryFiles.NodeInstList nil = new LibraryFiles.NodeInstList(2, false); nodeInstList[cellNumber] = nil; // create a cell-center node nil.protoType[0] = Generic.tech().cellCenterNode; nil.name[0] = null; nil.lowX[0] = 0; nil.highX[0] = 0; nil.lowY[0] = 0; nil.highY[0] = 0; nil.rotation[0] = 0; nil.transpose[0] = 0; // create an artwork "Crossed box" to define the cell size nil.protoType[1] = Artwork.tech().crossedBoxNode; nil.name[1] = null; nil.lowX[1] = cellLowX[cellNumber]; nil.highX[1] = cellHighX[cellNumber]; nil.lowY[1] = cellLowY[cellNumber]; nil.highY[1] = cellHighY[cellNumber]; nil.rotation[1] = 0; nil.transpose[1] = 0; } } private void finishCellInitialization(int cellNumber, HashMap<Cell,Variable[]> originalVars) { Cell curCell = Cell.newInstance(lib, cellNames[cellNumber].toString()); allCellsArray[cellNumber] = nodeProtoList[cellNumber] = curCell; curCell.setTempInt(cellGroups[cellNumber]);// curCell.lowLevelPopulate(curCellName.toString()); String techName = cellTechNames[cellNumber]; Technology tech = techName != null ? findTechnologyName(techName) : null; if (tech != null) curCell.setTechnology(tech);// curCell.lowLevelLink(); curCell.lowLevelSetCreationDate(ELIBConstants.secondsToDate(cellCreationDates[cellNumber])); curCell.lowLevelSetRevisionDate(ELIBConstants.secondsToDate(cellRevisionDates[cellNumber])); curCell.lowLevelSetUserbits(cellUserbits[cellNumber]); if (originalVars != null) originalVars.put(curCell, cellVars[cellNumber]); for (int nodeInstIndex = 0; nodeInstIndex < nodeInstList[cellNumber].protoType.length; nodeInstIndex++) findNodeProto(cellNumber, nodeInstIndex); for (int arcInstIndex = 0; arcInstIndex < arcInstList[cellNumber].arcProto.length; arcInstIndex++) findArcProto(cellNumber, arcInstIndex); } private void findNodeProto(int cellNumber, int nodeInstIndex) { String nodeProtoType = nodeProtoTypeList[cellNumber][nodeInstIndex]; NodeProto curNodeInstProto = null; int openSquare = nodeProtoType.indexOf('['); if (openSquare >= 0) { curNodeInstProto = allCellsArray[TextUtils.atoi(nodeProtoType, openSquare+1)]; } else { int colonPos = nodeProtoType.indexOf(':'); Technology tech = Technology.findTechnology(nodeProtoType.substring(0, colonPos)); if (tech == null) return; curNodeInstProto = tech.findNodeProto(nodeProtoType.substring(colonPos + 1)); if (curNodeInstProto == null) { // get the technology// Technology tech = null;// int colonPos = keyWord.indexOf(':');// if (colonPos >= 0)// {// tech = Technology.findTechnology(keyWord.substring(0, colonPos));// }// if (tech != null)// { // convert "Active-Node" to "P-Active-Node" (MOSIS CMOS) if (nodeProtoType.equals("Active-Node")) { curNodeInstProto = tech.findNodeProto("P-Active-Node"); if (curNodeInstProto == null) { // convert "message" and "cell-center" nodes curNodeInstProto = tech.convertOldNodeName(nodeProtoType); } }// } } } if (curNodeInstProto == null) System.out.println("Error on line "+lineReader.getLineNumber()+": unknown node type: "+nodeProtoType); nodeInstList[cellNumber].protoType[nodeInstIndex] = curNodeInstProto; } private void findArcProto(int cellNumber, int arcInstIndex) { String arcProtoName = arcInstList[cellNumber].arcProtoName[arcInstIndex]; ArcProto curArcInstProto = null; curArcInstProto = ArcProto.findArcProto(keyWord); if (curArcInstProto == null) { // get the technology Technology tech = null; int colonPos = keyWord.indexOf(':'); if (colonPos >= 0) { tech = Technology.findTechnology(keyWord.substring(0, colonPos)); } if (tech != null) { // convert old arcs curArcInstProto = tech.convertOldArcName(keyWord); } } if (curArcInstProto == null) System.out.println("Error on line "+lineReader.getLineNumber()+": unknown arc type: "+keyWord); arcInstList[cellNumber].arcProto[arcInstIndex] = curArcInstProto; } @Override Variable[] findVarsOnExampleIcon(Cell parentCell, Cell iconCell) { // get information about this cell int cellIndex; for (cellIndex = 0; cellIndex < nodeProtoList.length; cellIndex++) { if (nodeProtoList[cellIndex] == parentCell) break; } if (cellIndex >= nodeInstList.length) return null; LibraryFiles.NodeInstList nil = nodeInstList[cellIndex]; for (int i = 0; i < nil.protoType.length; i++) { findNodeProto(cellIndex, i); NodeProto np = nodeInstList[cellIndex].protoType[i]; if (np == iconCell) return nil.vars[i]; } return null; } //************************************* recursive /** * Method to recursively create the contents of each cell in the library. */ protected void realizeCellsRecursively(Cell cell, HashSet<Cell> markCellForNodes, String scaledCellName, double scale) { // do not realize cross-library references if (cell.getLibrary() != lib) return; // cannot do scaling yet if (scaledCellName != null) return; // recursively scan the nodes to the bottom and only proceed when everything below is built int cellIndex = cell.getTempInt(); if (nodeInstList == null) return; // error LibraryFiles.NodeInstList nil = nodeInstList[cellIndex]; int numNodes = 0; NodeProto [] nodePrototypes = null; if (nil != null) { nodePrototypes = nil.protoType; numNodes = nodePrototypes.length; } scanNodesForRecursion(cell, markCellForNodes, nodePrototypes, 0, numNodes); // report progress if (LibraryFiles.VERBOSE) System.out.println("Text: Doing contents of " + cell + " in " + lib); cellsConstructed++; setProgressValue(cellsConstructed * 100 / totalCells); // now fill in the nodes double lambda = cellLambda[cellIndex]; Point2D offset = realizeNodes(cell, nil, lambda); nodeProtoOffX[cellIndex] = offset.getX(); nodeProtoOffY[cellIndex] = offset.getY(); // do the exports now realizeExports(cell, cellIndex); // do the arcs now realizeArcs(cell, cellIndex); cell.loadExpandStatus(); } protected boolean spreadLambda(Cell cell, int cellIndex) { boolean changed = false; LibraryFiles.NodeInstList nil = nodeInstList[cellIndex]; int numNodes = 0; if (nil != null) numNodes = nil.protoType.length; double thisLambda = cellLambda[cellIndex]; for(int i=0; i<numNodes; i++) { NodeProto np = nil.protoType[i]; if (np == null) continue; if (np instanceof PrimitiveNode) continue; Cell subCell = (Cell)np; LibraryFiles reader = this; if (subCell.getLibrary() != lib) { reader = getReaderForLib(subCell.getLibrary()); if (reader == null) continue; } int subCellIndex = subCell.getTempInt(); double subLambda = reader.cellLambda[subCellIndex]; if (subLambda != thisLambda) { reader.cellLambda[subCellIndex] = thisLambda; changed = true; } } return changed; } protected void computeTech(Cell cell, Set uncomputedCells) { uncomputedCells.remove(cell); int cellIndex = 0; for(; cellIndex<nodeProtoCount && nodeProtoList[cellIndex] != cell; cellIndex++); if (cellIndex >= nodeProtoCount || nodeInstList == null) return; // error LibraryFiles.NodeInstList nil = nodeInstList[cellIndex]; int numNodes = 0; NodeProto [] nodePrototypes = null; if (nil != null) { nodePrototypes = nil.protoType; numNodes = nodePrototypes.length; } // recursively ensure that subcells's technologies are computed for(int i=0; i<numNodes; i++) { NodeProto np = nodePrototypes[i]; if (!uncomputedCells.contains(np)) continue; Cell subCell = (Cell)np; LibraryFiles reader = getReaderForLib(subCell.getLibrary()); if (reader != null) reader.computeTech(subCell, uncomputedCells); } ArcInstList ail = arcInstList[cellIndex]; int numArcs = 0; ArcProto [] arcPrototypes = null; if (ail != null) { arcPrototypes = ail.arcProto; numArcs = arcPrototypes.length; } Technology cellTech = Technology.whatTechnology(cell, nodePrototypes, 0, numNodes, arcPrototypes); cell.setTechnology(cellTech); } protected double computeLambda(Cell cell, int cellIndex) {// LibraryFiles.NodeInstList nil = nodeInstList[cellIndex];// int numNodes = 0;// NodeProto [] nodePrototypes = null;// if (nil != null)// {// nodePrototypes = nil.protoType;// numNodes = nodePrototypes.length;// }// ArcInstList ail = arcInstList[cellIndex];// int numArcs = 0;// ArcProto [] arcPrototypes = null;// if (ail != null)// {// arcPrototypes = ail.arcProto;// numArcs = arcPrototypes.length;// }// Technology cellTech = Technology.whatTechnology(cell, nodePrototypes, 0, numNodes,// arcPrototypes, 0, numArcs);// cell.setTechnology(cellTech); Technology cellTech = cell.getTechnology(); double lambda = 1.0; if (cellTech != null) { for(int i=0; i<techList.length; i++) { if (techList[i] != cellTech) continue; lambda = lambdaValues[i]; break; } } return lambda; } private Point2D realizeNodes(Cell cell, LibraryFiles.NodeInstList nil, double lambda) { // find the "cell center" node and place it first
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -