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

📄 def.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
				{					reportError("Expected '(' of pin pair");					return true;				}				// get the pin names				key = mustGetKeyword("NET");				if (key == null) return true;				PortInst pi = null;				if (key.equalsIgnoreCase("PIN"))				{					// find the export					key = mustGetKeyword("NET");					if (key == null) return true;					key = translateDefName(key);					Export pp = (Export)cell.findPortProto(key);					if (pp == null)					{						reportError("Warning: unknown pin '" + key + "'");						if (ignoreToSemicolon("NETS")) return true;						return false;					}					pi = pp.getOriginalPort();				} else				{					NodeInst found = null;					if (key.equals("*")) connectAllComponents = true;						else connectAllComponents = false;					for(Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); )					{						NodeInst ni = it.next();						if (connectAllComponents || ni.getName().equalsIgnoreCase(key)) { found = ni;   break; }					}					if (found == null)					{						reportError("Unknown component '" + key + "'");						return true;					}					// get the port name					key = mustGetKeyword("NET");					if (key == null) return true;					PortProto pp = found.getProto().findPortProto(key);					if (pp == null)					{						reportError("Unknown port '" + key + "' on component " + found);						return true;					}					if (connectAllComponents) wildcardPort = key;					pi = found.findPortInstFromProto(pp);				}				// get the close parentheses				key = mustGetKeyword("NET");				if (key == null) return true;				if (!key.equals(")"))				{					reportError("Expected ')' of pin pair");					return true;				}				if (IOTool.isDEFLogicalPlacement())				{					if (connectAllComponents)					{						// must connect all components in netlist						pi = connectGlobal(cell, wildcardPort);						if (pi == null) return true;					} else					{						if (lastLogPi != null)						{							ArcInst ai = ArcInst.makeInstance(Generic.tech().unrouted_arc, pi, lastLogPi);							if (ai == null)							{								reportError("Could not create unrouted arc");								return true;							}						}					}				}				lastLogPi = pi;				// get the next keyword and continue parsing				key = mustGetKeyword("NET");				if (key == null) return true;				continue;			}			// handle "new" start of coordinate trace			if (key.equalsIgnoreCase("NEW"))			{				// Connect last created segment to logical network				if (lastLogPi != null && lastPi != null && IOTool.isDEFLogicalPlacement())				{					// connect logical network and physical network so that DRC passes					ArcInst ai = ArcInst.makeInstance(Generic.tech().unrouted_arc, lastPi, lastLogPi);					if (ai == null)					{						reportError("Could not create unrouted arc");						return true;					}				}				key = mustGetKeyword("NET");				if (key == null) return true;				li = getLayerInformation(key);				if (li.pin == null)				{					reportError("Unknown layer (" + key + ")");					return true;				}				pathStart = true;				key = mustGetKeyword("NET");				if (key == null) return true;				if (special)				{					// specialnets have width here					specialWidth = convertDEFString(key);					// get the next keyword					key = mustGetKeyword("NET");					if (key == null) return true;				}				continue;			}			if (!stackedViaFlag) foundCoord = false;			if (key.equals("("))			{				// get the X coordinate				foundCoord = true;				key = mustGetKeyword("NET");				if (key == null) return true;				if (key.equals("*")) curX = lastX; else				{					curX = convertDEFString(key);				}				// get the Y coordinate				key = mustGetKeyword("NET");				if (key == null) return true;				if (key.equals("*")) curY = lastY; else				{					curY = convertDEFString(key);				}				// get the close parentheses				key = mustGetKeyword("NET");				if (key == null) return true;				if (!key.equals(")"))				{					reportError("Expected ')' of coordinate pair");					return true;				}			}			/*			 * if stackedViaFlag is set, then we have already fetched			 * this Via key word, so don't fetch next keyword			 */			if (!stackedViaFlag)			{				// get the next keyword				key = mustGetKeyword("NET");				if (key == null) return true;			}			// see if it is a via name			ViaDef vd = checkForVia(key);			// stop now if not placing physical nets			if (!IOTool.isDEFPhysicalPlacement() || schImport)			{				// ignore the next keyword if a via name is coming				if (vd != null)				{					key = mustGetKeyword("NET");					if (key == null) return true;				}				continue;			}			// if a via is mentioned next, use it			PortInst pi = null;			boolean placedVia = false;			if (vd != null)			{				// place the via at this location				double sX = vd.sX;				double sY = vd.sY;				if (vd.via == null)				{					reportError("Cannot to create via");					return true;				}				// see if there is a connection point here when starting a path				if (pathStart)				{					lastPi = findConnection(curX, curY, li.arc, cell, null);				}				// create the via				SizeOffset so = vd.via.getProtoSizeOffset();				sX += so.getLowXOffset() + so.getHighXOffset();				sY += so.getLowYOffset() + so.getHighYOffset();				NodeInst ni = NodeInst.makeInstance(vd.via, new Point2D.Double(curX, curY), sX, sY, cell);				if (ni == null)				{					reportError("Unable to create via layer");					return true;				}				pi = ni.getOnlyPortInst();				// if the path starts with a via, wire it				if (pathStart && lastPi != null && foundCoord)				{					double width = li.arc.getDefaultLambdaBaseWidth();					if (special) width = specialWidth; else					{						// get the width from the LEF file						Double wid = widthsFromLEF.get(li.arc);						if (wid != null) width = wid.doubleValue();					}					ArcInst ai = ArcInst.makeInstanceBase(li.arc, width, lastPi, pi);					if (ai == null)					{						reportError("Unable to create net starting point");						return true;					}				}				// remember that a via was placed				placedVia = true;				// get the next keyword				key = mustGetKeyword("NET");				if (key == null) return true;				// check if next key is yet another via				ViaDef vdStack = checkForVia(key) ;				if (vdStack == null) stackedViaFlag = false;				else stackedViaFlag = true;			} else			{				// no via mentioned: just make a pin				// this pin center will have to be adjusted if special! RBR				pi = getPin(curX, curY, li.arc, cell);				if (pi == null) return true;				adjustPinLocPi = true;			}			if (!foundCoord) continue;			// run the wire			if (!pathStart)			{				// make sure that this arc can connect to the current pin				if (!pi.getPortProto().connectsTo(li.arc))				{					NodeProto np = li.arc.findPinProto();					double sX = np.getDefWidth();					double sY = np.getDefHeight();					NodeInst ni = NodeInst.makeInstance(np, new Point2D.Double(curX, curY), sX, sY, cell);					if (ni == null)					{						reportError("Unable to create net pin");						return true;					}					pi = ni.getOnlyPortInst();				}				// run the wire				double width = li.arc.getDefaultLambdaBaseWidth();				if (special) width = specialWidth; else				{					// get the width from the LEF file					Double wid = widthsFromLEF.get(li.arc);					if (wid != null) width = wid.doubleValue();				}				if (adjustPinLocLastPi && special)				{					// starting pin; have to adjust the last pin location					double dX = 0;					double dY = 0;					if (curX != lastX)					{						//horizontal route						dX = width/2;  // default, adjust left						if (curX < lastX)						{							dX = -dX; // route runs right to left, adjust right						}					}					if (curY != lastY)					{						// vertical route						dY = width/2; // default, adjust up						if (curY < lastY)						{							dY = -dY; // route runs top to bottom, adjust down						}					}					lastPi.getNodeInst().move(dX,dY);					adjustPinLocLastPi = false;				}				/* note that this adjust is opposite of previous since				 * this pin is on the end of the wire instead of the beginning				 */				if (adjustPinLocPi && special)				{					// ending pin; have to adjust the last pin location					double dX = 0;					double dY = 0;					if (curX != lastX)					{						// horizontal route						dX = -width/2;  // default, adjust right						if (curX < lastX)						{							dX = -dX; // route runs right to left, adjust left						}					}					if (curY != lastY)					{						// vertical route						dY = -width/2; // default, adjust down						if (curY < lastY)						{							dY = -dY; //route runs top to bottom, adjust up						}					}					pi.getNodeInst().move(dX,dY);					adjustPinLocPi = false;				}				ArcInst ai = ArcInst.makeInstanceBase(li.arc, width, lastPi, pi);				if (ai == null)				{					reportError("Unable to create net path");					return true;				}			}			lastX = curX;   lastY = curY;			pathStart = false;			lastPi = pi;			adjustPinLocLastPi=adjustPinLocPi;			adjustPinLocPi = false;			// switch layers to the other one supported by the via			ArcProto liArc = li.arc;			if (placedVia)			{				if (liArc == vd.lay1)				{					liArc = vd.lay2;				} else if (liArc == vd.lay2)				{					liArc = vd.lay1;				}				li.pin = liArc.findPinProto();			}			// if the path ends here, connect it			if (key.equalsIgnoreCase("NEW") || key.equals(";"))			{				// see if there is a connection point here when starting a path				PortInst nextPi = findConnection(curX, curY, liArc, cell, pi.getNodeInst());				// if the path starts with a via, wire it				if (nextPi != null)				{					double width = liArc.getDefaultLambdaBaseWidth();					if (special) width = specialWidth; else					{						// get the width from the LEF file						Double wid = widthsFromLEF.get(liArc);						if (wid != null) width = wid.doubleValue();					}					ArcInst ai = ArcInst.makeInstanceBase(liArc, width, pi, nextPi);					if (ai == null)					{						reportError("Unable to create net ending point");						return true;					}				}			}		}		return false;	}	/*************** VIAS ***************/	private boolean readVias(Cell cell)		throws IOException	{		if (ignoreToSemicolon("VIAS")) return true;		for(;;)		{			// get the next keyword			String key = mustGetKeyword("VIAs");			if (key == null) return true;			if (key.equals("-"))			{				if (readVia()) return true;				continue;			}			if (key.equalsIgnoreCase("END"))			{				key = getAKeyword();				break;			}			// ignore the keyword			if (ignoreToSemicolon(key)) return true;		}		return false;	}	private boolean readVia()		throws IOException	{		if (schImport)		{			ignoreToSemicolon("VIA");			return false;		}		// get the via name		String key = mustGetKeyword("VIA");		if (key == null) return true;		// create a new via definition		ViaDef vd = new ViaDef();		vd.viaName = key;		vd.sX = vd.sY = 0;		vd.via = null;		vd.lay1 = vd.lay2 = null;		vd.nextViaDef = firstViaDef;		firstViaDef = vd;		for(;;)		{			// get the next keyword			key = mustGetKeyword("VIA");			if (key == null) return true;			if (key.equals("+"))			{				key = mustGetKeyword("VIA");				if (key == null) return true;				if (key.equalsIgnoreCase("RECT"))				{					// handle definition of a via rectangle					key = mustGetKeyword("VIA");					if (key == null) return true;					GetLayerInformation li = getLayerInformation(key);					if (li.pure == null)					{						reportError("Layer " + key + " not in current technology");					}					if (key.startsWith("VIA"))					{						if (li.pin == null) li.pin = Generic.tech().universalPinNode;						vd.via = li.pin;					}					if (key.startsWith("METAL"))					{						if (li.arc == null) li.arc = Generic.tech().universal_arc;						if (vd.lay1 == null) vd.lay1 = li.arc; else							vd.lay2 = li.arc;					}					Point2D ll = readCoordinate();					if (ll == null) return true;					Point2D ur = readCoordinate();					if (ur == null) return true;					// accumulate largest contact size					if (ur.getX()-ll.getX() > vd.sX) vd.sX = ur.getX() - ll.getX();					if (ur.getY()-ll.getY() > vd.sY) vd.sY = ur.getY() - ll.getY();					continue;				}				continue;			}			if (key.equals(";")) break;		}		if (vd.via != null)		{			if (vd.sX == 0) vd.sX = vd.via.getDefWidth();			if (vd.sY == 0) vd.sY = vd.via.getDefHeight();		}		return false;	}	/*************** PROPERTY DEFINITIONS ***************/	private boolean readPropertyDefinitions()		throws IOException	{		for(;;)		{			// get the next keyword			String key = mustGetKeyword("PROPERTYDEFINITION");			if (key == null) return true;			if (key.equalsIgnoreCase("END"))			{				key = getAKeyword();				break;			}			// ignore the keyword			if (ignoreToSemicolon(key)) return true;		}		return false;	}	/*************** UNITS ***************/	private boolean readUnits()		throws IOException	{		// get the "DISTANCE" keyword		String key = mustGetKeyword("UNITS");		if (key == null) return true;		if (!key.equalsIgnoreCase("DISTANCE"))		{			reportError("Expected 'DISTANCE' after 'UNITS'");			return true;		}		// get the "MICRONS" keyword		key = mustGetKeyword("UNITS");		if (key == null) return true;		if (!key.equalsIgnoreCase("MICRONS"))		{			reportError("Expected 'MICRONS' after 'UNITS'");			return true;		}		// get the amount		key = mustGetKeyword("UNITS");		if (key == null) return true;		scaleUnits = TextUtils.atof(key) * OVERALLSCALE;		// ignore the keyword		if (ignoreToSemicolon("UNITS")) return true;		return false;	}}

⌨️ 快捷键说明

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