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

📄 spicercsimple.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
					// subnets may be null if mixing schematics with layout technologies					for (Iterator<List<String>> it = subNets.getShortedExports(); it.hasNext(); )					{						List<String> exports = it.next();						PortInst pi1 = null;						// list of exports shorted together						for (String exportName : exports)						{							// get portinst on node							PortInst pi = ni.findPortInst(exportName);							if (pi1 == null)							{								pi1 = pi;								continue;							}							Network net = netList.getNetwork(pi);							if (segmentedNets.isExtractedNet(net))								segmentedNets.shortSegments(pi1, pi);						}					}				}			}		}		return segmentedNets;	}	/**	 * Method to emit the proper subcircuit header for a signal.	 * @param cs the signal to emit	 * @param infstr the string buffer to fill with the emitted signal information.	 */	public void writeSubcircuitHeader(CellSignal cs, StringBuffer infstr)	{		Network net = cs.getNetwork();		Map<String,List<String>> shortedExportsMap = new HashMap<String,List<String>>();		// For a single logical network, we need to:		// 1) treat certain exports as separate so as not to short resistors on arcs between the exports		// 2) join certain exports that do not have resistors on arcs between them, and record this information		//   so that the next level up knows to short networks connection to those exports.		for (Iterator<Export> it = net.getExports(); it.hasNext(); )		{			Export e = it.next();			PortInst pi = e.getOriginalPort();			String name = curSegmentedNets.getNetName(pi);			// exports are shorted if their segmented net names are the same (case (2))			List<String> shortedExports = shortedExportsMap.get(name);			if (shortedExports == null)			{				shortedExports = new ArrayList<String>();				shortedExportsMap.put(name, shortedExports);				// this is the first occurance of this segmented network, use the name as the export (1)				infstr.append(" " + name);			}			shortedExports.add(e.getName());		}			// record shorted exports		for (List<String> shortedExports : shortedExportsMap.values())		{			if (shortedExports.size() > 1)				curSegmentedNets.addShortedExports(shortedExports);		}	}	/**	 * Method to emit the name of a signal on an instance call (the "X" statement).	 * @param no the Nodable for the cell instance being examined.	 * @param subNet the Network in the cell attached to that Nodable.	 * @param subSegmentedNets the SpiceSegmentedNets object for the Nodable's Cell.	 * @param infstr the string buffer in which to emit the name(s).	 */	public void getParasiticName(Nodable no, Network subNet, SpiceSegmentedNets subSegmentedNets, StringBuffer infstr)	{		// connect to all exports (except power and ground of subcell net)		List<String> exportNames = new ArrayList<String>();		for (Iterator<Export> it = subNet.getExports(); it.hasNext(); )		{			// get subcell export, unless collapsed due to less than min R			Export e = it.next();			PortInst pi = e.getOriginalPort();			String name = subSegmentedNets.getNetName(pi);			if (exportNames.contains(name)) continue;			exportNames.add(name);			// ok, there is a port on the subckt on this subcell for this export,			// now get the appropriate network in this cell			pi = no.getNodeInst().findPortInstFromProto(no.getProto().findPortProto(e.getNameKey()));			name = curSegmentedNets.getNetName(pi);			infstr.append(" " + name);		}	}	/**	 * Method to find the SpiceSegmentedNets object that corresponds to a given Cell.	 * @param cell the Cell to find.	 * @return the SpiceSegmentedNets object associated with that cell (null if none found).	 */	public SpiceSegmentedNets getSegmentedNets(Cell cell)	{		for (SpiceSegmentedNets seg : segmentedParasiticInfo)			if (seg.getCell() == cell) return seg;		return null;	}	/**	 * Method called at the end of netlist writing to deal with back-annotation.	 */	public void backAnnotate()	{    	Set<Cell>      cellsToClear = new HashSet<Cell>();    	List<PortInst> capsOnPorts  = new ArrayList<PortInst>();    	List<String>   valsOnPorts  = new ArrayList<String>();    	List<ArcInst>  resOnArcs    = new ArrayList<ArcInst>();    	List<Double>   valsOnArcs   = new ArrayList<Double>();        for (SpiceSegmentedNets segmentedNets : segmentedParasiticInfo)        {            Cell cell = segmentedNets.getCell();            if (cell.getView() != View.LAYOUT) continue;            // gather cells to clear capacitor values            cellsToClear.add(cell);            // gather capacitor updates            for (SpiceSegmentedNets.NetInfo info : segmentedNets.getUniqueSegments())            {                PortInst pi = info.getPortIterator().next();                if (info.getCap() > cell.getTechnology().getMinCapacitance())                {                	capsOnPorts.add(pi);                	valsOnPorts.add(TextUtils.formatDouble(info.getCap(), 2) + "fF");                }            }            // gather resistor updates            for (Iterator<ArcInst> it = cell.getArcs(); it.hasNext(); )            {                ArcInst ai = it.next();                Double res = segmentedNets.getRes(ai);                resOnArcs.add(ai);                valsOnArcs.add(res);            }        }        new BackAnnotateJob(cellsToClear, capsOnPorts, valsOnPorts, resOnArcs, valsOnArcs);	}	/**	 * Class to run back-annotation in a Job.	 */	private static class BackAnnotateJob extends Job    {    	private Set<Cell> cellsToClear;    	private List<PortInst> capsOnPorts;    	private List<String> valsOnPorts;    	private List<ArcInst> resOnArcs;    	private List<Double> valsOnArcs;        private BackAnnotateJob(Set<Cell> cellsToClear, List<PortInst> capsOnPorts, List<String> valsOnPorts,        	List<ArcInst> resOnArcs, List<Double> valsOnArcs)    	{            super("Spice Layout Back Annotate", User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER);            this.capsOnPorts = capsOnPorts;            this.valsOnPorts = valsOnPorts;            this.resOnArcs = resOnArcs;            this.valsOnArcs = valsOnArcs;            this.cellsToClear = cellsToClear;            startJob();        }        public boolean doIt() throws JobException        {            TextDescriptor ctd = TextDescriptor.getPortInstTextDescriptor().withDispPart(TextDescriptor.DispPos.NAMEVALUE);            TextDescriptor rtd = TextDescriptor.getArcTextDescriptor().withDispPart(TextDescriptor.DispPos.NAMEVALUE);            int capCount = 0;            int resCount = 0;            // clear caps on layout            for(Cell cell : cellsToClear)            {                // delete all C's already on layout                for (Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); )                {                    NodeInst ni = it.next();                    for (Iterator<PortInst> pit = ni.getPortInsts(); pit.hasNext(); )                    {                        PortInst pi = pit.next();                        Variable var = pi.getVar(ATTR_C);                        if (var != null) pi.delVar(var.getKey());                    }                }            }            // add new C's            for(int i=0; i<capsOnPorts.size(); i++)            {            	PortInst pi = capsOnPorts.get(i);            	String str = valsOnPorts.get(i);                pi.newVar(ATTR_C, str, ctd);                resCount++;            }            // add new R's            for(int i=0; i<resOnArcs.size(); i++)            {            	ArcInst ai = resOnArcs.get(i);            	Double res = valsOnArcs.get(i);                // delete R if no new one                Variable var = ai.getVar(ATTR_R);                if (res == null && var != null)                    ai.delVar(ATTR_R);                // change R if new one                if (res != null)                {                    ai.newVar(ATTR_R, res, rtd);                    resCount++;                }            }            System.out.println("Back-annotated "+resCount+" Resistors and "+capCount+" Capacitors");            return true;        }    }}

⌨️ 快捷键说明

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