?? gds.java
字號(hào):
readUnsupported(unsupportedSet); if (theToken != GDS_LAYER) handleError("Boundary has no points"); getToken(); int layerNum = tokenValue16; if (theToken == GDS_SHORT_NUMBER) { getToken(); } // also get node type int layerType = tokenValue16; if (theToken == GDS_NODETYPE) { getToken(); getToken(); } setLayer(layerNum, layerType); // make a dot if (theToken != GDS_XY) handleError("Boundary has no points"); getToken(); determinePoints(1, 1); if (TALLYCONTENTS) { countNode++; return; } // create the node if (mergeThisCell) { } else { theCell.makeInstance(layerNodeProto, new Point2D.Double(theVertices[0].getX(), theVertices[0].getY()), Orientation.IDENT, 0, 0, null); } } private void determineText() throws IOException { getToken(); readUnsupported(unsupportedSet); determineLayer(); getToken(); int vert_just = -1; int horiz_just = -1; if (theToken == GDS_PRESENTATION) { Point just = determineJustification(); vert_just = just.x; horiz_just = just.y; } if (theToken == GDS_PATHTYPE) { getToken(); // pathcode = tokenValue16; getToken(); } if (theToken == GDS_WIDTH) { getToken(); // pathwidth = tokenValue32 * theScale; getToken(); } int angle = 0; boolean trans = false; double scale = 1.0; String textString = ""; for(;;) { if (theToken == GDS_STRANS) { ReadOrientation ro = new ReadOrientation(); ro.doIt(); angle = ro.angle; trans = ro.trans; scale = ro.scale; continue; } if (theToken == GDS_XY) { getToken(); determinePoints(1, 1); continue; } if (theToken == GDS_ANGLE) { getToken(); angle = (int)(tokenValueDouble * 10.0); getToken(); continue; } if (theToken == GDS_STRING) { if (recordCount != 0) { getToken(); textString = tokenString; } getToken(); break; } if (theToken == GDS_MAG) { getToken(); getToken(); continue; } handleError("Text element has no reference point"); break; } if (TALLYCONTENTS) { countText++; return; } readText(textString, vert_just, horiz_just, angle, trans, scale); } private void readText(String charstring, int vjust, int hjust, int angle, boolean trans, double scale) { // stop if layer invalid if (!layerUsed) return; // handle pins specially if (layerIsPin) { NodeProto np = pinNodeProto; if (np.getNumPorts() > 0) { theCell.makeExport(np, new Point2D.Double(theVertices[0].getX(), theVertices[0].getY()), Orientation.IDENT, np.getDefWidth(), np.getDefHeight(), charstring); } return; } // stop if not handling text in GDS if (!IOTool.isGDSInIncludesText()) return; double x = theVertices[0].getX() + MINFONTWIDTH * charstring.length(); double y = theVertices[0].getY() + MINFONTHEIGHT; theVertices[1].setLocation(x, y); // set the text size and orientation MutableTextDescriptor td = MutableTextDescriptor.getNodeTextDescriptor(); double size = scale; if (size <= 0) size = 2; if (size > TextDescriptor.Size.TXTMAXQGRID) size = TextDescriptor.Size.TXTMAXQGRID; if (size < TextDescriptor.Size.TXTMINQGRID) size = TextDescriptor.Size.TXTMINQGRID; td.setRelSize(size); // determine the presentation td.setPos(TextDescriptor.Position.CENT); switch (vjust) { case 1: // top switch (hjust) { case 1: td.setPos(TextDescriptor.Position.UPRIGHT); break; case 2: td.setPos(TextDescriptor.Position.UPLEFT); break; default: td.setPos(TextDescriptor.Position.UP); break; } break; case 2: // bottom switch (hjust) { case 1: td.setPos(TextDescriptor.Position.DOWNRIGHT); break; case 2: td.setPos(TextDescriptor.Position.DOWNLEFT); break; default: td.setPos(TextDescriptor.Position.DOWN); break; } break; default: // centered switch (hjust) { case 1: td.setPos(TextDescriptor.Position.RIGHT); break; case 2: td.setPos(TextDescriptor.Position.LEFT); break; default: td.setPos(TextDescriptor.Position.CENT); break; } } theCell.makeText(layerNodeProto, new Point2D.Double(theVertices[0].getX(), theVertices[0].getY()), charstring, TextDescriptor.newTextDescriptor(td)); } /** * untested feature, I don't have a box type */ private void determineBox() throws IOException { getToken(); readUnsupported(unsupportedSet); determineLayer(); if (theToken != GDS_XY) handleError("Boundary has no points"); getToken(); determinePoints(2, MAXPOINTS); if (TALLYCONTENTS) { countBox++; return; } if (layerUsed) { // create the box if (mergeThisCell) { } else { theCell.makeInstance(layerNodeProto, new Point2D.Double(theVertices[0].getX(), theVertices[0].getY()), Orientation.IDENT, 0, 0, null); } } } private void setLayer(int layerNum, int layerType) { layerUsed = true; layerIsPin = false; Integer layerInt = new Integer(layerNum + (layerType<<16)); Layer layer = layerNames.get(layerInt); if (layer == null) { String message = "GDS layer " + layerNum + ", type " + layerType + " unknown in cell '" + theCell.cell.getName(); if (IOTool.isGDSInIgnoresUnknownLayers()) message += "', ignoring it" ; else message += "', using Generic:DRC"; errorLogger.logWarning(message, theCell.cell, 0); System.out.println(message); layerNames.put(layerInt, Generic.tech().drcLay); layerUsed = false; layerNodeProto = null; } else { layerNodeProto = layer.getNonPseudoLayer().getPureLayerNode(); if (layer == Generic.tech().drcLay && IOTool.isGDSInIgnoresUnknownLayers()) layerUsed = false; pinNodeProto = Generic.tech().universalPinNode; if (pinLayers.contains(layerInt)) { layerIsPin = true; if (layerNodeProto != null && layerNodeProto.getNumPorts() > 0) { PortProto pp = layerNodeProto.getPort(0); for (Iterator<ArcProto> it = layer.getTechnology().getArcs(); it.hasNext(); ) { ArcProto arc = it.next(); if (pp.connectsTo(arc)) { pinNodeProto = arc.findOverridablePinProto(); break; } } } } if (layerNodeProto == null) { String message = "Error: no pure layer node for layer "+layer.getName() + " in cell '" + theCell.cell.getName() + "', ignoring it"; System.out.println(message); errorLogger.logError(message, theCell.cell, 0); layerNames.put(layerInt, Generic.tech().drcLay); layerUsed = false; } } } private void determineLayer() throws IOException { if (theToken != GDS_LAYER) handleError("Layer statement is missing"); getToken(); if (theToken != GDS_SHORT_NUMBER) handleError("Invalid layer number"); int layerNum = tokenValue16; getToken(); if (!isMember(theToken, maskSet)) handleError("No datatype field"); getToken(); setLayer(layerNum, tokenValue16); } /** * Method to get the justification information into a Point. * @return a point whose "x" is the vertical justification and whose * "y" is the horizontal justification. */ private Point determineJustification() throws IOException { Point just = new Point(); getToken(); if (theToken != GDS_FLAGSYM) handleError("Array reference has no parameters"); int font_libno = tokenFlags & 0x0030; font_libno = font_libno >> 4; just.x = tokenFlags & 0x000C; just.x = just.x >> 2; just.y = tokenFlags & 0x0003; getToken(); return just; } private void determineProperty() throws IOException { getToken(); getToken(); if (theToken != GDS_PROPVALUE) handleError("Property has no value"); getToken(); // add to the current structure as a variable? getToken(); } private void getPrototype(String name) throws IOException { // scan for this proto Cell np = findCell(name); if (np == null) { // FILO order, create this nodeproto np = Cell.newInstance(theLibrary, tokenString+View.LAYOUT.getAbbreviationExtension()); if (np == null) handleError("Failed to create SREF proto"); setProgressValue(0); setProgressNote("Reading " + tokenString); } // set the reference node proto theNodeProto = np; } private void readGenerations() throws IOException { getToken(); if (theToken != GDS_SHORT_NUMBER) handleError("Generations value is invalid"); getToken(); } private boolean isMember(GSymbol tok, GSymbol [] set) { for(int i=0; i<set.length; i++) if (set[i] == tok) return true; return false; } private void getToken() throws IOException { if (recordCount == 0) { valuetype = readRecord(); } else { if (valuetype == TYPEFLAGS) { tokenFlags = getWord(); theToken = GDS_FLAGSYM; return; } if (valuetype == TYPESHORT) { tokenValue16 = getWord(); theToken = GDS_SHORT_NUMBER; return; } if (valuetype == TYPELONG) { tokenValue32 = getInteger(); theToken = GDS_NUMBER; return; } if (valuetype == TYPEFLOAT) { tokenValueDouble = getFloat(); theToken = GDS_REALNUM; return; } if (valuetype == TYPEDOUBLE) { tokenValueDouble = getDouble(); theToken = GDS_REALNUM; return; } if (value
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -