?? maker.java
字號:
{ if ((via.flags & VIAEXPORT) != 0) { if (exportPort(via.instance, null, via.xPort.xPort.name, via.xPort.xPort.bits & GetNetlist.PORTTYPE, bCell) == null) { return "Cannot create export port '" + via.xPort.xPort.name + "' in MAKER"; } } } } } } // create power buses NodeInst lastPower = null; double xPos = data.minX - rowToTrack - (SilComp.getMainPowerWireWidth()/ 2); String mainPowerArc = SilComp.getMainPowerArc(); boolean mainPwrRailHoriz = mainPowerArc.equals("Horizontal Arc"); for (MakerPower pList = data.power; pList != null; pList = pList.next) { double yPos = pList.yPos; // create main power bus node NodeInst bInst = null; if (mainPwrRailHoriz) { bInst = NodeInst.makeInstance(layer1Proto, new Point2D.Double(xPos, yPos), SilComp.getMainPowerWireWidth(), SilComp.getMainPowerWireWidth(), bCell); } else { bInst = NodeInst.makeInstance(layer2Proto, new Point2D.Double(xPos, yPos), SilComp.getMainPowerWireWidth(), SilComp.getMainPowerWireWidth(), bCell); } if (bInst == null) return "Cannot create via in MAKER"; if (lastPower != null) { // join to previous if (mainPwrRailHoriz) { if (trackLayer1(bInst, null, lastPower, null, SilComp.getMainPowerWireWidth(), bCell) == null) { return "Cannot create layer1 track in MAKER"; } } else { if (trackLayer2(bInst, null, lastPower, null, SilComp.getMainPowerWireWidth(), bCell) == null) { return "Cannot create layer1 track in MAKER"; } } } lastPower = bInst; for (MakerPowerPort pPort = pList.ports; pPort != null; pPort = pPort.next) { if (pPort.last == null) { // connect to main power node if (trackLayer1(lastPower, null, pPort.inst.instance, (PortProto)pPort.port.port, SilComp.getPowerWireWidth(), bCell) == null) { return "Cannot create layer1 track in MAKER"; } } // connect to next if it exists if (pPort.next != null) { if (trackLayer1(pPort.inst.instance, (PortProto)pPort.port.port, pPort.next.inst.instance, (PortProto)pPort.next.port.port, SilComp.getPowerWireWidth(), bCell) == null) { return "Cannot create layer1 track in MAKER"; } } } } // create ground buses NodeInst lastGround = null; xPos = data.maxX + rowToTrack + (SilComp.getMainPowerWireWidth() / 2); for (MakerPower pList = data.ground; pList != null; pList = pList.next) { double yPos = pList.yPos; // create main ground bus node NodeInst bInst = null; if (mainPwrRailHoriz) { bInst = NodeInst.makeInstance(layer1Proto, new Point2D.Double(xPos, yPos), SilComp.getMainPowerWireWidth(), SilComp.getMainPowerWireWidth(), bCell); } else { bInst = NodeInst.makeInstance(layer2Proto, new Point2D.Double(xPos, yPos), SilComp.getMainPowerWireWidth(), SilComp.getMainPowerWireWidth(), bCell); } if (bInst == null) return "Cannot create via in MAKER"; if (lastGround != null) { // join to previous if (mainPwrRailHoriz) { if (trackLayer1(bInst, null, lastGround, null, SilComp.getMainPowerWireWidth(), bCell) == null) { return "Cannot create layer1 track in MAKER"; } } else { if (trackLayer2(bInst, null, lastGround, null, SilComp.getMainPowerWireWidth(), bCell) == null) { return "Cannot create layer1 track in MAKER"; } } } else { if (exportPort(bInst, null, "gnd", GetNetlist.GNDPORT, bCell) == null) { return "Cannot create export port 'gnd' in MAKER"; } } lastGround = bInst; for (MakerPowerPort pPort = pList.ports; pPort != null; pPort = pPort.next) { if (pPort.next == null) { // connect to main ground node if (trackLayer1(lastGround, null, pPort.inst.instance, (PortProto)pPort.port.port, SilComp.getPowerWireWidth(), bCell) == null) { return "Cannot create layer1 track in MAKER"; } } // connect to next if it exists else { if (trackLayer1(pPort.inst.instance, (PortProto)pPort.port.port, pPort.next.inst.instance, (PortProto)pPort.next.port.port, SilComp.getPowerWireWidth(), bCell) == null) { return "Cannot create layer1 track in MAKER"; } } } } if (lastPower != null) { // export as cell vdd if (exportPort(lastPower, null, "vdd", GetNetlist.PWRPORT, bCell) == null) { return "Cannot create export port 'vdd' in MAKER"; } } // create overall P-wells if pwell size not zero if (SilComp.getPWellHeight() != 0) { for (MakerRow row = data.rows; row != null; row = row.next) { MakerInst firstInst = null; MakerInst prevInst = null; for (MakerInst inst = row.members; inst != null; inst = inst.next) { if (inst.place.cell.type != GetNetlist.LEAFCELL) continue; if (firstInst == null) { firstInst = inst; } else { prevInst = inst; } } if (prevInst != null) { xPos = (firstInst.xPos + prevInst.xPos + prevInst.xSize) / 2; double xSize = (prevInst.xPos + prevInst.xSize) - firstInst.xPos; double ySize = SilComp.getPWellHeight(); if (ySize > 0) { double yPos = firstInst.yPos + SilComp.getPWellOffset() + (SilComp.getPWellHeight() / 2); if (pWellProto != null) { NodeInst bInst = NodeInst.makeInstance(pWellProto, new Point2D.Double(xPos, yPos), xSize, ySize, bCell); if (bInst == null) return "Unable to create P-WELL in MAKER"; } } ySize = SilComp.getNWellHeight(); if (ySize > 0) { double yPos = firstInst.yPos + firstInst.ySize - SilComp.getNWellOffset() - (SilComp.getNWellHeight() / 2); if (nWellProto != null) { NodeInst bInst = NodeInst.makeInstance(nWellProto, new Point2D.Double(xPos, yPos), xSize, ySize, bCell); if (bInst == null) return "Unable to create N-WELL in MAKER"; } } } } } return bCell; } /** * Method to create an export at the given instance at the given port. * Note that ports of primitive instances are passed as NULL and must be determined. * @param inst pointer to instance. * @param port pointer to port on the instance. * @param name name of the Export. * @param type type of port (eg. input, output, etc.) * @param bCell cell in which to create. * @return the new Export (null on error). */ private Export exportPort(NodeInst inst, PortProto port, String name, int type, Cell bCell) { // check if primative if (port == null) port = inst.getProto().getPort(0); PortInst pi = inst.findPortInstFromProto(port); PortCharacteristic pc = null; switch (type) { case GetNetlist.INPORT: pc = PortCharacteristic.IN; break; case GetNetlist.OUTPORT: pc = PortCharacteristic.OUT; break; case GetNetlist.BIDIRPORT: pc = PortCharacteristic.BIDIR; break; case GetNetlist.PWRPORT: pc = PortCharacteristic.PWR; break; default: pc = PortCharacteristic.GND; break; } Export xPort = Export.newInstance(bCell, pi, name, pc); return xPort; } /** * Method to create a track between the two given ports on the first routing layer. * Note that ports of primitive instances are passed as NULL and must be determined. * @param insta pointer to first instance. * @param portA pointer to first port. * @param instB pointer to second instance. * @param portB pointer to second port. * @param width width of track. * @param bCell cell in which to create. * @return the created ArcInst. */ private ArcInst trackLayer1(NodeInst instA, PortProto portA, NodeInst instB, PortProto portB, double width, Cell bCell) { // copy into internal structures if (portA == null) portA = instA.getProto().getPort(0); if (portB == null) portB = instB.getProto().getPort(0); // find center positions PortInst piA = instA.findPortInstFromProto(portA); PortInst piB = instB.findPortInstFromProto(portB); Poly polyA = piA.getPoly(); Poly polyB = piA.getPoly(); double xA = polyA.getCenterX(); double yA = polyA.getCenterY(); double xB = polyB.getCenterX(); double yB = polyB.getCenterY(); // make sure the arc can connect if (!portA.getBasePort().connectsTo(layer1Arc)) { // must place a via piA = createConnection(piA, xA, yA, layer1Arc); } if (!portB.getBasePort().connectsTo(layer1Arc)) { // must place a via piB = createConnection(piB, xB, yB, layer1Arc); } ArcInst inst = ArcInst.makeInstanceBase(layer1Arc, width, piA, piB);// ArcInst inst = ArcInst.makeInstanceFull(layer1Arc, width, piA, piB); return inst; } /** * Method to create a track between the two given ports on the second routing layer. * Note that ports of primitive instances are passed as NULL and must be determined. * @param insta pointer to first instance. * @param portA pointer to first port. * @param instB pointer to second instance. * @param portB pointer to second port. * @param width width of track. * @param bCell cell in which to create. * @return the created ArcInst. */ private ArcInst trackLayer2(NodeInst instA, PortProto portA, NodeInst instB, PortProto portB, double width, Cell bCell) { // copy into internal structures if (portA == null) portA = instA.getProto().getPort(0); if (portB == null) portB = instB.getProto().getPort(0); // find center positions PortInst piA = instA.findPortInstFromProto(portA); PortInst piB = instB.findPortInstFromProto(portB); Poly polyA = piA.getPoly(); Poly polyB = piA.getPoly(); double xA = polyA.getCenterX(); double yA = polyA.getCenterY(); double xB = polyB.getCenterX(); double yB = polyB.getCenterY(); // make sure the arc can connect if (!portA.getBasePort().connectsTo(layer2Arc)) { // must place a via piA = createConnection(piA, xA, yA, layer1Arc); } if (!portB.getBasePort().connectsTo(layer2Arc)) { // must place a via piB = createConnection(piB, xB, yB, layer1Arc); } ArcInst inst = ArcInst.makeInstanceBase(layer2Arc, width, piA, piB);// ArcInst inst = ArcInst.makeInstanceFull(layer2Arc, width, piA, piB); return inst; } private PortInst createConnection(PortInst pi, double x, double y, ArcProto arc) { // always use the standard via (David Harris) if (viaProto == null) return null; PrimitiveNode.Function fun = viaProto.getFunction(); if (fun != PrimitiveNode.Function.CONTACT && fun != PrimitiveNode.Function.CONNECT) return null; // override given arc and choose one that will connect if (pi.getPortProto() instanceof PrimitivePort) arc = ((PrimitivePort)pi.getPortProto()).getConnection(); // make sure that this contact connects to the desired arc if (!viaProto.getPort(0).connectsTo(arc)) return null; // use this via to make the connection NodeInst viaNode = NodeInst.makeInstance(viaProto, new Point2D.Double(x, y), viaProto.getDefWidth(), viaProto.getDefHeight(), pi.getNodeInst().getParent()); if (viaNode == null) return null;// double wid = arc.getDefaultLambdaFullWidth(); PortInst newPi = viaNode.getOnlyPortInst(); ArcInst zeroArc = ArcInst.makeInstance(arc, pi, newPi);// ArcInst zeroArc = ArcInst.makeInstanceFull(arc, wid, pi, newPi); if (zeroArc == null) return null; return newPi; } /** * Method to locate the appropriate prototypes for circuit generation. */ private String setupForMaker() { Technology tech = Technology.getCurrent(); if (tech == Schematics.tech()) tech = User.getSchematicTechnology(); String layer1 = SilComp.getHorizRoutingArc(); String layer2 = SilComp.getVertRoutingArc(); layer1Arc = tech.findArcProto(layer1); layer2Arc = tech.findArcProto(layer2); if (layer1Arc == null) return "Unable to find Horizontal Arc " + layer1 + " for MAKER"; if (layer2Arc == null) return "Unable to find Vertical Arc " + layer2 + " for MAKER"; // find the contact between the two layers for(Iterator<PrimitiveNode> it = tech.getNodes(); it.hasNext(); ) { PrimitiveNode via = it.next(); PrimitiveNode.Function fun = via.getFunction(); if (fun != PrimitiveNode.Function.CONTACT && fun != PrimitiveNode.Function.CONNECT) continue; PrimitivePort pp = via.getPort(0); if (!pp.connectsTo(layer1Arc)) continue; if (!pp.connectsTo(layer2Arc)) continue; viaProto = via; break; } if (viaProto == null) return "Unable to get VIA for MAKER"; // find the pin nodes on the connecting layers layer1Proto = layer1Arc.findPinProto(); if (layer1Proto == null) return "Unable to get LAYER1-NODE for MAKER"; layer2Proto = layer2Arc.findPinProto(); if (layer2Proto == null) return "Unable to get LAYER2-NODE for MAKER"; /* * find the pure-layer node on the P-well layer * if the p-well size is zero don't look for the node * allows technologies without p-wells to be routed (i.e. GaAs) */ if (SilComp.getPWellHeight() == 0) pWellProto = null; else { pWellProto = null; Layer pWellLay = tech.findLayerFromFunction(Layer.Function.WELLP, -1); if (pWellLay != null) pWellProto = pWellLay.getPureLayerNode(); if (pWellProto == null) return "Unable to get LAYER P-WELL for MAKER"; } if (SilComp.getNWellHeight() == 0) nWellProto = null; else { nWellProto = null; Layer nWellLay = tech.findLayerFromFunction(Layer.Function.WELLN, -1); if (nWellLay != null) nWellProto = nWellLay.getPureLayerNode(); if (nWellProto == null) return "Unable to get LAYER P-WELL for MAKER"; } return null; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -