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

📄 elib.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
				e.setValue(new Integer(cellCount++));			}			writeBigInteger(cellCount);		}		// write the current cell		writeObj(null);		// write the version number		writeString(Version.getVersion().toString());		// number the views and write nonstandard ones		putObjIndex(View.UNKNOWN, -1);		putObjIndex(View.LAYOUT, -2);		putObjIndex(View.SCHEMATIC, -3);		putObjIndex(View.ICON, -4);		putObjIndex(View.DOCWAVE, -5);				// unknown in C		putObjIndex(View.LAYOUTSKEL, -6);			// unknown in C		putObjIndex(View.VHDL, -7);		putObjIndex(View.NETLIST, -8);		putObjIndex(View.DOC, -9);		putObjIndex(View.NETLISTNETLISP, -10);		// unknown in C		putObjIndex(View.NETLISTALS, -11);			// unknown in C		putObjIndex(View.NETLISTQUISC, -12);		// unknown in C		putObjIndex(View.NETLISTRSIM, -13);			// unknown in C		putObjIndex(View.NETLISTSILOS, -14);		// unknown in C		putObjIndex(View.VERILOG, -15);		List<View> viewsToSave = new ArrayList<View>();		for(Iterator<View> it = View.getViews(); it.hasNext(); )		{			View view = it.next();			if (objInfo.get(view) != null) continue;			if (!objInfo.containsKey(view)) continue;			viewsToSave.add(view);			putObjIndex(view, viewsToSave.size());		}		writeBigInteger(viewsToSave.size());		for(View view : viewsToSave)		{			writeString(view.getFullName());			writeString(view.getAbbreviation());		}		// write total number of arcinsts, nodeinsts, and ports in each cell		for (CellId cellId: cellOrdering.keySet())		{            CellRevision cellRevision = snapshot.getCellRevision(cellId);			writeBigInteger(cellRevision.arcs.size());			writeBigInteger(cellRevision.nodes.size());			writeBigInteger(cellRevision.exports.size());		}		// write dummy numbers of arcinsts and nodeinst; count ports for external cells        for (CellRevision cellRevision: externalCells) {            CellId cellId = cellRevision.d.cellId;            if (!objInfo.containsKey(cellId)) continue;            writeBigInteger(-1);            writeBigInteger(-1);            writeBigInteger(cellRevision.exports.size());        }		// write the names of technologies and primitive prototypes		for(int techCount = 0; techCount < technologies.size(); techCount++ )		{			Technology tech = technologies.get(techCount);			// write the technology name			writeString(tech.getTechName());			// write the primitive node prototypes			writeBigInteger(primNodeCounts[techCount]);			for(Iterator<PrimitiveNode> nit = tech.getNodes(); nit.hasNext(); )			{				PrimitiveNode np = nit.next();				if (!objInfo.containsKey(np.getId())) continue;				// write the primitive node prototype name				writeString(np.getName());				writeBigInteger(np.getNumPorts());				for(Iterator<PortProto> pit = np.getPorts(); pit.hasNext(); )				{					PrimitivePort pp = (PrimitivePort)pit.next();					writeString(pp.getName());				}			}			// write the primitive arc prototype names			writeBigInteger(primArcCounts[techCount]);			for(Iterator<ArcProto> ait = tech.getArcs(); ait.hasNext(); )			{				ArcProtoId apId = ait.next().getId();				if (!objInfo.containsKey(apId)) continue;				writeString(apId.name);			}		}		// write the names of the tools		for(Iterator<Tool> it = Tool.getTools(); it.hasNext(); )		{			Tool tool = it.next();			if (!objInfo.containsKey(tool)) continue;			writeString(tool.getName());		}		// write the userbits for the library		writeBigInteger(0);		//writeBigInteger(lib.lowLevelGetUserBits());		// write the tool scale values		for(Technology tech: technologies)		{			writeBigInteger(gridCoordToElib(tech, DBMath.GRID));//			writeBigInteger((int)Math.round(tech.getScale()*2));		}		// write the global namespace		writeNameSpace();		// write the library variables and font association that preserves the font names		writeVariables(snapshot.getLib(theLibId).d);		// write the tool variables		for(Iterator<Tool> it = Tool.getTools(); it.hasNext(); )		{			Tool tool = it.next();			if (!objInfo.containsKey(tool)) continue;			writeMeaningPrefs(tool);		}		// write the variables on technologies		for(Technology tech: technologies)		{			writeMeaningPrefs(tech);		}		// write the dummy primitive variables		int numDummyVariables = arcProtoIndex + primNodeProtoIndex + primPortProtoIndex;		for (int i = 0; i < numDummyVariables; i++) writeNoVariables();		// write the dummy view variables		writeBigInteger(0);		// write cells if creating version-6-compatible output		if (compatibleWith6)		{			for(String cellName : cellIndexMap.keySet())			{				writeString(cellName);				writeNoVariables();			}		}		// write all of the cells in this library        nodeIndex = 0;		for (CellId cellId: cellOrdering.keySet()) {            CellRevision cellRevision = snapshot.getCellRevision(cellId);            startCell(cellRevision, nodeIndex);			writeNodeProto(cellRevision);            nodeIndex += cellRevision.nodes.size();		}		// write all of the cells in external libraries        writeExternalCells();		// write all of the arcs and nodes in this library        nodeIndex = 0;        arcIndex = 0;		for (CellId cellId: cellOrdering.keySet())		{            CellRevision cellRevision = snapshot.getCellRevision(cellId);            startCell(cellRevision, nodeIndex);            writeArcs(cellRevision);            writeNodes(snapshot.getCell(cellId), arcIndex);            nodeIndex += cellRevision.nodes.size();            arcIndex += cellRevision.arcs.size();        }		// library written successfully		return false;	}	/**	 * Gather variables of ElectricObject into objInfo map.	 * @param eObj ElectricObject with variables.	 */	private void gatherVariables(String portName, ImmutableElectricObject d)	{        if (d instanceof ImmutableCell) {            for (Iterator<Variable> it = ((ImmutableCell)d).getParameters(); it.hasNext();) {                Variable param = it.next();                gatherVariable(portName, param);            }        } else if (d instanceof ImmutableIconInst) {            for (Iterator<Variable> it = ((ImmutableIconInst)d).getDefinedParameters(); it.hasNext();) {                Variable param = it.next();                gatherVariable(portName, param);            }        }		for (Iterator<Variable> it = d.getVariables(); it.hasNext(); ) {			Variable var = it.next();            gatherVariable(portName, var);		}	}	/**	 * Gather variable into objInfo map.	 * @param var variable.	 */	private void gatherVariable(String portName, Variable var)	{        Object value = var.getObject();        if (nameSpace != null) {            putNameSpace(diskName(portName, var));        }        gatherFont(var.getTextDescriptor());        int length = value instanceof Object[] ? ((Object[])value).length : 1;        for (int i = 0; i < length; i++)        {            Object v = value instanceof Object[] ? ((Object[])value)[i] : value;            if (v == null) continue;            if (v instanceof TechId || v instanceof Tool)            {                gatherObj(v);            } else if (v instanceof PrimitiveNodeId)            {                gatherObj(v);                gatherTech(((PrimitiveNodeId)v).techId);            } else if (v instanceof PrimitivePort)            {                PrimitiveNode pn = ((PrimitivePort)v).getParent();                gatherObj(pn.getId());                gatherTech(pn.getTechnology().getId());            } else if (v instanceof ArcProto)            {                gatherObj(v);                gatherTech(((ArcProto)v).getId().techId);            } else if (v instanceof CellId)            {                CellId cellId = (CellId)v;                if (snapshot.getCell(cellId) != null)                    gatherCell(cellId);            } else if (v instanceof ExportId)            {                ExportId exportId = (ExportId)v;                CellRevision cellRevision = snapshot.getCellRevision(exportId.getParentId());                if (cellRevision != null && cellRevision.getExport(exportId) != null) {                    gatherObj(exportId);                    gatherCell(exportId.getParentId());                }            }        }	}	/**	 * Gather project settings attached to object into objInfo map.	 * @param obj Object with attached project settings.	 */    private void gatherSettings(Object obj) {        Collection<Setting> settings = null;        if (obj instanceof Tool)            settings = ((Tool)obj).getDiskSettings();        else if (obj instanceof Technology)            settings = ((Technology)obj).getDiskSettings();        for (Setting setting: settings) {            gatherObj(obj);            String name = setting.getPrefName();            if (nameSpace != null) putNameSpace(name);        }    }	/**	 * Gather TechId of Technology into objInfo map.	 * @param tech Technology to examine.	 */	private void gatherTech(TechId techId)	{        gatherObj(techId);	}	/**	 * Gather Cell, its Library and its font into objInfo map.	 * @param cell Cell to examine.	 */	private void gatherCell(CellId cellId)	{		gatherObj(cellId);		gatherObj(cellId.libId);		gatherObj(cellId.cellName.getView());	}	/**	 * Gather object into objInfo map.	 * @param obj Object to put.	 */	private void gatherObj(Object obj)	{		objInfo.put(obj, null);	}	/**	 * Put index of object into objInfo map.	 * @param obj Object to put.	 * @param index index of object.	 */	private void putObjIndex(Object obj, int index)	{		objInfo.put(obj, new Integer(index));	}	/**	 * Put string into variable name space.	 * @param name name to put.	 */	private void putNameSpace(String name)	{		nameSpace.put(name, null);	}	/**	 * Gather ActiveFont object of the TextDescriptor into objInfo map.	 * @param td TextDescriptor to examine.	 */	private void gatherFont(TextDescriptor td)	{		int face = td.getFace();        faceMap[face] = -1;	}	/**	 * Method to gather all font settings in a Library.	 * The method examines all TextDescriptors that might be saved with the Library	 * and returns an array of Strings that describes the font associations.	 * Each String is of the format NUMBER/FONTNAME where NUMBER is the font number	 * in the TextDescriptor and FONTNAME is the font name.	 * @return font association array or null.	 */    String[] createFontAssociation() {        TreeMap<String,TextDescriptor.ActiveFont> sortedFonts = new TreeMap<String,TextDescriptor.ActiveFont>();        for (int face = 1; face < faceMap.length; face++) {            if (faceMap[face] == 0) continue;            TextDescriptor.ActiveFont af = TextDescriptor.ActiveFont.findActiveFont(face);            sortedFonts.put(af.getName(), af);        }        if (sortedFonts.size() == 0) return null;        String[] fontAssociation = new String[sortedFonts.size()];        int elibFace = 0;        for (TextDescriptor.ActiveFont af : sortedFonts.values()) {            elibFace++;            faceMap[af.getIndex()] = elibFace;            fontAssociation[elibFace-1] = elibFace + "/" + af.getName();        }        return fontAssociation;    }    void startCell(CellRevision cellRevision, int baseNodeIndex) {        int maxNodeId = -1;        for (ImmutableNodeInst n: cellRevision.nodes)            maxNodeId = Math.max(maxNodeId, n.nodeId);        nodeIndexByNodeId = new int[maxNodeId + 1];        for (int nodeIndex = 0; nodeIndex < cellRevision.nodes.size(); nodeIndex++) {            ImmutableNodeInst n = cellRevision.nodes.get(nodeIndex);            nodeIndexByNodeId[n.nodeId] = nodeIndex + baseNodeIndex;        }    }	// --------------------------------- OBJECT CONVERSION ---------------------------------    void writeExternalCells() throws IOException {        for (int i = 0; i < externalCells.size(); i++) {            CellRevision cellRevision = externalCells.get(i);            CellId cellId = cellRevision.d.cellId;            writeTxt("***cell: " + i);  // TXT only            writeCellInfo(cellRevision);            LibraryBackup libBackup = snapshot.getLib(cellId.libId);            URL fileUrl = libBackup.d.libFile;            String filePath = fileUrl != null ? fileUrl.getPath() : libBackup.d.libId.libName;            writeTxt("externallibrary: \"" + filePath + "\""); // TXT only            if (this instanceof ReadableDump) continue;            writeString(filePath);            // write the number of portprotos on this nodeproto

⌨️ 快捷键说明

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