⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edif.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            blockOpen("external");            blockPutIdentifier(lib);            blockPut("edifLevel", "0");            blockOpen("technology");            blockOpen("numberDefinition");            if (IOTool.isEDIFUseSchematicView())            {                writeScale(Technology.getCurrent());            }            blockClose("technology");            for (EDIFEquiv.NodeEquivalence e : equivs.getNodeEquivs()) {                if (!lib.equals(e.externalLib)) continue;                String viewType = null;                if (e.exortedType != null) viewType = "GRAPHIC"; // pins must have GRAPHIC view                writeExternalDef(e.externalCell, e.externalView, viewType, e.getExtPorts());            }            blockClose("external");        }	}    /**     * Build up lists of cells that need to be written, organized by library     */    protected void writeCellTopology(Cell cell, CellNetInfo cni, VarContext context, Topology.MyCellInfo info)    {        Library lib = cell.getLibrary();        LibToWrite l = libsToWrite.get(lib);        if (l == null) {            l = new LibToWrite(lib);            libsToWrite.put(lib, l);            libsToWriteOrder.add(lib);        }        l.add(new CellToWrite(cell, cni, context));    }    protected void done() {        // Note: if there are cross dependencies between libraries, there is no        // way to write out valid EDIF without changing the cell organization of the libraries        for (Library lib : libsToWriteOrder) {            LibToWrite l = libsToWrite.get(lib);            // here is where we write everything out, organized by library            // write library header            blockOpen("library");            blockPutIdentifier(makeToken(lib.getName()));            blockPut("edifLevel", "0");            blockOpen("technology");            blockOpen("numberDefinition", false);            if (IOTool.isEDIFUseSchematicView())            {                writeScale(Technology.getCurrent());            }            blockClose("numberDefinition");            if (IOTool.isEDIFUseSchematicView())            {                writeFigureGroup(EGART);                writeFigureGroup(EGWIRE);                writeFigureGroup(EGBUS);            }            blockClose("technology");            for (Iterator<CellToWrite> it2 = l.getCells(); it2.hasNext(); ) {                CellToWrite c = it2.next();                writeCellEdif(c.cell, c.cni, c.context);            }            blockClose("library");        }        // post-identify the design and library        blockOpen("design");        blockPutIdentifier(makeToken(topCell.getName()));        blockOpen("cellRef");        blockPutIdentifier(makeToken(topCell.getName()));        blockPut("libraryRef", makeToken(topCell.getLibrary().getName()));        // clean up        blockFinish();	}    /**     * Method to write cellGeom     */    private void writeCellEdif(Cell cell, CellNetInfo cni, VarContext context)	{		// write out the cell header information		blockOpen("cell");		blockPutIdentifier(makeToken(cell.getName()));		blockPut("cellType", "generic");		blockOpen("view");		blockPutIdentifier("symbol");		blockPut("viewType", IOTool.isEDIFUseSchematicView() ? "SCHEMATIC" : "NETLIST");		// write out the interface description		blockOpen("interface");		// write ports and directions		Netlist netList = cni.getNetList();		HashMap<Export,String> busExports = new HashMap<Export,String>();		for(Iterator<CellSignal> it = cni.getCellSignals(); it.hasNext(); )		{			CellSignal cs = it.next();			if (cs.isExported())			{				Export e = cs.getExport();				String direction = "INPUT";				if (e.getCharacteristic() == PortCharacteristic.OUT ||					e.getCharacteristic() == PortCharacteristic.REFOUT) direction = "OUTPUT";				if (e.getCharacteristic() == PortCharacteristic.BIDIR) direction = "INOUT";				int busWidth = netList.getBusWidth(e);				if (busWidth > 1)				{					// only write bus exports once					if (busExports.get(e) != null) continue;					blockOpen("port");					blockOpen("array");					String eBusName = convertBusName(e.getName(), netList, e);					String busName = makeToken(eBusName);					busExports.put(e, busName);					blockOpen("rename");					blockPutIdentifier(busName);					blockPutString(eBusName);					blockClose("rename");					blockPutIdentifier(Integer.toString(busWidth));					blockClose("array");					blockPut("direction", direction);					blockClose("port");				} else				{					blockOpen("port");					blockPutIdentifier(makeToken(cs.getName()));					blockPut("direction", direction);					blockClose("port");				}			}		}		if (IOTool.isEDIFUseSchematicView())		{            for (Iterator<Variable> it = cell.getParametersAndVariables(); it.hasNext(); ) {                Variable var = it.next();                if (var.getTrueName().equals("prototype_center")) continue;                blockOpen("property");                String name = var.getTrueName();                String name2 = makeValidName(name);                if (!name.equals(name2)) {                    blockOpen("rename", false);                    blockPutIdentifier(name2);                    blockPutString(name);                    blockClose("rename");                } else {                    blockPutIdentifier(name);                }                blockOpen("string", false);                String value = var.getObject().toString();                value = value.replaceAll("\"", "%34%");                blockPutString(value);                blockClose("string");                if (!var.isAttribute()) {                    blockOpen("owner", false);                    blockPutString("Electric");                }                blockClose("property");            }			// output the icon            //writeIcon(cell);			writeSymbol(cell);		}		blockClose("interface");		// write cell contents        blockOpen("contents");        if (IOTool.isEDIFUseSchematicView()) {            blockOpen("page");            blockPutIdentifier("SH1");        }		// TODO (DONE) add ripper instances		if (ADD_RIPPERS)		{			int splitterIndex = 1;			for(Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); )			{				NodeInst ni = it.next();				if (ni.isCellInstance()) continue;                if (equivs.getNodeEquivalence(ni) != null) continue;        // will be defined by external reference				PrimitiveNode.Function fun = ni.getFunction();				if (fun != PrimitiveNode.Function.PIN) continue;				// check all the connections				ArcInst busFound = null;				for(Iterator<Connection> cIt = ni.getConnections(); cIt.hasNext(); )				{					Connection con = cIt.next();					ArcInst ai = con.getArc();					int width = netList.getBusWidth(ai);					if (width > 1) busFound = ai;				}				if (busFound == null) continue;				int busWidth = netList.getBusWidth(busFound);				// a bus pin: look for wires that indicate ripping				for(Iterator<Connection> cIt = ni.getConnections(); cIt.hasNext(); )				{					Connection con = cIt.next();					ArcInst ai = con.getArc();					int width = netList.getBusWidth(ai);					if (width < 2)					{						// add an instance of a ripper						Network net = netList.getNetwork(ai, 0);						int busIndex = 0;						for(int i=0; i<busWidth; i++)						{							Network busNet = netList.getNetwork(busFound, i);							if (busNet == net)							{								busIndex = i;								break;							}						}						BusRipper.makeBusRipper(ni, net, busWidth, busIndex, splitterIndex,							netList.getBusName(busFound).toString());			            blockOpen("instance");							String splitterName = "splitter_" + splitterIndex;							splitterIndex++;				            blockPutIdentifier(splitterName);				            blockOpen("viewRef");				            	blockPutIdentifier("symbol");					            blockOpen("cellRef");				            		blockPutIdentifier("ripper_" + busWidth);									blockPut("libraryRef", "cdsRipLib");								blockClose("cellRef");							blockClose("viewRef");							blockOpen("transform");								blockOpen("origin");									writePoint(ni.getAnchorCenterX(), ni.getAnchorCenterY());								blockClose("origin");							blockClose("transform");			            blockClose("instance");					}				}			}		}		for(Iterator<NodeInst> nIt = cell.getNodes(); nIt.hasNext(); )		{			NodeInst no = nIt.next();            if (no.isCellInstance()) {                Cell c = (Cell)no.getProto();                if (cell.iconView() == c) continue;         // can't make instance of icon view            }			if (!no.isCellInstance())			{				PrimitiveNode.Function fun = no.getFunction();                Variable var = no.getVar(Artwork.ART_MESSAGE);                if (var != null) {                    // this is cell annotation text                    blockOpen("commentGraphics");                    blockOpen("annotate", false);                    Point2D point = new Point2D.Double(no.getAnchorCenterX(), no.getAnchorCenterY());                    Poly p = new Poly(new Point2D [] { point });                    String s;                    if (var.getObject() instanceof String []) {                        String [] lines = (String [])var.getObject();                        StringBuffer sbuf = new StringBuffer();                        for (int i=0; i<lines.length; i++) {                            sbuf.append(lines[i]);                            if (i != lines.length-1) sbuf.append("%10%");    // newline separator in Cadence                        }                        s = sbuf.toString();                    } else {                        s = var.getObject().toString();                    }                    p.setString(s);                    p.setTextDescriptor(var.getTextDescriptor());                    p.setStyle(var.getTextDescriptor().getPos().getPolyType());                    writeSymbolPoly(p, null, 1);                    blockClose("commentGraphics");                    continue;                }				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;			}			String iname = makeComponentName(no);			String oname = no.getName();            // write reference - get lib, cell, view            String refLib = "?", refCell="?", refView = "symbol";            int addedRotation = 0;            boolean openedPortImplementation = false;            EDIFEquiv.NodeEquivalence ne = equivs.getNodeEquivalence(no);            if (ne != null) {                addedRotation = ne.rotation * 10;                refLib = ne.externalLib;                refCell = ne.externalCell;                if (ne.exortedType != null) {                    // cadence pin: encapsulate instance inside of a portImplementation                    Iterator<Export> eit = no.getExports();                    if (eit.hasNext()) {                        Export e = eit.next();                        oname = e.getName();                        writePortImplementation(e, false);                        openedPortImplementation = true;                    }                }            } else if (!no.isCellInstance())			{				NodeInst ni = no;				PrimitiveNode.Function fun = ni.getFunction();                // do default action for primitives                refLib = primitivesLibName;                if (fun == PrimitiveNode.Function.GATEAND || fun == PrimitiveNode.Function.GATEOR || fun == PrimitiveNode.Function.GATEXOR) {					// count the number of inputs                    int i = 0;                    for(Iterator<Connection> pIt = ni.getConnections(); pIt.hasNext(); )                    {                        Connection con = pIt.next();                        if (con.getPortInst().getPortProto().getName().equals("a")) i++;                    }                    refCell = makeToken(ni.getProto().getName()) + i;                } else {                    refCell = describePrimitive(ni, fun);                }			} else			{                // this is a cell                Cell np = (Cell)no.getProto();                refLib = np.getLibrary().getName();                refCell = makeToken(no.getProto().getName());			}            // write reference            blockOpen("instance");			if (!oname.equalsIgnoreCase(iname))			{				blockOpen("rename", false);				blockPutIdentifier(iname);				blockPutString(oname);				blockClose("rename");			} else blockPutIdentifier(iname);            blockOpen("viewRef");            blockPutIdentifier(refView);            blockOpen("cellRef", false);            blockPutIdentifier(refCell);            blockPut("libraryRef", refLib);            blockClose("viewRef");			// now graphical information			if (IOTool.isEDIFUseSchematicView())			{                NodeInst ni = no;                blockOpen("transform");                // get the orientation (note only support orthogonal)                blockPut("orientation", getOrientation(ni, addedRotation));                // now the origin                blockOpen("origin");                double cX = ni.getAnchorCenterX(), cY = ni.getAnchorCenterY();                Point2D pt = new Point2D.Double(cX, cY);                writePoint(pt.getX(), pt.getY());                blockClose("transform");			}			// check for variables to write as properties			if (IOTool.isEDIFUseSchematicView())			{				// do all display variables first                NodeInst ni = no;                Poly[] varPolys = ni.getDisplayableVariables(ni.getBounds(), null, false);                writeDisplayableVariables(varPolys, ni.rotateOut());			}			blockClose("instance");            if (openedPortImplementation) {                blockClose("portImplementation");            }		}		// if there is anything to connect, write the networks in the cell		for(Iterator<CellSignal> it = cni.getCellSignals(); it.hasNext(); )		{			CellSignal cs = it.next();			// ignore unconnected (unnamed) nets			String netName = cs.getNetwork().describe(false);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -