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

📄 cif.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
			{				if (temp.xCoord) currentCTrans.type = MIRX; else					currentCTrans.type = MIRY;			} else if (temp.kind == TRANSLATE)			{				currentCTrans.type = TRANS;				currentCTrans.x = temp.xt;				currentCTrans.y = temp.yt;			} else if (temp.kind == ROTATE)			{				currentCTrans.type = ROT;				currentCTrans.x = temp.xRot;				currentCTrans.y = temp.yRot;			}		}	}	private BackCIFTransform newBackCIFTransform()	{		BackCIFTransform newCT = new BackCIFTransform();		newCT.next = null;		BackCIFCall cc = (BackCIFCall)currentFrontElement.member;		if (cc.list == null) cc.list = newCT; else			currentCTrans.next = newCT;		currentCTrans = newCT;		return newCT;	}	private void dumpDefinition(FrontSymbol sym)	{		if (sym.dumped) return;		// already done		if (sym.numCalls > 0)			// dump all children		{			int count = sym.numCalls;			FrontObjBase ro = sym.guts;			while (ro != null && count > 0)			{				if (ro instanceof FrontCall)				{					dumpDefinition(((FrontCall)ro).unID);					count--;				}				ro = ro.next;			}		}		shipContents(sym);		sym.dumped = true;	}	private void shipContents(FrontSymbol sym)	{		FrontObjBase ro = sym.guts;		outputDefinitionStart(sym.symNumber, sym.name, sym.bounds.l, sym.bounds.r, sym.bounds.b, sym.bounds.t);		while (ro != null)		{			if (ro instanceof FrontPoly)			{				FrontPoly po = (FrontPoly)ro;				FrontPath pPath = new FrontPath();				for (int i = 0; i < po.points.length; i++)					appendPoint(pPath, po.points[i]);				outputPolygon(po.layer, pPath);			} else if (ro instanceof FrontWire)			{				FrontWire wi = (FrontWire)ro;				FrontPath pPath = new FrontPath();				for (int i = 0; i < wi.points.length; i++)					appendPoint(pPath, wi.points[i]);				outputWire(wi.layer, wi.width, pPath);			} else if (ro instanceof FrontFlash)			{				FrontFlash fl = (FrontFlash)ro;				outputFlash(fl.layer, fl.diameter, fl.center);			} else if (ro instanceof FrontBox)			{				FrontBox bo = (FrontBox)ro;				outputBox(bo.layer, bo.length, bo.width, bo.center, bo.xRot, bo.yRot);			} else if (ro instanceof FrontManBox)			{				FrontManBox mb = (FrontManBox)ro;				Point temp = new Point();				temp.x = (((FrontManBox)ro).bb.r + ((FrontManBox) ro).bb.l)/2;				temp.y = (((FrontManBox)ro).bb.t + ((FrontManBox) ro).bb.b)/2;				outputBox(mb.layer, mb.bb.r-mb.bb.l, mb.bb.t-mb.bb.b, temp, 1, 0);			} else if (ro instanceof FrontCall)			{				FrontCall sc = (FrontCall)ro;				FrontTransformList tList = new FrontTransformList();				dupTransformList(sc.transList, tList);				outputCall(sc.symNumber, sc.unID.name, tList);			} else if (ro instanceof FrontGeomName)			{				FrontGeomName gn = (FrontGeomName)ro;				outputGeomName(gn.layer);			} else if (ro instanceof FrontLabel)			{				FrontLabel la = (FrontLabel)ro;				outputLabel(la.name, la.pos);			}			ro = ro.next;		}		outputDefinitionEnd();	}	private void outputDefinitionEnd()	{		placeCIFList(CEND);	}	private void outputDefinitionStart(int number, String name, int l, int r, int b, int t)	{		placeCIFList(CSTART);		BackCIFStart cs = (BackCIFStart)currentFrontElement.member;		cs.cIndex = number;		cs.name = name;		cs.l = l;   cs.r = r;		cs.b = b;   cs.t = t;	}	private void dupTransformList(FrontTransformList src, FrontTransformList dest)	{		if (src == null || dest == null) return;		FrontLinkedTransform node = src.tFirst;		while (node != null)		{			appendTransformEntry(dest, node.tValue);			node = node.tNext;		}	}	private void outputBox(Layer lay, int length, int width, Point center, int xRotation, int yRotation)	{		if (length == 0 && width == 0) return;	// ignore null boxes		placeCIFList(CBOX);		BackCIFBox cb = (BackCIFBox)currentFrontElement.member;		cb.lay = lay;		cb.length = length;	cb.width = width;		cb.cenX = center.x;	cb.cenY = center.y;		cb.xRot = xRotation;	cb.yRot = yRotation;	}	private void placeCIFList(int id)	{		BackCIFList cl = newBackCIFList(id);		if (cl == null) return;		if (currentFrontList == null) currentFrontList = currentFrontElement = cl; else		{			while(currentFrontElement.next != null)				currentFrontElement = currentFrontElement.next;			currentFrontElement.next = cl;			currentFrontElement = currentFrontElement.next;		}	}	private BackCIFList newBackCIFList(int id)	{		BackCIFList newCL = new BackCIFList();		newCL.next = null;		newCL.identity = id;		switch (id)		{			case CSTART:				BackCIFStart cs = new BackCIFStart();				newCL.member = cs;				cs.name = null;				break;			case CBOX:				newCL.member = new BackCIFBox();				break;			case CPOLY:				newCL.member = new BackCIFPoly();				break;			case CGNAME:				newCL.member = new BackCIFGeomName();				break;			case CLABEL:				newCL.member = new BackCIFLabel();				break;			case CCALL:				BackCIFCall cc = new BackCIFCall();				newCL.member = cc;				cc.name = null;				break;		}		return newCL;	}	private void outputFlash(Layer lay, int diameter, Point center)	{		// flash approximated by an octagon		int radius = diameter/2;		double fCX = center.x;		double fCY = center.y;		double offset = ((diameter)/2.0f)*0.414213f;		FrontPath fpath = new FrontPath();		Point temp = new Point();		temp.x = center.x-radius;		temp.y = (int)(fCY+offset);		appendPoint(fpath, temp);		temp.y = (int)(fCY-offset);		appendPoint(fpath, temp);		temp.x = (int)(fCX-offset);		temp.y = center.y-radius;		appendPoint(fpath, temp);		temp.x = (int)(fCX+offset);		appendPoint(fpath, temp);		temp.x = center.x+radius;		temp.y = (int)(fCY-offset);		appendPoint(fpath, temp);		temp.y = (int)(fCY+offset);		appendPoint(fpath, temp);		temp.x = (int)(fCX+offset);		temp.y = center.y+radius;		appendPoint(fpath, temp);		temp.x = (int)(fCX-offset);		appendPoint(fpath, temp);		outputPolygon(lay, fpath);	}	/**	 * convert wires to boxes and flashes	 */	private void outputWire(Layer lay, int width, FrontPath wpath)	{		int lim = wpath.pLength;		Point prev = removePoint(wpath);		// do not use roundflashes with zero-width wires		if (width != 0 && !IOTool.isCIFInSquaresWires())		{			boundsFlash(width, prev);			outputFlash(lay, width, prev);		}		for (int i = 1; i < lim; i++)		{			Point curr = removePoint(wpath);			// do not use roundflashes with zero-width wires			if (width != 0 && !IOTool.isCIFInSquaresWires())			{				boundsFlash(width, curr);				outputFlash(lay, width, curr);			}			int xr = curr.x-prev.x;			int yr = curr.y-prev.y;			int len = (int)new Point2D.Double(0, 0).distance(new Point2D.Double(xr, yr));			if (IOTool.isCIFInSquaresWires()) len += width;			Point center = new Point((curr.x+prev.x)/2, (curr.y+prev.y)/2);			boundsBox(len, width, center, xr, yr);			outputBox(lay, len, width, center, xr, yr);			prev = curr;		}	}	private boolean isEndSeen()	{		return endCommandFound;	}	private void initInput()	{		charactersRead = 0;		resetInputBuffer = true;	}	private void initErrors()	{		numFatalErrors = 0;	}	private void initUtilities()	{		minMaxStackLeft = new int[MAXMMSTACK];		minMaxStackRight = new int[MAXMMSTACK];		minMaxStackBottom = new int[MAXMMSTACK];		minMaxStackTop = new int[MAXMMSTACK];		symbolTable = new HashMap<Integer,FrontSymbol>();		minMaxStackPtr = -1;			// minmax stack pointer	}	private void initMatrices()	{		matrixStackTop = new FrontMatrix();		clearMatrix(matrixStackTop);		matrixStackTop.next = null;		matrixStackTop.prev = null;		matrixStackTop.multiplied = true;	}	private void clearMatrix(FrontMatrix mat)	{		mat.a11 = 1.0;   mat.a12 = 0.0;		mat.a21 = 0.0;   mat.a22 = 1.0;		mat.a31 = 0.0;   mat.a32 = 0.0;   mat.a33 = 1.0;		mat.type = TIDENT;   mat.multiplied = false;	}	private void inFromFile()	{		try		{			nextInputCharacter = lineReader.read();			updateProgressDialog(1);		} catch (IOException e)		{			nextInputCharacter = -1;		}	}	private char getNextCharacter()	{		if (resetInputBuffer)		{			resetInputBuffer = false;			inputBuffer = new StringBuffer();			charactersRead = 0;		}		int c = nextInputCharacter;		if (c >= 0)		{			if (c != '\n')			{				charactersRead++;				inputBuffer.append((char)c);			} else resetInputBuffer = true;			try			{				nextInputCharacter = lineReader.read();				updateProgressDialog(1);			} catch (IOException e)			{				nextInputCharacter = -1;			}		}		return (char)c;	}	private char peekNextCharacter()	{		return (char)nextInputCharacter;	}	private boolean atEndOfFile()	{		return nextInputCharacter < 0;	}	private int flushInput(char breakchar)	{		int c;		while ((c = peekNextCharacter()) >= 0 && c != breakchar) getNextCharacter();		return c;	}	private void skipBlanks()	{		for(;;)		{			if (atEndOfFile()) break;			int c = peekNextCharacter();			if (TextUtils.isDigit((char)c) || Character.isUpperCase((char)c)) break;			if (c == '(' || c == ')' || c == ';' || c == '-') break;			getNextCharacter();		}	}	private int parseStatement()	{		if (atEndOfFile()) return ENDFILE;		skipBlanks();		// flush initial junk		int curChar = getNextCharacter();		int command = 0;		int xRotate=0, yRotate=0, length=0, width=0, diameter=0, symbolNumber=0, multiplier=0, divisor=0, userCommand=0;		Point center = null, namePoint = null;		FrontTransformList curTList = null;		FrontPath curPath = null;		String lName = null, nameText = null, userText = null;		switch (curChar)		{			case 'P':				command = POLYCOM;				curPath = new FrontPath();				getPath(curPath); if (errorFound) return reportError();				break;			case 'B':				command = BOXCOM;				xRotate = 1; yRotate = 0;				length = getNumber(); if (errorFound) return reportError();				width = getNumber(); if (errorFound) return reportError();				center = getPoint(); if (errorFound) return reportError();				skipSeparators();				if (((curChar = peekNextCharacter()) >= '0' && curChar <= '9') || curChar == '-')				{					xRotate = getSignedInteger(); if (errorFound) return reportError();					yRotate = getSignedInteger(); if (errorFound) return reportError();				}				break;			case 'R':				command = FLASHCOM;				diameter = getNumber(); if (errorFound) return reportError();				center = getPoint(); if (errorFound) return reportError();				break;			case 'W':				command = WIRECOM;				width = getNumber(); if (errorFound) return reportError();				curPath = new FrontPath();				getPath(curPath); if (errorFound) return reportError();				break;			case 'L':				command = LAYER;				skipBlanks();				StringBuffer layerName = new StringBuffer();				for (int i = 0; i<4; i++)				{					int chr = peekNextCharacter();					if (!Character.isUpperCase((char)chr) && !TextUtils.isDigit((char)chr)) break;					layerName.append(getNextCharacter());				}				if (layerName.length() == 0) {errorFound = true; errorType = NOLAYER; return reportError();}				lName = layerName.toString();				break;			case 'D':				skipBlanks();				switch (getNextCharacter())				{					case 'S':						command = DEFSTART;						symbolNumber = getNumber(); if (errorFound) return reportError();						skipSeparators(); multiplier = divisor = 1;						if (TextUtils.isDigit(peekNextCharacter()))						{							multiplier = getNumber(); if (errorFound) return reportError();							divisor = getNumber(); if (errorFound) return reportError();						}						if (isInCellDefinition)						{							errorFound = true;							errorType = NESTDEF;							return reportError();						}						isInCellDefinition = true;						break;					case 'F':						command = DEFEND;						if (!isInCellDefinition)						{							errorFound = true;							errorType = NODEFSTART;							return reportError();						}						isInCellDefinition = false;						break;					case 'D':						command = DELETEDEF;						symbolNumber = getNumber(); if (errorFound) return reportError();						if (isInCellDefinition)						{							errorFound = true;							errorType = NESTDD;							return reportError();						}						break;					default:						errorFound = true;						errorType = BADDEF;						return reportError();				}				break;			case 'C':				command = CALLCOM;				symbolNumber = getNumber(); if (errorFound) return reportError();				skipBlanks();				curTList = new FrontTransformList();				for(;;)				{					FrontTransformEntry trans = new FrontTransformEntry();					int val = peekNextCharacter();					if (val == ';') break;

⌨️ 快捷键说明

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