📄 edif.java
字号:
if (netName.length() == 0) continue; // establish if this is a global net boolean globalport = false; blockOpen("net"); netName = cs.getName(); String eName = makeToken(netName); if (globalport) { blockOpen("rename"); blockPutIdentifier(eName); blockPutString(eName + "!"); blockClose("rename"); blockPut("property", "GLOBAL"); } else { EDIFEquiv.GlobalEquivalence ge = equivs.getElectricGlobalEquivalence(netName); if (ge != null) netName = ge.externGName; if (!eName.equals(netName)) { // different names blockOpen("rename"); blockPutIdentifier(eName); blockPutString(netName); blockClose("rename"); } else blockPutIdentifier(eName); } // write net connections blockOpen("joined"); // include exported ports if (cs.isExported()) { Export e = cs.getExport(); if (netList.getBusWidth(e) <= 1) { String pt = e.getName(); blockPut("portRef", makeToken(pt)); } } Network net = cs.getNetwork(); for(Iterator<Nodable> nIt = netList.getNodables(); nIt.hasNext(); ) { Nodable no = nIt.next(); NodeProto niProto = no.getProto(); // TODO (DONE) mention connectivity to a bus ripper if (no instanceof NodeInst) { BusRipper br = BusRipper.findBusRipper((NodeInst)no, net); if (br != null) { blockOpen("portRef"); blockOpen("member"); blockPutIdentifier("dst_0"); blockPutIdentifier(Integer.toString(br.getBusIndex())); blockClose("member"); blockOpen("instanceRef"); blockPutIdentifier("splitter_" + br.getSplitterIndex()); blockClose("instanceRef"); blockClose("portRef"); } } EDIFEquiv.NodeEquivalence ne = equivs.getNodeEquivalence(no.getNodeInst()); if (niProto instanceof Cell) { String nodeName = parameterizedName(no, context); CellNetInfo subCni = getCellNetInfo(nodeName); for(Iterator<CellSignal> sIt = subCni.getCellSignals(); sIt.hasNext(); ) { CellSignal subCs = sIt.next(); // ignore networks that aren't exported PortProto subPp = subCs.getExport(); if (subPp == null) continue; // single signal Network subNet = netList.getNetwork(no, subPp, subCs.getExportIndex()); if (cs != cni.getCellSignal(subNet)) continue; String portName = subCs.getName(); if (ne != null) { // get equivalent port name EDIFEquiv.PortEquivalence pe = ne.getPortEquivElec(portName); if (pe == null) { System.out.println("Error: no equivalent port found for '"+portName+"' on node "+niProto.describe(false)); System.out.println(" Equivalence class: "); System.out.println(ne.toString()); } else { if (!pe.getExtPort().ignorePort) { blockOpen("portRef"); portName = pe.getExtPort().name; blockPutIdentifier(makeToken(portName)); blockPut("instanceRef", makeComponentName(no)); blockClose("portRef"); } } } else { blockOpen("portRef"); blockPutIdentifier(makeToken(portName)); blockPut("instanceRef", makeComponentName(no)); blockClose("portRef"); } } } else { NodeInst ni = (NodeInst)no; PrimitiveNode.Function fun = ni.getFunction(); if (fun == PrimitiveNode.Function.UNKNOWN || fun == PrimitiveNode.Function.PIN || fun == PrimitiveNode.Function.CONTACT || fun == PrimitiveNode.Function.NODE || //fun == PrimitiveNode.Function.CONNECT || fun == PrimitiveNode.Function.ART) continue; for(Iterator<Connection> cIt = ni.getConnections(); cIt.hasNext(); ) { Connection con = cIt.next(); ArcInst ai = con.getArc(); Network aNet = netList.getNetwork(ai, 0); if (aNet != net) continue; String portName = con.getPortInst().getPortProto().getName(); if (ne != null) { // get equivalent port name EDIFEquiv.PortEquivalence pe = ne.getPortEquivElec(portName); if (pe == null) { System.out.println("Error: no equivalent port found for '"+portName+"' on node "+niProto.describe(false)); System.out.println(" Equivalence class: "); System.out.println(ne.toString()); } else { if (!pe.getExtPort().ignorePort) { blockOpen("portRef"); portName = pe.getExtPort().name; String safeName = makeValidName(portName); if (!safeName.equals(portName)) { blockPutIdentifier(makeToken(safeName)); } else { blockPutIdentifier(makeToken(portName)); } blockPut("instanceRef", makeComponentName(no)); blockClose("portRef"); } } } else { blockOpen("portRef"); blockPutIdentifier(makeToken(portName)); blockPut("instanceRef", makeComponentName(no)); blockClose("portRef"); } } } } blockClose("joined"); if (IOTool.isEDIFUseSchematicView()) { // output net graphic information for all arc instances connected to this net egraphic = EGUNKNOWN; egraphic_override = EGWIRE; for(Iterator<ArcInst> aIt = cell.getArcs(); aIt.hasNext(); ) { ArcInst ai = aIt.next(); int aWidth = netList.getBusWidth(ai); if (aWidth > 1) continue; Network aNet = netList.getNetwork(ai, 0); if (aNet == net) writeSymbolArcInst(ai, GenMath.MATID); } setGraphic(EGUNKNOWN); egraphic_override = EGUNKNOWN; } if (cs.isExported()) { Export e = cs.getExport(); blockOpen("comment"); blockPutString("exported as "+e.getName()+", type "+e.getCharacteristic().getName()); blockClose("comment"); } if (globalport) blockPut("userData", "global"); blockClose("net"); } // write busses if (ADD_RIPPERS) { // TODO (DONE) the new way HashSet<ArcInst> bussesSeen = new HashSet<ArcInst>(); for(Iterator<ArcInst> it = cell.getArcs(); it.hasNext(); ) { ArcInst ai = it.next(); int busWidth = netList.getBusWidth(ai); if (busWidth < 2) continue; if (bussesSeen.contains(ai)) continue; blockOpen("net"); blockOpen("array"); String realBusName = netList.getBusName(ai).toString(); String busName = convertBusName(realBusName, netList, ai); String oname = makeToken(busName); if (!oname.equals(busName)) { // different names blockOpen("rename"); blockPutIdentifier(oname); blockPutString(busName); blockClose("rename"); } else blockPutIdentifier(oname); blockPutIdentifier(Integer.toString(busWidth)); blockClose("array"); // now each sub-net name blockOpen("joined"); List<BusRipper> rippersOnBus = BusRipper.getRippersOnBus(cell, realBusName); for(BusRipper br : rippersOnBus) { blockOpen("portList"); for(int i=0; i<busWidth; i++) { blockOpen("portRef"); blockOpen("member"); blockPutIdentifier("src"); blockPutIdentifier(Integer.toString(i)); blockClose("member"); blockOpen("instanceRef"); blockPutIdentifier("splitter_" + br.splitterIndex); blockClose("instanceRef"); blockClose("portRef"); } blockClose("portList"); } blockClose("joined"); // now graphics for the bus if (IOTool.isEDIFUseSchematicView()) { // output net graphic information for all arc instances connected to this net egraphic = EGUNKNOWN; egraphic_override = EGBUS; for(Iterator<ArcInst> aIt = cell.getArcs(); aIt.hasNext(); ) { ArcInst oAi = aIt.next(); if (oAi.getProto() != Schematics.tech().bus_arc) continue; String arcBusName = netList.getBusName(oAi).toString(); if (arcBusName.equals(realBusName)) { writeSymbolArcInst(oAi, GenMath.MATID); bussesSeen.add(oAi); } } setGraphic(EGUNKNOWN); egraphic_override = EGUNKNOWN; } blockClose("net"); } } else { // the old way: no longer done for(Iterator<CellAggregateSignal> it = cni.getCellAggregateSignals(); it.hasNext(); ) { CellAggregateSignal cas = it.next(); // ignore single signals if (cas.getLowIndex() > cas.getHighIndex()) continue; blockOpen("netBundle"); String busName = cas.getNameWithIndices(); String oname = makeToken(busName); if (!oname.equals(busName)) { // different names blockOpen("rename"); blockPutIdentifier(oname); blockPutString(busName); blockClose("rename"); } else blockPutIdentifier(oname); blockOpen("listOfNets"); // now each sub-net name int numSignals = cas.getHighIndex() - cas.getLowIndex() + 1; for (int k=0; k<numSignals; k++) { blockOpen("net"); // now output this name CellSignal cs = cas.getSignal(k); String pt = cs.getName(); oname = makeToken(pt); if (!oname.equals(pt)) { // different names blockOpen("rename"); blockPutIdentifier(oname); blockPutString(pt); blockClose("rename"); } else blockPutIdentifier(oname); blockClose("net"); } // now graphics for the bus if (IOTool.isEDIFUseSchematicView()) { // output net graphic information for all arc instances connected to this net egraphic = EGUNKNOWN; egraphic_override = EGBUS; for(Iterator<ArcInst> aIt = cell.getArcs(); aIt.hasNext(); ) { ArcInst ai = aIt.next(); if (ai.getProto() != Schematics.tech().bus_arc) continue; String arcBusName = netList.getBusName(ai).toString(); if (arcBusName.equals(busName)) writeSymbolArcInst(ai, GenMath.MATID); } setGraphic(EGUNKNOWN); egraphic_override = EGUNKNOWN; } blockClose("netBundle"); continue; } }// // write text// Poly [] text = cell.getAllText(true, null);// if (text != null) {// for (int i=0; i<text.length; i++) {// Poly p = text[i];// }// } if (IOTool.isEDIFUseSchematicView()) { blockClose("page"); } blockClose("contents"); // matches "(cell " blockClose("cell"); } /****************************** MIDDLE-LEVEL HELPER METHODS ******************************/ private void writeHeader(Cell cell, String program, String comment, String origin) { // output the standard EDIF 2 0 0 header blockOpen("edif"); blockPutIdentifier(cell.getName()); blockPut("edifVersion", "2 0 0"); blockPut("edifLevel", "0"); blockOpen("keywordMap"); blockPut("keywordLevel", "0"); // was "1" blockClose("keywordMap"); blockOpen("status"); blockOpen("written"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy MM dd HH mm ss"); blockPut("timeStamp", simpleDateFormat.format(new Date())); if (program != null) blockPut("program", "\"" + program + "\""); if (comment != null) blockPut("comment", "\"" + comment + "\""); if (origin != null) blockPut("dataOrigin", "\"" + origin + "\""); blockClose("status"); } /** * Method to dump the description of primitive "np" to the EDIF file * If the primitive is a schematic gate, use "i" as the number of inputs */ private void writePrimitive(PrimitiveNode pn, int i, PrimitiveNode.Function fun) { // write primitive name if (fun == PrimitiveNode.Function.GATEAND || fun == PrimitiveNode.Function.GATEOR || fun == PrimitiveNode.Function.GATEXOR) { blockOpen("cell"); String name = makeToken(pn.getName()) + i; blockPutIdentifier(name); } else { blockOpen("cell"); blockPutIdentifier(makeToken(pn.getName())); } // write primitive connections blockPut("cellType", "generic"); blockOpen("comment"); Technology tech = pn.getTechnology(); blockPutString("Tech: "+tech.getTechName()+", Node: "+pn.getName()+", Func: "+fun.getConstantName()); blockClose("comment"); blockOpen("view"); blockPutIdentifier("symbol"); blockPut("viewType", IOTool.isEDIFUseSchematicView() ? "SCHEMATIC" : "NETLIST"); blockOpen("interface"); int firstPortIndex = 0; if (fun == PrimitiveNode.Function.GATEAND || fun == PrimitiveNode.Function.GATEOR || fun == PrimitiveNode.Function.GATEXOR)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -