📄 techtolib.java
字号:
// j++;// }// }// var = getvalkey((INTBIG)tech, VTECHNOLOGY, VSTRING|VISARRAY, dr_min_node_size_rulekey);// if (var != NOVARIABLE)// {// i = j = 0;// for(np = tech.firstnodeproto; np != NONODEPROTO; np = np.nextnodeproto)// {// if (np.temp1 != 0)// {// reallocstring(&rules.minnodesizeR[i], ((CHAR **)var.addr)[j], el_tempcluster);// i++;// }// j++;// }// }//// us_tecedloaddrcmessage(rules, lib);// dr_freerules(rules); Object[][] origPalette = tech.getNodesGrouped(null); int numRows = origPalette.length; int numCols = origPalette[0].length; for (Object[] row: origPalette) { assert row.length == numCols; } gi.menuPalette = new Object[numRows][numCols]; for (int row = 0; row < numRows; row++) { for (int col = 0; col < numCols; col++) { Object origEntry = origPalette[row][col]; Object newEntry = null; if (origEntry instanceof ArcProto) { ArcProto ap = (ArcProto)origEntry; for (ArcInfo ai: aList) { if (ai.name.equals(ap.getName())) { newEntry = ai; break; } } } else if (origEntry instanceof PrimitiveNode) { PrimitiveNode pnp = (PrimitiveNode)origEntry; for (NodeInfo ni: nList) { if (ni.name.equals(pnp.getName())) { newEntry = ni; break; } } } else if (origEntry != null) { newEntry = origEntry.toString(); } gi.menuPalette[row][col] = newEntry; } } // String techName = tech.getTechName();// LibToTech.writeXml(techName + ".xml", techName, gi, lList, nList, aList); // clean up System.out.println("Done."); return(lib); } private static ArcInfo makeArcInfo(ArcProto ap, LayerInfo[] lList) { ArcInfo aIn = new ArcInfo(); aIn.name = ap.getName(); aIn.func = ap.getFunction(); aIn.widthOffset = ap.getLambdaElibWidthOffset(); aIn.fixAng = ap.isFixedAngle(); aIn.wipes = ap.isWipable(); aIn.noExtend = !ap.isExtended(); aIn.curvable = ap.isCurvable(); aIn.special = ap.isSpecialArc(); aIn.notUsed = ap.isNotUsed(); aIn.skipSizeInPalette = ap.isSkipSizeInPalette(); aIn.slidable = ap.isSlidable(); aIn.angInc = ap.getAngleIncrement(); aIn.antennaRatio = ERC.getERCTool().getAntennaRatio(ap); aIn.arcDetails = new ArcInfo.LayerDetails[ap.getNumArcLayers()]; for(int i=0; i<aIn.arcDetails.length; i++) { ArcInfo.LayerDetails ald = new ArcInfo.LayerDetails(); aIn.arcDetails[i] = ald; String layerName = ap.getLayer(i).getName(); for(int j=0; j<lList.length; j++) { if (lList[j].name.equals(layerName)) { ald.layer = lList[j]; break; } } ald.style = ap.getLayerStyle(i); ald.width = ap.getLayerGridExtend(i); } return aIn; } private static NodeInfo makeNodeInfo(PrimitiveNode pnp, LayerInfo[] lList, ArcInfo[] aList) { Technology tech = pnp.getTechnology(); NodeInfo nIn = new NodeInfo(); nIn.name = pnp.getName(); nIn.func = pnp.getFunction(); nIn.serp = false; if (nIn.func.isFET() && pnp.isHoldsOutline()) nIn.serp = true; nIn.arcsShrink = pnp.isArcsShrink(); assert pnp.isArcsWipe() == nIn.arcsShrink; nIn.square = pnp.isSquare(); assert pnp.isHoldsOutline() == (pnp.getSpecialType() == PrimitiveNode.POLYGONAL || pnp.getSpecialType() == PrimitiveNode.SERPTRANS); nIn.canBeZeroSize = pnp.isCanBeZeroSize(); nIn.wipes = pnp.isWipeOn1or2(); nIn.lockable = pnp.isLockedPrim(); nIn.edgeSelect = pnp.isEdgeSelect(); nIn.skipSizeInPalette = pnp.isSkipSizeInPalette(); nIn.notUsed = pnp.isNotUsed(); nIn.lowVt = pnp.isNodeBitOn(PrimitiveNode.LOWVTBIT); nIn.highVt = pnp.isNodeBitOn(PrimitiveNode.HIGHVTBIT); nIn.nativeBit = pnp.isNodeBitOn(PrimitiveNode.NATIVEBIT); nIn.od18 = pnp.isNodeBitOn(PrimitiveNode.OD18BIT); nIn.od25 = pnp.isNodeBitOn(PrimitiveNode.OD25BIT); nIn.od33 = pnp.isNodeBitOn(PrimitiveNode.OD33BIT); nIn.xSize = pnp.getDefWidth(); nIn.ySize = pnp.getDefHeight(); nIn.so = pnp.getProtoSizeOffset(); if (nIn != null && nIn.so.getLowXOffset() == 0 && nIn.so.getHighXOffset() == 0 && nIn.so.getLowYOffset() == 0 && nIn.so.getHighYOffset() == 0) nIn.so = null; nIn.nodeSizeRule = pnp.getMinSizeRule(); nIn.autoGrowth = pnp.getAutoGrowth(); nIn.specialType = pnp.getSpecialType(); nIn.specialValues = pnp.getSpecialValues(); nIn.spiceTemplate = pnp.getSpiceTemplate(); List<Technology.NodeLayer> nodeLayers = Arrays.asList(pnp.getLayers()); List<Technology.NodeLayer> electricalNodeLayers = nodeLayers; if (pnp.getElectricalLayers() != null) electricalNodeLayers = Arrays.asList(pnp.getElectricalLayers()); List<NodeInfo.LayerDetails> layerDetails = new ArrayList<NodeInfo.LayerDetails>(); int m = 0; for (Technology.NodeLayer nld: electricalNodeLayers) { int j = nodeLayers.indexOf(nld); if (j < 0) { layerDetails.add(makeNodeLayerDetails(nld, lList, false, true)); continue; } while (m < j) layerDetails.add(makeNodeLayerDetails(nodeLayers.get(m++), lList, true, false)); layerDetails.add(makeNodeLayerDetails(nodeLayers.get(m++), lList, true, true)); } while (m < nodeLayers.size()) layerDetails.add(makeNodeLayerDetails(nodeLayers.get(m++), lList, true, false)); nIn.nodeLayers = layerDetails.toArray(new NodeInfo.LayerDetails[layerDetails.size()]); nIn.nodePortDetails = new NodeInfo.PortDetails[pnp.getNumPorts()]; for (int i = 0; i < nIn.nodePortDetails.length; i++) { PrimitivePort pp = pnp.getPort(i); NodeInfo.PortDetails pd = new NodeInfo.PortDetails(); nIn.nodePortDetails[i] = pd; pd.name = pp.getName(); pd.netIndex = pp.getTopology(); pd.angle = pp.getAngle(); pd.range = pp.getAngleRange(); pd.values = new Technology.TechPoint[] { new Technology.TechPoint(pp.getLeft(), pp.getBottom()), new Technology.TechPoint(pp.getRight(), pp.getTop())}; pd.characterisitic = pp.getCharacteristic(); pd.isolated = pp.isIsolated(); pd.negatable = pp.isNegatable(); ArcProto [] connects = pp.getConnections(); List<ArcInfo> validArcInfoConns = new ArrayList<ArcInfo>(); for(int j=0; j<connects.length; j++) { ArcProto ap = connects[j]; if (ap.getTechnology() != tech) continue; for (int k = 0; k < aList.length; k++) { if (aList[k].name.equals(ap.getName())) { validArcInfoConns.add(aList[k]); break; } } } pd.connections = validArcInfoConns.toArray(new ArcInfo[validArcInfoConns.size()]); } if (nIn.func == PrimitiveNode.Function.NODE) { assert nIn.nodeLayers.length == 1; LayerInfo l = nIn.nodeLayers[0].layer; if (l.pureLayerNode != null) System.out.println("Warning: technology has two pure-layer nodes for layer " + l.name + ": " + l.pureLayerNode.name + " and " + nIn.name);// assert l.pureLayerNode == null; l.pureLayerNode = nIn; } return nIn; } private static NodeInfo.LayerDetails makeNodeLayerDetails(Technology.NodeLayer nl, LayerInfo[] lList, boolean inLayers, boolean inElectricalLayers) { NodeInfo.LayerDetails nld = new NodeInfo.LayerDetails(); nld.inLayers = inLayers; nld.inElectricalLayers = inElectricalLayers; nld.style = nl.getStyle(); nld.portIndex = nl.getPortNum(); nld.representation = nl.getRepresentation(); nld.values = nl.getPoints(); for(int k=0; k<lList.length; k++) { if (nl.getLayer().getNonPseudoLayer().getName().equals(lList[k].name)) { nld.layer = lList[k]; break; } } nld.multiCut = nld.representation == Technology.NodeLayer.MULTICUTBOX; nld.multiXS = nl.getMulticutSizeX(); nld.multiYS = nl.getMulticutSizeY(); nld.multiSep = nl.getMulticutSep1D(); nld.multiSep2D = nl.getMulticutSep2D(); return nld; } private static NodeInst placeGeometry(Poly poly, Cell cell) { Rectangle2D box = poly.getBox(); Rectangle2D bounds = poly.getBounds2D(); Poly.Type style = poly.getStyle(); if (style == Poly.Type.FILLED) { if (box != null) { return NodeInst.makeInstance(Artwork.tech().filledBoxNode, new Point2D.Double(box.getCenterX(), box.getCenterY()), box.getWidth(), box.getHeight(), cell); } NodeInst ni = NodeInst.makeInstance(Artwork.tech().filledPolygonNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; ni.setTrace(poly.getPoints()); return ni; } if (style == Poly.Type.CLOSED) { if (box != null) { return NodeInst.makeInstance(Artwork.tech().boxNode, new Point2D.Double(box.getCenterX(), box.getCenterY()), box.getWidth(), box.getHeight(), cell); } NodeInst ni = NodeInst.makeInstance(Artwork.tech().closedPolygonNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; ni.setTrace(poly.getPoints()); return ni; } if (style == Poly.Type.CROSSED) { NodeInst ni = NodeInst.makeInstance(Artwork.tech().crossedBoxNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; return ni; } if (style == Poly.Type.OPENED) { NodeInst ni = NodeInst.makeInstance(Artwork.tech().openedPolygonNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; ni.setTrace(poly.getPoints()); return ni; } if (style == Poly.Type.OPENEDT1) { NodeInst ni = NodeInst.makeInstance(Artwork.tech().openedDottedPolygonNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; ni.setTrace(poly.getPoints()); return ni; } if (style == Poly.Type.OPENEDT2) { NodeInst ni = NodeInst.makeInstance(Artwork.tech().openedDashedPolygonNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; ni.setTrace(poly.getPoints()); return ni; } if (style == Poly.Type.OPENEDT3) { NodeInst ni = NodeInst.makeInstance(Artwork.tech().openedThickerPolygonNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; ni.setTrace(poly.getPoints()); return ni; } if (style == Poly.Type.CIRCLE) { NodeInst ni = NodeInst.makeInstance(Artwork.tech().circleNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; return ni; } if (style == Poly.Type.THICKCIRCLE) { NodeInst ni = NodeInst.makeInstance(Artwork.tech().thickCircleNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; return ni; } if (style == Poly.Type.DISC) { NodeInst ni = NodeInst.makeInstance(Artwork.tech().filledCircleNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; return ni; } if (style == Poly.Type.CIRCLEARC) { NodeInst ni = NodeInst.makeInstance(Artwork.tech().circleNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; ni.setArcDegrees(0.0, 45.0*Math.PI/180.0); return ni; } if (style == Poly.Type.THICKCIRCLEARC) { NodeInst ni = NodeInst.makeInstance(Artwork.tech().thickCircleNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; ni.setArcDegrees(0.0, 45.0*Math.PI/180.0); return ni; } if (style == Poly.Type.TEXTCENT) { NodeInst ni = NodeInst.makeInstance(Generic.tech().invisiblePinNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; ni.newVar(Artwork.ART_MESSAGE, poly.getString(), TextDescriptor.getNodeTextDescriptor().withPos(TextDescriptor.Position.CENT)); return ni; } if (style == Poly.Type.TEXTBOTLEFT) { NodeInst ni = NodeInst.makeInstance(Generic.tech().invisiblePinNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; ni.newVar(Artwork.ART_MESSAGE, poly.getString(), TextDescriptor.getNodeTextDescriptor().withPos(TextDescriptor.Position.UPRIGHT)); return ni; } if (style == Poly.Type.TEXTBOTRIGHT) { NodeInst ni = NodeInst.makeInstance(Generic.tech().invisiblePinNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; ni.newVar(Artwork.ART_MESSAGE, poly.getString(), TextDescriptor.getNodeTextDescriptor().withPos(TextDescriptor.Position.UPLEFT)); return ni; } if (style == Poly.Type.TEXTBOX) { NodeInst ni = NodeInst.makeInstance(Generic.tech().invisiblePinNode, new Point2D.Double(bounds.getCenterX(), bounds.getCenterY()), bounds.getWidth(), bounds.getHeight(), cell); if (ni == null) return null; ni.newVar(Artwork.ART_MESSAGE, poly.getString(), TextDescriptor.getNodeTextDescriptor().withPos(TextDescriptor.Position.BOXED)); return ni; } return(null); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -