?? gds.java
字號:
} else if (origNodeName != null) { errorMsg = "Original GDS name of '" + name + "' was '" + origNodeName + "'"; } if (errorMsg != null) { List<Geometric> geomList = new ArrayList<Geometric>(1); geomList.add(ni); errorLogger.logWarning(errorMsg, geomList, null, null, null, null, parent, -1); System.out.println(errorMsg); } if (IOTool.isGDSInExpandsCells() && ni.isCellInstance()) ni.setExpanded(); if (points != null) ni.setTrace(points); boolean renamed = false; if (exportName != null) { if (exportName.endsWith(":")) exportName = exportName.substring(0, exportName.length()-1); if (parent.findExport(exportName) != null) { String newName = ElectricObject.uniqueObjectName(exportName, parent, PortProto.class, true);// System.out.println(" Warning: Multiple exports called '" + exportName + "' in cell " +// parent.describe(false) + " (renamed to " + newName + ")"); exportUnify.put(newName, exportName); exportName = newName; renamed = true; } Export.newInstance(parent, ni.getPortInst(0), exportName); } return renamed; } } /** * Method to import a library from disk. * @param lib the library to fill * @return the created library (null on error). */ protected Library importALibrary(Library lib) { // initialize arraySimplificationUseful = true; CellBuilder.init(); theLibrary = lib; try { loadFile(); } catch (IOException e) { System.out.println("ERROR reading GDS file"); } // now build all instances recursively CellBuilder.buildInstances(); CellBuilder.term(); if (arraySimplificationUseful) { System.out.println("NOTE: Found array references that could be simplified to save space and time"); System.out.println(" To simplify arrays, set the 'Input array simplification' in GDS Preferences"); } return lib; } private void initialize() { inputScale = IOTool.getGDSInputScale(); layerNodeProto = Generic.tech().drcNode; theVertices = new Point2D[MAXPOINTS]; for(int i=0; i<MAXPOINTS; i++) theVertices[i] = new Point2D.Double(); recordCount = 0; // get the array of GDS names layerNames = new HashMap<Integer,Layer>(); pinLayers = new HashSet<Integer>(); boolean valid = false; curTech = Technology.getCurrent(); for(Map.Entry<Layer,String> e: curTech.getGDSLayers().entrySet()) { Layer layer = e.getKey(); String gdsName = e.getValue(); GDSLayers gdsl = GDSLayers.parseLayerString(gdsName); for(Iterator<Integer> lIt = gdsl.getLayers(); lIt.hasNext(); ) { Integer lVal = lIt.next(); Integer lay = new Integer(lVal.intValue()); if (layerNames.get(lay) == null) layerNames.put(lay, layer); } if (gdsl.getPinLayer() != -1) { pinLayers.add(new Integer(gdsl.getPinLayer())); layerNames.put(new Integer(gdsl.getPinLayer()), layer); } if (gdsl.getTextLayer() != -1) layerNames.put(new Integer(gdsl.getTextLayer()), layer); valid = true; } if (!valid) { System.out.println("There are no GDS layer names assigned in the " + curTech.getTechName() + " technology"); } } private void loadFile() throws IOException { initialize(); getToken(); readHeader(); getToken(); readLibrary(); getToken(); while (isMember(theToken, optionSet)) { if (theToken == GDS_REFLIBS) readRefLibs(); else if (theToken == GDS_FONTS) readFonts(); else if (theToken == GDS_ATTRTABLE) readAttrTable(); else if (theToken == GDS_GENERATIONS) readGenerations(); } while (theToken != GDS_UNITS) getToken(); readUnits(); getToken(); while (theToken != GDS_ENDLIB) { readStructure(); getToken(); } } private void readHeader() throws IOException { if (theToken != GDS_HEADER) handleError("GDS II header statement is missing"); getToken(); if (theToken != GDS_SHORT_NUMBER) handleError("GDS II version number is not decipherable"); // version "tokenValue16" } private void readLibrary() throws IOException { if (theToken != GDS_BGNLIB) handleError("Begin library statement is missing"); getToken(); determineTime(); // creation time determineTime(); // modification time if (theToken == GDS_LIBNAME) { getToken(); if (theToken != GDS_IDENT) handleError("Library name is missing"); } } private void readRefLibs() throws IOException { getToken(); getToken(); } private void readFonts() throws IOException { getToken(); getToken(); } private void readAttrTable() throws IOException { getToken(); if (theToken == GDS_IDENT) { getToken(); } } private void readUnits() throws IOException { if (theToken != GDS_UNITS) handleError("Units statement is missing"); getToken(); if (theToken != GDS_REALNUM) handleError("Units statement has invalid number format"); getToken(); double meterUnit = tokenValueDouble; double microScale = TextUtils.convertFromDistance(1, curTech, TextUtils.UnitScale.MICRO); theScale = meterUnit * 1000000.0 * microScale * inputScale; // round the scale double shift = 1; double roundedScale = theScale; while (roundedScale < 1) { roundedScale *= 10; shift *= 10; } roundedScale = DBMath.round(roundedScale) / shift; theScale = roundedScale; } private void showResultsOfCell() { System.out.print("**** Cell "+theCell.cell.describe(false)+" has"); if (countBox > 0) System.out.print(" "+countBox+" boxes"); if (countText > 0) System.out.print(" "+countText+" texts"); if (countNode > 0) System.out.print(" "+countNode+" nodes"); if (countPath > 0) System.out.print(" "+countPath+" paths"); if (countSRef > 0) System.out.print(" "+countSRef+" instances"); if (countARef > 0) System.out.print(" "+countARef+" arrays with "+countATotal+" elements"); System.out.println(); } private void readStructure() throws IOException { beginStructure(); getToken(); mergeThisCell = IOTool.isGDSInMergesBoxes(); if (mergeThisCell) { // initialize merge if merging this cell merge = new PolyMerge(); } // read the cell countBox = countText = countNode = countPath = countShape = countSRef = countARef = countATotal = 0; while (theToken != GDS_ENDSTR) { getElement(); getToken(); } if (TALLYCONTENTS) showResultsOfCell(); if (mergeThisCell) { // extract merge information for this cell for(Layer layer : merge.getKeySet()) { Layer primLayer = layer; PrimitiveNode pnp = primLayer.getPureLayerNode(); List<PolyBase> polys = merge.getMergedPoints(layer, false); for(PolyBase poly : polys) { Rectangle2D box = poly.getBox(); if (box == null) { box = poly.getBounds2D(); Point2D ctr = new EPoint(box.getCenterX(), box.getCenterY()); // store the trace information Point2D [] pPoints = poly.getPoints(); EPoint [] points = new EPoint[pPoints.length]; for(int i=0; i<pPoints.length; i++) { points[i] = new EPoint(pPoints[i].getX(), pPoints[i].getY()); } // store the trace information theCell.makeInstance(pnp, ctr, Orientation.IDENT, box.getWidth(), box.getHeight(), points); } else { Point2D ctr = new EPoint(box.getCenterX(), box.getCenterY()); theCell.makeInstance(pnp, ctr, Orientation.IDENT, box.getWidth(), box.getHeight(), null); } } } } } private void beginStructure() throws IOException { if (theToken != GDS_BGNSTR) handleError("Begin structure statement is missing"); getToken(); determineTime(); // creation time determineTime(); // modification time if (theToken != GDS_STRNAME) handleError("Strname statement is missing"); getToken(); if (theToken != GDS_IDENT) handleError("Structure name is missing"); // look for this nodeproto Cell cell = findCell(tokenString); if (cell == null) { // create the proto cell = Cell.newInstance(theLibrary, tokenString+View.LAYOUT.getAbbreviationExtension()); if (cell == null) handleError("Failed to create structure"); System.out.println("Reading " + tokenString); if (Job.getUserInterface().getCurrentCell(theLibrary) == null) Job.getUserInterface().setCurrentCell(theLibrary, cell); } theCell = new CellBuilder(cell); } private Cell findCell(String name) { return theLibrary.findNodeProto(name); } /** * Method to create a pure-layer node with a complex outline. * @param points the outline description. * @param pureType the type of the pure-layer node. * @param parent the Cell in which to create the node. */ private static void buildComplexNode(List<EPoint> points, NodeProto pureType, Cell parent) { EPoint [] pointArray = new EPoint[points.size()]; double lX=0, hX=0, lY=0, hY=0; for(int i=0; i<points.size(); i++) { pointArray[i] = points.get(i); if (pointArray[i] == null) continue; if (i == 0) { lX = hX = pointArray[i].getX(); lY = hY = pointArray[i].getY(); } else { if (pointArray[i].getX() < lX) lX = pointArray[i].getX(); if (pointArray[i].getX() > hX) hX = pointArray[i].getX(); if (pointArray[i].getY() < lY) lY = pointArray[i].getY(); if (pointArray[i].getY() > hY) hY = pointArray[i].getY(); } } NodeInst ni = NodeInst.makeInstance(pureType, new Point2D.Double((lX+hX)/2, (lY+hY)/2), hX-lX, hY-lY, parent, Orientation.IDENT, null, 0); if (ni != null) ni.setTrace(pointArray); } private void getElement() throws IOException { while (isMember(theToken, shapeSet)) { if (theToken == GDS_AREF) { determineARef(); } else if (theToken == GDS_SREF) { determineSRef(); } else if (theToken == GDS_BOUNDARY) { determineShape(); } else if (theToken == GDS_PATH) { determinePath(); } else if (theToken == GDS_NODE) { determineNode(); } else if (theToken == GDS_TEXTSYM) { determineText(); } else if (theToken == GDS_BOX) { determineBox(); } } while (theToken == GDS_PROPATTR) determineProperty(); if (theToken != GDS_ENDEL) { showResultsOfCell(); handleError("Element end statement is missing"); } } private void determineARef() throws IOException { getToken(); readUnsupported(unsupportedSet); if (theToken != GDS_SNAME) handleError("Array reference name is missing"); getToken(); // get this nodeproto getPrototype(tokenString); getToken(); int angle = 0;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -