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

📄 padgenerator.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
	 * Process the rotate keyword	 * @return true on success, false on error.	 */	private boolean processRotate(StringTokenizer str)	{		String keyWord;		int angle = 0;		if (str.hasMoreTokens())		{			keyWord = str.nextToken();			if (keyWord.equals("c"))			{				angle = 2700;			} else if (keyWord.equals("cc"))			{				angle = 900;			} else			{				System.out.println("Line " + lineno + ": incorrect rotation " + keyWord);				return false;			}			Rotation rot = new Rotation();			rot.angle = angle;			orderedCommands.add(rot);			return true;		}		return false;	}	private boolean processReverse(StringTokenizer str)	{		orderedCommands.add(new ReverseDirection());		return true;	}	/**	 * Process the align keyword	 * @return true on success, false on error.	 */	private boolean processAlign(StringTokenizer str)	{		String keyWord;		ArrayAlign aa = new ArrayAlign();		aa.lineno = lineno;		keyWord = str.nextToken();		if (keyWord.equals(""))		{			System.out.println("Line " + lineno + ": missing 'cell' name");			return false;		}		aa.cellname = keyWord;		keyWord = str.nextToken();		if (keyWord.equals(""))		{			System.out.println("Line " + lineno + ": missing 'in port' name");			return false;		}		aa.inport = keyWord;		keyWord = str.nextToken();		if (keyWord.equals(""))		{			System.out.println("Line " + lineno + ": missing 'out port' name");			return false;		}		aa.outport = keyWord;		alignments.put(aa.cellname, aa);		return true;	}	/**	 * Process the export keyword	 * @return true on success, false on error.	 */	private boolean processExport(StringTokenizer str)	{		String keyWord;		PadExports pe = new PadExports();		pe.lineno = lineno;		pe.padname = null;		pe.corename = null;		keyWord = str.nextToken();		if (keyWord.equals(""))		{			System.out.println("Line " + lineno + ": missing 'cell' name");			return false;		}		pe.cellname = keyWord;		if (str.hasMoreTokens())		{			keyWord = str.nextToken();			pe.padname = keyWord;			if (str.hasMoreTokens())			{				keyWord = str.nextToken();				pe.corename = keyWord;			}		}		exports.put(pe.cellname, pe);		return true;	}	private boolean processPlace(StringTokenizer str)	{		PlacePad pad = new PlacePad();		pad.lineno = lineno;		pad.exportsname = null;		pad.gap = 0;		pad.ni = null;		pad.associations = new ArrayList<PortAssociate>();		pad.exportAssociations = new ArrayList<ExportAssociate>();		pad.locx = null;		pad.locy = null;		if (!str.hasMoreTokens())		{			err("Cell name missing");			return false;		}		pad.cellname = str.nextToken();		while (str.hasMoreTokens())		{			String keyWord = str.nextToken();			if (keyWord.equals("export"))			{				// export xxx=xxxx				if (!str.hasMoreTokens())				{					err("Missing export assignment after 'export' keyword");					return false;				}				keyWord = str.nextToken();				ExportAssociate ea = new ExportAssociate();				ea.padportName = getLHS(keyWord);				if (ea.padportName == null)				{					err("Bad export assignment after 'export' keyword");					return false;				}				ea.exportName = getRHS(keyWord, str);				if (ea.exportName == null)				{					err("Bad export assignment after 'export' keyword");					return false;				}				pad.exportAssociations.add(ea);			} else			{				// name=xxxx or gap=xxxx				String lhs = getLHS(keyWord);				String rhs = getRHS(keyWord, str);				if (lhs == null || rhs == null)				{					err("Parse error on assignment of " + keyWord);					return false;				}				if (lhs.equals("gap"))				{					try					{						pad.gap = Integer.parseInt(rhs);					} catch (java.lang.NumberFormatException e)					{						err("Error parsing integer for 'gap' = " + rhs);						return false;					}				} else if (lhs.equals("name"))				{					pad.exportsname = rhs;				} else if (lhs.equals("x"))				{					try					{						pad.locx = new Double(rhs);					} catch (NumberFormatException e)					{						System.out.println(e.getMessage());						pad.locx = null;					}				} else if (lhs.equals("y"))				{					try					{						pad.locy = new Double(rhs);					} catch (NumberFormatException e)					{						System.out.println(e.getMessage());						pad.locy = null;					}				} else				{					// port association					PortAssociate pa = new PortAssociate();					pa.export = false;					pa.portname = lhs;					pa.assocname = rhs;					pad.associations.add(pa);				}			}		}		orderedCommands.add(pad);		return true;	}	private String getLHS(String keyword)	{		if (keyword.indexOf("=") != -1)		{			return keyword.substring(0, keyword.indexOf("="));		}		return keyword;	}	private String getRHS(String keyword, StringTokenizer str)	{		if (keyword.indexOf("=") != -1)		{			if (keyword.substring(keyword.indexOf("=") + 1).equals(""))			{				// LHS= RHS				if (!str.hasMoreTokens()) return null;				return str.nextToken();			}			// LHS=RHS			return keyword.substring(keyword.indexOf("=") + 1);		}		if (!str.hasMoreTokens()) return null;		keyword = str.nextToken();		if (keyword.equals("="))		{			// LHS = RHS			if (!str.hasMoreTokens()) return null;			return str.nextToken();		}		// LHS =RHS		return keyword.substring(keyword.indexOf("=") + 1);	}	/**	 * Print the error message with the current line number.	 * @param msg	 */	private void err(String msg)	{		System.out.println("Line " + lineno + ": " + msg);	}	private Cell createPadFrames(Job job)	{		Cell frameCell = null;		if (views.size() == 0)		{			frameCell = createPadFrame(padframename, View.LAYOUT, job);		} else		{			for (View view : views)			{				if (view == View.SCHEMATIC) view = View.ICON;				frameCell = createPadFrame(padframename, view, job);			}		}		return frameCell;	}	private Cell createPadFrame(String name, View view, Job job)	{		angle = 0;		// first, try to create cell		CellName n = CellName.parseName(name);		if (n != null && (n.getView() == null || n.getView() == View.UNKNOWN))		{			// no view in cell name, append appropriately			if (view == null)			{				name = name + "{lay}";			} else			{				if (view == View.ICON)				{					// create a schematic, place icons of pads in it					name = name + "{sch}";				} else				{					name = name + "{" + view.getAbbreviation() + "}";				}			}		}		Cell framecell = Cell.makeInstance(destLib, name);		if (framecell == null)		{			System.out.println("Could not create pad frame Cell: " + name);			return null;		}		List<Export> padPorts = new ArrayList<Export>();		List<Export> corePorts = new ArrayList<Export>();		NodeInst lastni = null;		int lastRotate = 0;		String lastpadname = null;		boolean reversed = false;		// cycle through all orderedCommands, doing them		for (Object obj : orderedCommands)		{			// Rotation commands are ordered with respect to Place commands.			if (obj instanceof Rotation)			{				angle = (angle + ((Rotation) obj).angle) % 3600;				continue;			}			if (obj instanceof ReverseDirection)			{				reversed = !reversed;				continue;			}			// otherwise this is a Place command			PlacePad pad = (PlacePad) obj;			lineno = pad.lineno;			// get cell			String cellname = pad.cellname;			if (!cellname.endsWith("}"))			{				if (view != null) cellname = cellname + "{" + view.getAbbreviation() + "}";			}			Cell cell = cellLib.findNodeProto(cellname);			if (cell == null)			{				err("Could not create pad Cell: " + cellname);				continue;			}			// if copying cell, copy it into current library			if (copycells)			{				Cell existing = cell;				cell = null;				for(Iterator<Cell> cIt = destLib.getCells(); cIt.hasNext(); )				{					Cell thereCell = cIt.next();					if (thereCell.getName().equals(existing.getName()) && thereCell.getView() == existing.getView())					{						cell = thereCell;						break;					}				}				if (cell == null)				{					List<Cell> fromCells = new ArrayList<Cell>();					fromCells.add(existing);					CellChangeJobs.copyRecursively(fromCells, destLib, false, false, false, true, true);					for(Iterator<Cell> cIt = destLib.getCells(); cIt.hasNext(); )					{						Cell thereCell = cIt.next();						if (thereCell.getName().equals(existing.getName()) && thereCell.getView() == existing.getView())						{							cell = thereCell;							break;						}					}					if (cell == null)					{						err("Could not copy in pad Cell " + cellname);						continue;					}				}			}			// get array alignment for this cell			ArrayAlign aa = alignments.get(pad.cellname);			if (aa == null)			{				err("No port alignment for cell " + pad.cellname);				continue;			}			int gapx = 0, gapy = 0;			double centerX = 0, centerY = 0;			if (lastni != null)			{				// get info on last nodeinst created				ArrayAlign lastaa = alignments.get(lastpadname);				// get previous node's outport - use it to place this nodeinst

⌨️ 快捷键说明

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