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

📄 netschem.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
		return proxy.nodeOffset + i;	}	/**	 * Get offset in networks map for given subnetwork of nodable.	 * @param no nodable.	 * @param equivPortIndex index of entry in equivPortsX	 * @return offset in networks map.	 */    @Override    int getNetMapOffset(Nodable no, int equivPortIndex) {        Proxy proxy = (Proxy)no;        return proxy.nodeOffset + equivPortIndex;    }	/*	 * Get offset in networks map for given port instance.	 */    @Override	int getNetMapOffset(Nodable no, PortProto portProto, int busIndex) {		Proxy proxy;		if (no instanceof NodeInst) {			NodeInst ni = (NodeInst)no;			int nodeIndex = ni.getNodeIndex();//			int proxyOffset = nodeOffsets[nodeIndex];			//if (proxyOffset >= 0) {				int drawn = drawns[ni_pi[nodeIndex] + portProto.getPortIndex()];				if (drawn < 0) return -1;				if (busIndex < 0 || busIndex >= drawnWidths[drawn]) return -1;				return drawnOffsets[drawn] + busIndex;			//} else {			//	return -1;			//}// 			proxy = nodeProxies[~proxyOffset + arrayIndex];// 			NetCell netCell = networkManager.getNetCell((Cell)ni.getProto());		} else {			proxy = (Proxy)no;		}		if (proxy == null) return -1;		int portOffset = NetSchem.getPortOffset(networkManager, portProto, busIndex);		if (portOffset < 0) return -1;		return proxy.nodeOffset + portOffset;	}	/**	 * Method to return the port width of port of the Nodable.	 * @return the either the port width.	 */    @Override	int getBusWidth(Nodable no, PortProto portProto) {		if (no instanceof NodeInst) {			NodeInst ni = (NodeInst)no;			int nodeIndex = ni.getNodeIndex();//			int proxyOffset = nodeOffsets[nodeIndex];			//if (proxyOffset >= 0) {				int drawn = drawns[ni_pi[nodeIndex] + portProto.getPortIndex()];				if (drawn < 0) return 0;				return drawnWidths[drawn];			//}		} else {			return portProto.getNameKey().busWidth();		}	}	/*	 * Get offset in networks map for given export.	 */    @Override	int getNetMapOffset(Export export, int busIndex) {		int drawn = drawns[export.getPortIndex()];		if (drawn < 0) return -1;		if (busIndex < 0 || busIndex >= drawnWidths[drawn]) return -1;		return drawnOffsets[drawn] + busIndex;	}	/*	 * Get offset in networks map for given arc.	 */    @Override	int getNetMapOffset(ArcInst ai, int busIndex) {		int drawn = getArcDrawn(ai);		if (drawn < 0) return -1;		if (busIndex < 0 || busIndex >= drawnWidths[drawn]) return -1;		return drawnOffsets[drawn] + busIndex;	}	/**	 * Method to return either the network name or the bus name on this ArcInst.	 * @return the either the network name or the bus n1ame on this ArcInst.	 */    @Override	Name getBusName(ArcInst ai) {		int drawn = getArcDrawn(ai);		return drawnNames[drawn];	}	/**	 * Method to return the bus width on this ArcInst.	 * @return the either the bus width on this ArcInst.	 */    @Override	public int getBusWidth(ArcInst ai)	{		if ((flags & VALID) == 0) redoNetworks();		int drawn = getArcDrawn(ai);		if (drawn < 0) return 0;		return drawnWidths[drawn];	}    @Override	void invalidateUsagesOf(boolean strong)	{		super.invalidateUsagesOf(strong);		if (cell.isIcon()) return;		for (Iterator<Cell> it = cell.getCellGroup().getCells(); it.hasNext();) {			Cell c = it.next();			if (!c.isIcon()) continue;			NetSchem icon = (NetSchem)networkManager.getNetCell(c);			icon.setInvalid(strong, strong);		}	}	private boolean initNodables() {		if (nodeOffsets == null || nodeOffsets.length != cell.getNumNodes())			nodeOffsets = new int[cell.getNumNodes()];		int numNodes = cell.getNumNodes();		Global.Buf globalBuf = new Global.Buf();		int nodeProxiesOffset = 0;		Map<NodeInst,Set<Global>> nodeInstExcludeGlobal = null;		for (int i = 0; i < numNodes; i++) {			NodeInst ni = cell.getNode(i);			NodeProto np = ni.getProto();			NetCell netCell = null;			if (ni.isCellInstance())				netCell = networkManager.getNetCell((Cell)np);			if (netCell != null && netCell instanceof NetSchem) {				if (ni.getNameKey().hasDuplicates()) {					String msg = cell + ": Node name <"+ni.getNameKey()+"> has duplicate subnames";                    System.out.println(msg);                    networkManager.pushHighlight(ni);                    networkManager.logError(msg, NetworkTool.errorSortNodes);                }				nodeOffsets[i] = ~nodeProxiesOffset;				nodeProxiesOffset += ni.getNameKey().busWidth();			} else {				if (ni.getNameKey().isBus()) {					String msg = cell + ": Array name <"+ni.getNameKey()+"> can be assigned only to icon nodes";                    System.out.println(msg);                    networkManager.pushHighlight(ni);                    networkManager.logError(msg, NetworkTool.errorSortNodes);                }				nodeOffsets[i] = 0;			}			if (netCell != null) {				NetSchem sch = netCell.getSchem();				if (sch != null && sch != this) {					Global.Set gs = sch.globals;					// Check for rebinding globals					int numPortInsts = np.getNumPorts();					Set<Global> gb = null;					for (int j = 0; j < numPortInsts; j++) {						PortInst pi = ni.getPortInst(j);						int piOffset = getPortInstOffset(pi);						int drawn = drawns[piOffset];						if (drawn < 0 || drawn >= numConnectedDrawns) continue;						int portIndex = ((NetSchem)netCell).portImplementation[j];						if (portIndex < 0) continue;						Export e = sch.cell.getPort(portIndex);						if (!e.isGlobalPartition()) continue;						if (gb == null) gb = new HashSet<Global>();						for (int k = 0, busWidth = e.getNameKey().busWidth(); k < busWidth; k++) {							int q = sch.equivPortsN[sch.portOffsets[portIndex] + k];							for (int l = 0; l < sch.globals.size(); l++) {								if (sch.equivPortsN[l] == q) {									Global g = sch.globals.get(l);									gb.add(g);								}							}						}					}					if (gb != null) {						// remember excluded globals for this NodeInst						if (nodeInstExcludeGlobal == null)							nodeInstExcludeGlobal = new HashMap<NodeInst,Set<Global>>();						nodeInstExcludeGlobal.put(ni, gb);						// fix Set of globals						gs = gs.remove(gb.iterator());					}					String errorMsg = globalBuf.addToBuf(gs);					if (errorMsg != null) {						String msg = "Network: " + cell + " has globals with conflicting characteristic " + errorMsg;                        System.out.println(msg);                        networkManager.logError(msg, NetworkTool.errorSortNetworks);                        // TODO: what to highlight?                        // log.addGeom(shared[i].nodeInst, true, 0, null);                    }				}			} else {				Global g = globalInst(ni);				if (g != null) {					PortCharacteristic characteristic;					if (g == Global.ground)						characteristic = PortCharacteristic.GND;					else if (g == Global.power)						characteristic = PortCharacteristic.PWR;					else {						characteristic = PortCharacteristic.findCharacteristic(ni.getTechSpecific());						if (characteristic == null) {							String msg = "Network: " + cell + " has global " + g.getName() +								" with unknown characteristic bits";                            System.out.println(msg);                            networkManager.pushHighlight(ni);                            networkManager.logError(msg, NetworkTool.errorSortNetworks);							characteristic = PortCharacteristic.UNKNOWN;						}					}					String errorMsg = globalBuf.addToBuf(g, characteristic);					if (errorMsg != null) {						String msg = "Network: " + cell + " has global with conflicting characteristic " + errorMsg;                        System.out.println(msg);                        networkManager.logError(msg, NetworkTool.errorSortNetworks);                        //log.addGeom(shared[i].nodeInst, true, 0, null);                    }				}			}		}		Global.Set newGlobals = globalBuf.getBuf();		boolean changed = false;		if (globals != newGlobals) {			changed = true;			globals = newGlobals;			if (NetworkTool.debug) System.out.println(cell+" has "+globals);		}		int mapOffset = portOffsets[0] = globals.size();		int numPorts = cell.getNumPorts();		for (int i = 1; i <= numPorts; i++) {			Export export = cell.getPort(i - 1);			if (NetworkTool.debug) System.out.println(export+" "+portOffsets[i-1]);			mapOffset += export.getNameKey().busWidth();			if (portOffsets[i] != mapOffset) {				changed = true;				portOffsets[i] = mapOffset;			}		}		if (equivPortsN == null || equivPortsN.length != mapOffset) {			equivPortsN = new int[mapOffset];			equivPortsP = new int[mapOffset];			equivPortsA = new int[mapOffset];		}		for (int i = 0; i < numDrawns; i++) {			drawnOffsets[i] = mapOffset;			mapOffset += drawnWidths[i];			if (NetworkTool.debug) System.out.println("Drawn " + i + " has offset " + drawnOffsets[i]);		}		if (nodeProxies == null || nodeProxies.length != nodeProxiesOffset)			nodeProxies = new Proxy[nodeProxiesOffset];        Arrays.fill(nodeProxies, null);		name2proxy.clear();		proxyExcludeGlobals = null;		for (int n = 0; n < numNodes; n++) {			NodeInst ni = cell.getNode(n);			int proxyOffset = nodeOffsets[n];			if (NetworkTool.debug) System.out.println(ni+" "+proxyOffset);			if (proxyOffset >= 0) continue;			Cell iconCell = (Cell)ni.getProto();			NetSchem netSchem = networkManager.getNetCell(iconCell).getSchem();			if (netSchem == null || ni.isIconOfParent()) continue;			Set<Global> gs = nodeInstExcludeGlobal != null ? nodeInstExcludeGlobal.get(ni) : null; // exclude set of globals            for (int i = 0; i < ni.getNameKey().busWidth(); i++) {                Proxy proxy = new Proxy(ni, i);                Name name = ni.getNameKey().subname(i);                if (!name.isTempname()) {                    Proxy namedProxy = name2proxy.get(name);                    if (namedProxy != null) {//                        Cell namedIconCell = (Cell)namedProxy.nodeInst.getProto();                        String msg = "Network: " + cell + " has instances " + ni + " and " +                                namedProxy.nodeInst + " with same name <" + name + ">";                        System.out.println(msg);                        networkManager.pushHighlight(ni);                        networkManager.pushHighlight(namedProxy.nodeInst);                        networkManager.logError(msg, NetworkTool.errorSortNodes);                    }                    name2proxy.put(name, proxy);                }                if (NetworkTool.debug) System.out.println(proxy+" "+mapOffset+" "+netSchem.equivPortsN.length);                proxy.nodeOffset = mapOffset;                mapOffset += netSchem.equivPortsN.length;                if (gs != null) {                    if (proxyExcludeGlobals == null)                        proxyExcludeGlobals = new HashMap<Proxy,Set<Global>>();                    Set<Global> gs0 = proxyExcludeGlobals.get(proxy);                    if (gs0 != null) {                        gs = new HashSet<Global>(gs);                        gs.addAll(gs0);                    }                    proxyExcludeGlobals.put(proxy, gs);                }                nodeProxies[~proxyOffset + i] = proxy;            }		}		netNamesOffset = mapOffset;		if (NetworkTool.debug) System.out.println("netNamesOffset="+netNamesOffset);		return changed;	}// 	private static int portsSize(NodeProto np) {// 		if (np instanceof PrimitiveNode) return np.getNumPorts();// 		NetCell netCell = (NetCell) NetworkTool.getNetCell((Cell)np);// 		NetSchem sch = netCell.getSchem();// 		if (sch == null) return np.getNumPorts();// 		return sch.equivPorts.length - sch.globals.size();// 	}	private static Global globalInst(NodeInst ni) {		NodeProto np = ni.getProto();		if (np == Schematics.tech().groundNode) return Global.ground;		if (np == Schematics.tech().powerNode) return Global.power;

⌨️ 快捷键说明

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