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

📄 elib.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
	}	protected double computeLambda(Cell cell, int cellIndex)	{//		double lambda = 1.0;// 		int startNode = firstNodeIndex[cellIndex];// 		int endNode = firstNodeIndex[cellIndex+1];// 		int startArc = firstArcIndex[cellIndex];// 		int endArc = firstArcIndex[cellIndex+1];// 		Technology cellTech = Technology.whatTechnology(cell, nodeInstList.protoType, startNode, endNode, arcTypeList, startArc, endArc);// 		cell.setTechnology(cellTech);		Technology cellTech = cell.getTechnology();		return cellTech != null ? getScale(cellTech) : 1.0;	}    private double getScale(Technology tech) {        Double scale = techScale.get(tech);        return scale != null ? scale : tech.getScale();    }	protected boolean canScale() { return true; }	private void realizeExports(Cell cell, int cellIndex, String scaledCellName)	{		// finish initializing the Exports in the cell		int startPort = firstPortIndex[cellIndex];		int endPort = startPort + portCounts[cellIndex];        CellId cellId = cell.getId();        // Try to create ExportIds in alphanumeric order        TreeSet<String> exportNames = new TreeSet<String>(TextUtils.STRING_NUMBER_ORDER);        for (int i = startPort; i < endPort; i++)            exportNames.add(exportNameList[i]);        for (String exportName: exportNames)            cellId.newPortId(exportName);		for(int i=startPort; i<endPort; i++)		{//			if (exportList[i] instanceof Cell)//			{//				Cell otherCell = (Cell)exportList[i];//				Export pp = otherCell.findExport(exportNameList[i]);//				if (pp != null) exportList[i] = pp;//			}//			if (!(exportList[i] instanceof Export))//            {//                // could be missing because this is a dummy cell//                if (cell.getVar(IO_DUMMY_OBJECT) != null)//                    continue;               // don't issue error message//                // not on a dummy cell, issue error message//                System.out.println("ERROR: Cell "+cell.describe() + ": export " + exportNameList[i] + " is unresolved");//                continue;//			}			String exportName = exportNameList[i];			int nodeIndex = exportSubNodeList[i];			if (nodeIndex < 0)			{				System.out.println("ERROR: " + cell + ": cannot find the node on which export " + exportName + " resides");				continue;			}			NodeInst subNodeInst = nodeInstList.theNode[nodeIndex];            PortProto subPortProto = convertPortProto(exportSubPortList[i]);//			Object o = exportSubPortList[i];//			if (exportSubPortList[i] instanceof Integer)//			{//				// this was an external reference that couldn't be resolved yet.  Do it now//				int index = ((Integer)exportSubPortList[i]).intValue();//				exportSubPortList[i] = convertPortProto(index);//			}//			PortProto subPortProto = (PortProto)exportSubPortList[i];			// null entries happen when there are external cell references			if (subNodeInst == null || subPortProto == null || subNodeInst.getParent() != cell || subNodeInst.getProto() != subPortProto.getParent()) {				String msg = "ERROR: " + cell + ": export " + exportNameList[i] + " could not be created";                System.out.println(msg);				Input.errorLogger.logError(msg, cell, 1);                continue;            }			if (subNodeInst.getProto() == null)			{				String msg = "ERROR: "+cell + ": export " + exportNameList[i] + " could not be created...proto bad!";                System.out.println(msg);				Input.errorLogger.logError(msg, cell, 1);				continue;			}			// convert portproto to portinst			PortInst pi = subNodeInst.findPortInst(subPortProto.getName());            boolean alwaysDrawn = ImmutableExport.alwaysDrawnFromElib(exportUserbits[i]);            boolean bodyOnly = ImmutableExport.bodyOnlyFromElib(exportUserbits[i]);            PortCharacteristic characteristic = ImmutableExport.portCharacteristicFromElib(exportUserbits[i]);            ExportId exportId = cellId.newPortId(Name.findName(exportName).toString());            Export pp = Export.newInstance(cell, exportId, null, exportNameDescriptors[i], pi, alwaysDrawn, bodyOnly, characteristic, errorLogger);            exportList[i] = pp;            if (pp == null) continue;			realizeVariables(pp, exportVariables[i]);		}//		// convert "ATTRP_" variables on NodeInsts to be on PortInsts//		int startNode = firstNodeIndex[cellIndex];//		int endNode = firstNodeIndex[cellIndex+1];//		for(int i=startNode; i<endNode; i++)//		{//			NodeInst ni = nodeInstList.theNode[i];//			boolean found = true;//			while (found)//			{//				found = false;//				for(Iterator<Variable> it = ni.getVariables(); it.hasNext(); )//				{//					Variable origVar = it.next();//					Variable.Key origVarKey = origVar.getKey();//					String origVarName = origVarKey.getName();//					if (origVarName.startsWith("ATTRP_"))//					{//						// the form is "ATTRP_portName_variableName" with "\" escapes//						StringBuffer portName = new StringBuffer();//						String varName = null;//						int len = origVarName.length();//						for(int j=6; j<len; j++)//						{//							char ch = origVarName.charAt(j);//							if (ch == '\\')//							{//								j++;//								portName.append(origVarName.charAt(j));//								continue;//							}//							if (ch == '_')//							{//								varName = origVarName.substring(j+1);//								break;//							}//							portName.append(ch);//						}//						if (varName != null)//						{//							String thePortName = portName.toString();//							PortInst pi = ni.findPortInst(thePortName);//							if (pi != null)//							{//								Variable var = pi.newVar(Variable.newKey(varName), origVar.getObject(), origVar.getTextDescriptor());////								if (var != null)////								{////    								if (origVar.isDisplay()) var.setDisplay(true);////									var.setCode(origVar.getCode());////									var.setTextDescriptor(origVar.getTextDescriptor());////								}//								ni.delVar(origVarKey);//								found = true;//								break;//							}//						}//					}//				}//			}//		}	}	/**	 * Method to create the ArcInsts in a given cell and it's index in the global lists.	 */	private void realizeArcs(Cell cell, int cellIndex, String scaledCellName, double scale)	{		double lambda = cellLambda[cellIndex] / scale;		int xoff = cellXOff[cellIndex];		int yoff = cellYOff[cellIndex];//		boolean arcInfoError = false;		int startArc = firstArcIndex[cellIndex];		int endArc = firstArcIndex[cellIndex+1];		for(int i=startArc; i<endArc; i++)		{			ArcProto ap = convertArcProto(arcTypeList[i]);			String name = arcNameList[i];			long gridExtendOverMin = getSizeCorrector(ap.getTechnology()).getExtendFromDisk(ap, arcWidthList[i] / lambda);			double headX = (arcHeadXPosList[i] - xoff) / lambda;			double headY = (arcHeadYPosList[i] - yoff) / lambda;			double tailX = (arcTailXPosList[i] - xoff) / lambda;			double tailY = (arcTailYPosList[i] - yoff) / lambda;			if (arcHeadNodeList[i] < 0)			{				System.out.println("ERROR: head of " + ap+ " not known");				continue;			}			NodeInst headNode = nodeInstList.theNode[arcHeadNodeList[i]];            int headPortIntValue = arcHeadPortList[i];            PortProto headPort = convertPortProto(headPortIntValue);//			Object headPort = arcHeadPortList[i];//			int headPortIntValue = -1;            String headname = "Port name not found";//			if (headPort instanceof Integer)//			{//				// this was an external reference that couldn't be resolved yet.  Do it now//				headPortIntValue = ((Integer)headPort).intValue();//				headPort = convertPortProto(headPortIntValue);//			}            if (headPort != null) {                headname = headPort.getName();            } else {                if (headPortIntValue >= 0 && headPortIntValue < exportNameList.length)                    headname = exportNameList[headPortIntValue];            }			if (arcTailNodeList[i] < 0)			{				System.out.println("ERROR: tail of " + ap + " not known");				continue;			}			NodeInst tailNode = nodeInstList.theNode[arcTailNodeList[i]];			int tailPortIntValue = arcTailPortList[i];            PortProto tailPort = convertPortProto(tailPortIntValue);//			Object tailPort = arcTailPortList[i];//			int tailPortIntValue = -1;            String tailname = "Port name not found";//			if (tailPort instanceof Integer)//			{//				// this was an external reference that couldn't be resolved yet.  Do it now//				tailPortIntValue = ((Integer)tailPort).intValue();//				tailPort = convertPortProto(tailPortIntValue);//                if (tailPortIntValue > 0 && tailPortIntValue < exportNameList.length)//                    tailname = exportNameList[tailPortIntValue];//			}            if (tailPort != null) {                tailname = tailPort.getName();            } else {                if (tailPortIntValue >= 0 && tailPortIntValue < exportNameList.length)                    tailname = exportNameList[tailPortIntValue];            }            /*			if (headNode == null || headPort == null || tailNode == null || tailPort == null)			{				if (!arcInfoError)				{					System.out.println("ERROR: Missing arc information in cell " + cell.noLibDescribe() +						" in library " + lib.getName() + " ...");					if (headNode == null) System.out.println("   Head node not found");					if (headPort == null) System.out.println("   Head port "+headname+" not found (was "+headPortIntValue+", node="+headNode+")");					if (tailNode == null) System.out.println("   Tail node not found");					if (tailPort == null) System.out.println("   Tail port "+tailname+" not found (was "+tailPortIntValue+", node="+tailNode+")");					arcInfoError = true;				}				continue;			}*/            //PortInst headPortInst = headNode.findPortInst(((PortProto)headPort).getName());            //PortInst tailPortInst = tailNode.findPortInst(((PortProto)tailPort).getName());            PortInst headPortInst = getArcEnd(ap, headNode, headname, headX, headY, cell);            PortInst tailPortInst = getArcEnd(ap, tailNode, tailname, tailX, tailY, cell);			if (headPortInst == null || tailPortInst == null)			{				System.out.println("Cannot create arc of type " + ap.getName() + " in cell " + cell.getName() +					" because ends are unknown");				continue;			}            ArcInst ai = ArcInst.newInstance(cell, ap, name, arcNameDescriptorList[i], headPortInst, tailPortInst,                    new EPoint(headX, headY), new EPoint(tailX, tailY), gridExtendOverMin,                    ImmutableArcInst.angleFromElib(arcUserBits[i]), ImmutableArcInst.flagsFromElib(arcUserBits[i]));            arcList[i] = ai; 			if (ai == null)			{				String msg = "ERROR: "+cell + ": arc " + name + " could not be created";                System.out.println(msg);				Input.errorLogger.logError(msg, cell, 1);				continue;			}//            if (gridExtendOverMin < 0) {//				String msg = "WARNING: "+cell + ": arc " + ai.getName() + " width is less than minimum by " + DBMath.gridToLambda(-2*gridExtendOverMin);//                System.out.println(msg);//				Input.errorLogger.logWarning(msg, ai, cell, null, 2);//            }            realizeVariables(ai, arcVariables[i]);		}	}	/**	 * Method to build a NodeInst.	 */    private Cell scaleCell(int i, double lambda, Cell cell, HashSet<Cell> recursiveSetupFlag) {        Cell subCell = (Cell)nodeInstList.protoType[i];        Rectangle2D bounds = subCell.getBounds();        double width = (nodeInstList.highX[i] - nodeInstList.lowX[i]) / lambda;        double height = (nodeInstList.highY[i] - nodeInstList.lowY[i]) / lambda;        if (Math.abs(bounds.getWidth() - width) <= 0.5 && Math.abs(bounds.getHeight() - height) <= 0.5) return subCell;        LibraryFiles reader = this;        if (subCell.getLibrary() != lib) {            reader = getReaderForLib(subCell.getLibrary());        }        if (reader == null || !reader.canScale() || !cell.isSchematic() || !subCell.isIcon()) return subCell;        // see if uniform scaling can be done        double scaleX = width / bounds.getWidth();        double scaleY = height / bounds.getHeight();        // don't scale, most likely the size changed, and this is not a lambda problem        if (!GenMath.doublesClose(scaleX, scaleY)) return subCell;        double scale = Math.sqrt(scaleX * scaleY);        String scaledCellName = subCell.getName() + "-SCALED-BY-" + scale +                subCell.getView().getAbbreviationExtension();        Cell scaledCell = subCell.getLibrary().findNodeProto(scaledCellName);        if (scaledCell == null) {            // create a scaled version of the cell            if (reader != null)                reader.realizeCellsRecursively(subCell, recursiveSetupFlag, scaledCellName, scale);            scaledCell = subCell.getLibrary().findNodeProto(scaledCellName);            if (scaledCell == null) {                System.out.println("Error scaling " + subCell + " by " + scale);            }        }        return scaledCell != null ? scaledCell : subCell;    }    // node is node we expect to have port 'portname' at location x,y.    protected PortInst getArcEnd(ArcProto ap, NodeInst node, String portname, double x, double y, Cell cell)    {        PortInst pi = null;        String whatHappenedToPort = "not found";        String nodeName = "missing node";        if (node != null) {            pi = node.findPortInst(portname);            nodeName = node.getName();            if (pi != null) return pi;                // check to make sure location is correct//                Poly portLocation = pi.getPoly();//                String extra = "";////	            // Forcing rounding here instead of PolyBase.calcBounds()////	            portLocation.roundPoints();//                if (portLocation.contains(x, y) || portLocation.polyDistance(x, y) < TINYDISTANCE) {//                    return pi;//                }//                // give extra info to user if didn't contain port//                Rectangle2D box = portLocation.getBox();//                if (box != null) {//                    extra = "...arc end at ("+x+","+y+"), but port runs "+box.getMinX()+"<=X<="+box.getMaxX()+" and "+box.getMinY()+"<=Y<="+box.getMaxY();//                } else//				{//                    extra = "...expected ("+x+","+y+"), polyDistance=" + portLocation.polyDistance(x, y);//				}//                whatHappenedToPort = "has moved"+extra;//                pi = null;//            } else {                // name not found, see if any ports exist at location that we can connect to                for (Iterator<PortInst> it = node.getPortInsts(); it.hasNext(); ) {                    pi = it.next();                    Poly portLocation = pi.getPoly();                    if (portLocation.contains(x, y)) {                        if (pi.getPortProto().connectsTo(ap)) {                            // connect to this port                           

⌨️ 快捷键说明

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