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

📄 allschemnamestolay.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    			printHeader();    			prln("    Can't copy schematic network name: "+schNetNm+    				 " to layout because equivalent layout network already "+    				 "has a name assigned by the designer: "+nm);    			numArcManRenames++;    			return true;    		}    	}    	return false;    }    // Names of the form: net@161[0] are occur in schematics but are not    // permitted in layout.    private boolean isLegalLayNetName(String schNetNm) {    	if (schNetNm.indexOf('@')!=-1 &&     		(schNetNm.indexOf('[')!=-1 || schNetNm.indexOf(']')!=-1)) {    		printHeader();    		prln("    Can't copy schematic network name: "+schNetNm+    			 " to layout because name is not a legal name for layout arcs");    		return false;    	}    	return true;    }        private ArcRenameInfo buildArcRenameInfo(Cell schCell, Cell layCell,            						         VarContext schCtxt,                                             Equivalence equivs) {    	Map<String, ArcInst> nmToLayArcInst = buildNameToLayArcInst(layCell);    	Map<String, Network> nmToLayNet = buildNameToLayNetwork(layCell);    	List<SchemNetNm_LayArcInsts> schNmLayArcInsts = new ArrayList<SchemNetNm_LayArcInsts>();    	Netlist nets = schCell.getNetlist(NccNetlist.SHORT_RESISTORS);    	    	int maxSchemAutoGen = 0;    	    	for (Network schNet : new For<Network>(nets.getNetworks())) {    		NetNameProxy layProx = equivs.findEquivalentNet(schCtxt, schNet);    		// skip if layout has no equivalent net (e.g.: net in center of     		// NMOS_2STACK)    		if (layProx==null)  continue;    		Network layNet = layProx.getNet();    		// skip if layout net isn't in top level Cell     		if (layNet.getParent()!=layCell) continue;      		// Skip if layout net gets its name from an Export because    		// designer has already chosen a useful name.    		if (layNet.isExported()) continue;    		    		String layNetNm = layNet.getName();    		String schNetNm = schNet.getName();    		// If the schematic and layout nets already have the    		// same preferred name then we're all set    		if (layNetNm.equals(schNetNm)) continue;    		    		if (isSchNameOnNonEquivLayNet(schNetNm, layNet, nmToLayNet)) continue;    		    		if (isEquivLayNetDesignerNamed(schNetNm, layNet)) continue;    		    		if (!isLegalLayNetName(schNetNm)) continue;    		List<ArcInst> layArcs = getArcInsts(layNet);    		    		// If no arcs then continue    		if (layArcs.size()==0) {    			printHeader();    			prln("    Can't copy schematic network name: "+schNetNm+    				 " to layout because equivalent layout network has "+    				 "no Arcs");    			continue;    		}    		// Whew! It's OK to rename    		numArcRenames++;    		    		int autoGenNumb = getAutoGenNumber(schNetNm);    		if (autoGenNumb!=-1) {    			maxSchemAutoGen = Math.max(maxSchemAutoGen, autoGenNumb);    		}    		if (DEBUG) {	    		printHeader();	    		prln("    Renaming layout net from: "+layNetNm+" to: "+schNetNm);	    		schNmLayArcInsts.add(new SchemNetNm_LayArcInsts(schNetNm, layArcs));    		}    	}		return new ArcRenameInfo(nmToLayArcInst, schNmLayArcInsts, maxSchemAutoGen);    }        private Map<String, NodeInst> buildNmToLayNodeInst(Cell layCell) {    	Map<String, NodeInst> nmsToLayNodeInsts = new HashMap<String, NodeInst>();    	for (Iterator<NodeInst> niIt=layCell.getNodes(); niIt.hasNext();) {    		NodeInst ni = niIt.next();    		nmsToLayNodeInsts.put(ni.getName(), ni);    	}    	return nmsToLayNodeInsts;    }        private NodeRenameInfo buildNodeRenameInfo(Cell schCell, Cell layCell,	          								   VarContext schCtxt,	          								   Equivalence equivs) {    	Map<String, NodeInst> nmToLayNodeInst = buildNmToLayNodeInst(layCell);    	    	List<SchemNodaNm_LayNodeInst> schNmLayNodeInst =     		new ArrayList<SchemNodaNm_LayNodeInst>();    	    	for (Nodable schNode : new For<Nodable>(schCell.getNodables())) {    		NodableNameProxy layProx = equivs.findEquivalentNode(schCtxt, schNode);    		    		// skip if layout has no equivalent nodable (e.g.: MOS deleted     		// because it is in parallel to another MOS     		if (layProx==null)  continue;    		    		Nodable layNoda = layProx.getNodable();    		    		// skip if layout Nodable isn't in top level Cell     		if (layNoda.getParent()!=layCell) continue;    		    		// skip if layout Nodable isn't a NodeInst. (This can happen    		// because Electric allows mixing of schematics and layout elements    		// in the same Cell.    		if (!(layNoda instanceof NodeInst)) continue;    		    		NodeInst layNodeInst = (NodeInst) layNoda;    		String layNodeNm = layNodeInst.getName();    		String schNodeNm = schNode.getName();    		    		// If the schematic and layout nodes already have the    		// same name then we're all set    		if (layNodeNm.equals(schNodeNm)) continue;    		    		if (!isAutoGenName(layNodeNm)) {    			printHeader();    			prln("    Can't copy schematic node name: "+schNodeNm+    				 " to layout because equivalent layout NodeInst already "+    				 "has a user assigned name: "+layNodeNm);    			numNodeManRenames++;    			continue;    		}    		    		if (!isAutoGenName(schNodeNm) && nmToLayNodeInst.containsKey(schNodeNm)) {    			printHeader();    			prln("   Can't copy schematic node name: "+schNodeNm+    				 " to layout because some "+    				 " non-equivalent layout node already uses that name");    			numNameConflicts++;    			continue;    		}    		    		// Whew! It's OK to copy    		schNmLayNodeInst.add(new SchemNodaNm_LayNodeInst(schNodeNm, layNodeInst));    		numNodeRenames++;    		    		if (DEBUG) {	    		printHeader();	    		prln("    Renaming layout NodeInst from: "+layNodeNm+" to: "+	    			 schNodeNm);    		}    	}    	return new NodeRenameInfo(nmToLayNodeInst, schNmLayNodeInst);    }    private void renameLayNodesWithConflictingNames(NodeRenameInfo info,     		                                        NameGenerator nameGen) {    	Map<String, NodeInst> nameToLayNodeInst = info.nameToLayNodeInst;    	for (SchemNodaNm_LayNodeInst i : info.toRename) {    		NodeInst layNode = nameToLayNodeInst.get(i.schemNodableName);    		if (layNode!=null)  layNode.setName(nameGen.nextName());    	}    }    private void renameEquivLayNodes(NodeRenameInfo info, NameGenerator nameGen) {    	for (SchemNodaNm_LayNodeInst i : info.toRename) {    		i.equivLayoutNodeInst.setName(i.schemNodableName);    	}    }        private void renameNodes(NodeRenameInfo info) {    	NameGenerator nameGen =     		new NameGenerator("ncc", 0, info.nameToLayNodeInst.keySet());    	renameLayNodesWithConflictingNames(info, nameGen);    	renameEquivLayNodes(info, nameGen);    }        // If a layout ArcInst has the same name as a schematic Network then     // rename then ArcInst    private void renameLayArcsWithConflictingNames(ArcRenameInfo info,    		                                       NameGenerator nameGen) {    	Map<String, ArcInst> nameToLayArcInst = info.nameToLayArcInst;    	for (SchemNetNm_LayArcInsts i : info.toRename) {    		ArcInst layArc = nameToLayArcInst.get(i.schemNetworkName);     		if (layArc!=null)  layArc.setName(nameGen.nextName());    	}    }    private ArcInst getLongestArc(List<ArcInst> arcs) {		double longestDist = Double.NEGATIVE_INFINITY;    	ArcInst longest = null;    	for (ArcInst ai : arcs) {            double length = ai.getGridLength();            if (length <= longestDist) continue;    		longest = ai;    		longestDist = length;    	}    	return longest;    }    // If a layout Network is about to get a name from the schematic,    // rename all the arcs on the layout Network to prevent their    // names from becoming "preferred". Remember that we may be copying    // an auto generated name from the schematic to the layout.    private void renameLayArcsToSchemName(ArcRenameInfo info,     		                                 NameGenerator nameGen) {    	for (SchemNetNm_LayArcInsts i : info.toRename) {    		// rename all ArcInsts on network to make sure none is    		// preferred over schematic name    		for (ArcInst a : i.equivLayoutArcInsts) {    			a.setName(nameGen.nextName());    		}    		// Give longest arc the name from schematic    		ArcInst longest = getLongestArc(i.equivLayoutArcInsts);    		longest.setName(i.schemNetworkName);    	}    }        private void renameArcs(ArcRenameInfo info) {    	NameGenerator nameGen =     		new NameGenerator("net", info.maxSchemAutoNameNumb,     				          info.nameToLayArcInst.keySet());    	renameLayArcsWithConflictingNames(info, nameGen);    	renameLayArcsToSchemName(info, nameGen);    }        private void copySchematicNamesToLayout(Cell schCell, Cell layCell,                                            VarContext schCtxt,                                            Equivalence equivs) {    	header = "  Copy from: "+schCell.describe(false)+" to "+		         layCell.describe(false);    	if (!schCell.isSchematic()) {    		printHeader();    		prln("    First Cell isn't schematic: "+schCell.describe(false));    		return;    	}    	if (layCell.getView()!=View.LAYOUT) {    		printHeader();    		prln("    Second Cell isn't layout: "+layCell.describe(false));    		return;    	}    	NodeRenameInfo nodeInfo = buildNodeRenameInfo(schCell, layCell, schCtxt, equivs);    	ArcRenameInfo arcInfo = buildArcRenameInfo(schCell, layCell, schCtxt, equivs);    	renameNodes(nodeInfo);    	renameArcs(arcInfo);    }        private void copySchematicNamesToLayout(NccResult result) {        Equivalence equivs = result.getEquivalence();        Cell [] rootCells = result.getRootCells();        // get layout cell        if (rootCells.length != 2) return;        int schNdx;                if (rootCells[0].isSchematic() &&         	rootCells[1].getView()==View.LAYOUT) {        	schNdx = 0;        } else if (rootCells[0].getView()==View.LAYOUT &&         	       rootCells[1].isSchematic()) {        	schNdx = 1;        } else {        	return;        }        int layNdx = schNdx==0 ? 1 : 0;        Cell schCell = rootCells[schNdx];        Cell layCell = rootCells[layNdx];                VarContext schContext = result.getRootContexts()[schNdx];        copySchematicNamesToLayout(schCell, layCell, schContext, equivs);    }        // Constructor does all the work    private AllSchemNamesToLay(NccResults results) {    	prln("Begin copying Network and Instance names from Schematic to Layout");    	if (results==null) {    		prln("  No saved NCC results. Please run NCC first.");    		return;    	}    	    	for (NccResult r : results) {    		if (r.match())  copySchematicNamesToLayout(r);    	}    	prln("Done");    }	RenameResult getResult() {		return new RenameResult(numArcRenames, numNodeRenames, numArcManRenames, 				                numNodeManRenames, numNameConflicts);	}        // --------------------------- public method -----------------------------    public static RenameResult copyNames(NccResults r) {    	AllSchemNamesToLay sntl = new AllSchemNamesToLay(r);    	return sntl.getResult();    }}

⌨️ 快捷键说明

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