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

📄 pla.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
			gbc.anchor = GridBagConstraints.WEST;			gbc.insets = new java.awt.Insets(4, 4, 4, 4);			getContentPane().add(andPlaneFile, gbc);			JButton andPlaneBrowse = new JButton("Browse");			gbc = new GridBagConstraints();			gbc.gridx = 2;    gbc.gridy = 0;			gbc.insets = new java.awt.Insets(4, 4, 4, 4);			getContentPane().add(andPlaneBrowse, gbc);			andPlaneBrowse.addActionListener(new ActionListener()			{				public void actionPerformed(ActionEvent evt) { browse(true); }			});			// the OR plane			JLabel lab2 = new JLabel("OR Plane File:");			gbc = new GridBagConstraints();			gbc.gridx = 0;   gbc.gridy = 1;			gbc.anchor = GridBagConstraints.WEST;			gbc.insets = new java.awt.Insets(4, 4, 4, 4);			getContentPane().add(lab2, gbc);			orPlaneFile = new JTextField();			orPlaneFile.setColumns(35);			gbc = new GridBagConstraints();			gbc.gridx = 1;   gbc.gridy = 1;			gbc.weightx = 1;   gbc.weighty = 0.5;			gbc.fill = GridBagConstraints.BOTH;			gbc.anchor = GridBagConstraints.WEST;			gbc.insets = new java.awt.Insets(4, 4, 4, 4);			getContentPane().add(orPlaneFile, gbc);			JButton orPlaneBrowse = new JButton("Browse");			gbc = new GridBagConstraints();			gbc.gridx = 2;    gbc.gridy = 1;			gbc.insets = new java.awt.Insets(4, 4, 4, 4);			getContentPane().add(orPlaneBrowse, gbc);			orPlaneBrowse.addActionListener(new ActionListener()			{				public void actionPerformed(ActionEvent evt) { browse(false); }			});			// other questions			inputs = new JCheckBox("Input to the Top of the AND plane");			inputs.setSelected(true);			gbc = new GridBagConstraints();			gbc.gridx = 0;   gbc.gridy = 2;			gbc.gridwidth = 3;			gbc.anchor = GridBagConstraints.WEST;			gbc.insets = new java.awt.Insets(4, 4, 4, 4);			getContentPane().add(inputs, gbc);			outputs = new JCheckBox("Outputs from the Bottom of the OR plane");			outputs.setSelected(true);			gbc = new GridBagConstraints();			gbc.gridx = 0;   gbc.gridy = 3;			gbc.gridwidth = 3;			gbc.anchor = GridBagConstraints.WEST;			gbc.insets = new java.awt.Insets(4, 4, 4, 4);			getContentPane().add(outputs, gbc);			JLabel lab3 = new JLabel("Cell name:");			gbc = new GridBagConstraints();			gbc.gridx = 0;   gbc.gridy = 4;			gbc.anchor = GridBagConstraints.WEST;			gbc.insets = new java.awt.Insets(4, 4, 4, 4);			getContentPane().add(lab3, gbc);			cellName = new JTextField();			cellName.setText("pla");			gbc = new GridBagConstraints();			gbc.gridx = 1;   gbc.gridy = 4;			gbc.fill = GridBagConstraints.HORIZONTAL;			gbc.anchor = GridBagConstraints.WEST;			gbc.insets = new java.awt.Insets(4, 4, 4, 4);			getContentPane().add(cellName, gbc);			// OK and Cancel			JButton cancel = new JButton("Cancel");			gbc = new GridBagConstraints();			gbc.gridx = 0;   gbc.gridy = 5;			gbc.anchor = GridBagConstraints.CENTER;			gbc.insets = new java.awt.Insets(4, 4, 4, 4);			getContentPane().add(cancel, gbc);			cancel.addActionListener(new ActionListener()			{				public void actionPerformed(ActionEvent evt) { exit(false); }			});			JButton ok = new JButton("OK");			getRootPane().setDefaultButton(ok);			gbc = new java.awt.GridBagConstraints();			gbc.gridx = 1;   gbc.gridy = 5;			gbc.gridwidth = 2;			gbc.anchor = GridBagConstraints.CENTER;			gbc.insets = new java.awt.Insets(4, 4, 4, 4);			getContentPane().add(ok, gbc);			ok.addActionListener(new java.awt.event.ActionListener()			{				public void actionPerformed(java.awt.event.ActionEvent evt) { exit(true); }			});			pack();		}	}	/**	 * Plus Output options eg. column decode etc.	 */	private Cell makeOrPlane(Library library, String cellName, boolean outputsOnBottom)	{		Cell cell = Cell.makeInstance(library, cellName);		NodeInst orNode = makeInstance(cell, orCell, 0, 0, false);		if (orNode == null) return null;		NodeInst newNode = null;		NodeInst lastNode = null;		int columns = 2;		Variable var = orCell.getVar("PLA_data_cols");		if (var != null) columns = ((Integer)var.getObject()).intValue(); else			System.out.println("DATA_cols defaulting to 2");		NodeInst gndNode2 = null, pwrNode1 = null;		char side = 'n';		if (outputsOnBottom) side = 's';		int limit = columns / 4;		Rectangle2D nodeBounds = orNode.getBounds();		double lowX = nodeBounds.getMinX();   double highX = nodeBounds.getMaxX();		double lowY = nodeBounds.getMinY();   double highY = nodeBounds.getMaxY();		Rectangle2D cellBounds = ioInv4.getBounds();		double diff = cellBounds.getHeight();		if (diff < 0) diff = -diff;		if (limit == 0 || (columns % 4) != 0) limit++;		int invCnt = 0;		double invY = highY;		if (outputsOnBottom) invY = lowY - diff;		invY -= 5;		double invXOffset = lowX + 17;		PortProto invPwrW = ioInv4.findExport("PWR.m-2.w");		PortProto invPwrE = ioInv4.findExport("PWR.m-2.e");		PortProto invGnd1W = ioInv4.findExport("GND.m-2.sw");		PortProto invGnd1E = ioInv4.findExport("GND.m-2.se");		PortProto invGnd2W = ioInv4.findExport("GND.m-2.nw");		PortProto invGnd2E = ioInv4.findExport("GND.m-2.ne");		for (int i = 0; i < limit; i++)		{			newNode = makeInstance(cell, ioInv4, i*50 + invXOffset, invY, !outputsOnBottom);			if (newNode == null) return null;			if (lastNode == null)			{				Export.newInstance(cell, newNode.findPortInstFromProto(invPwrW), "PWR.m-2.w");				Export.newInstance(cell, newNode.findPortInstFromProto(invGnd1W), "GND.m-2.w");				// Put in GND bar pin (metal-2)				Poly poly = newNode.findPortInstFromProto(invGnd1W).getPoly();				double pwrY = poly.getCenterY();				NodeInst gndNode1 = makePin(cell, lowX-13, pwrY, 6, m12Con);				if (gndNode1 == null) return null;				makeWire(m2Arc, 14, newNode, invGnd1W, gndNode1, gndNode1.getProto().getPort(0), cell);				poly = newNode.findPortInstFromProto(invGnd2W).getPoly();				pwrY = poly.getCenterY();				gndNode2 = makePin(cell, lowX-13, pwrY, 6, m12Con);				if (gndNode2 == null) return null;				makeWire(m2Arc, 14, newNode, invGnd2W, gndNode2, gndNode2.getProto().getPort(0), cell);				makeWire(m2Arc, 14, gndNode1, gndNode1.getProto().getPort(0), gndNode2,					gndNode2.getProto().getPort(0), cell);			} else			{				// get wired				if (invPwrW != null && invPwrE != null)					makeWire(m2Arc, 14, lastNode, invPwrE, newNode, invPwrW, cell);				if (invGnd1W != null && invGnd1E != null)					makeWire(m2Arc, 14, lastNode, invGnd1E, newNode, invGnd1W, cell);				if (invGnd2W != null && invGnd2E != null)					makeWire(m2Arc, 14, lastNode, invGnd2E, newNode, invGnd2W, cell);			}			lastNode = newNode;			for (int x = invCnt; x < invCnt+4; x++)			{				Export pPort = orCell.findExport("DATA" + x + ".m-1." + side);				Export nPort = ioInv4.findExport("in" + (x%4) + ".m-1.n");				Export outPort = ioInv4.findExport("out" + (x % 4) + "-bar.m-1.s");				if (outPort != null)					Export.newInstance(cell, newNode.findPortInstFromProto(outPort), "out" + (invCnt + (x % 4)) + ".m-1." + side);				if (pPort != null && nPort != null)					makeWire(m1Arc, 4, orNode, pPort, newNode, nPort, cell);			}			invCnt += 4;		}		if (invPwrE != null)		{			Poly poly = lastNode.findPortInstFromProto(invPwrE).getPoly();			double pwrY = poly.getCenterY();			pwrNode1 = makePin(cell, highX+13, pwrY, 14, m2Pin);			if (pwrNode1 == null) return null;			makeWire(m2Arc, 14, lastNode, invPwrE, pwrNode1, pwrNode1.getProto().getPort(0), cell);			Export.newInstance(cell, lastNode.findPortInstFromProto(invPwrE), "PWR.m-2.e");		}		if (invGnd1W != null)			Export.newInstance(cell, lastNode.findPortInstFromProto(invGnd1E), "GND.m-2.e");		// OK PUT in the PULLUPS		newNode = null;		lastNode = null;		side = 's';		if (outputsOnBottom) side = 'n';		Rectangle2D pullUpsBounds = pullUps.getBounds();		double pullUpsDiff = pullUpsBounds.getHeight();		if (pullUpsDiff < 0) pullUpsDiff = -pullUpsDiff;		int pullUpsCnt = 0;		double pullUpsY = highY;		if (!outputsOnBottom) pullUpsY = lowY - pullUpsDiff;		pullUpsY += 16;		double pullUpsXOffset = lowX + 27;		Export pullUpsPwrW = pullUps.findExport("PWR.m-2w");		if (pullUpsPwrW == null)		{			System.out.println("Cannot find port PWR.m-2w in "+pullUps);			return null;		}		Export pullUpsPwrE = pullUps.findExport("PWR.m-2e");		if (pullUpsPwrE == null)		{			System.out.println("Cannot find port PWR.m-2e in "+pullUps);			return null;		}		Export pullUpsGnd1W = pullUps.findExport("GND.m-1.sw");		if (pullUpsGnd1W == null)		{			System.out.println("Cannot find port GND.m-1.sw in "+pullUps);			return null;		}		Export pullUpsGnd1E = pullUps.findExport("GND.m-1.se");		if (pullUpsGnd1E == null)		{			System.out.println("Cannot find port GND.m-1.se in "+pullUps);			return null;		}		for (int i = 0; i < limit; i++)		{			newNode = makeInstance(cell, pullUps, i*50 + pullUpsXOffset, pullUpsY, !outputsOnBottom);			if (newNode == null) return null;			if (lastNode == null)			{				Export.newInstance(cell, newNode.findPortInstFromProto(pullUpsPwrW), "PWR0.m-2.w");				Export.newInstance(cell, newNode.findPortInstFromProto(pullUpsGnd1W), "GND0.m-1.w");				PortInst pi = newNode.findPortInstFromProto(pullUpsGnd1W);				Poly poly = pi.getPoly();				double pwrY = poly.getCenterY();				NodeInst gndNode1 = makePin(cell, lowX-13, pwrY, 6, m12Con);				if (gndNode1 == null) return null;				makeWire(m1Arc, 4, newNode, pullUpsGnd1W, gndNode1, gndNode1.getProto().getPort(0), cell);				makeWire(m2Arc, 14, gndNode1, gndNode1.getProto().getPort(0), gndNode2,					gndNode2.getProto().getPort(0), cell);				Export pullUpsGnd2W = orCell.findExport("GND" + i + ".m-1." + side);				Export pullUpsGnd2E = orCell.findExport("GND" + (i+1) + ".m-1." + side);				if (pullUpsGnd1W != null && pullUpsGnd2W != null)					makeWire(m1Arc, 4, newNode, pullUpsGnd1W, orNode, pullUpsGnd2W, cell);				if (pullUpsGnd2W != null && pullUpsGnd2E != null)					makeWire(m1Arc, 4, newNode, pullUpsGnd1E, orNode, pullUpsGnd2E, cell);			} else			{				// get wired				if (pullUpsPwrW != null && pullUpsPwrE != null)					makeWire(m2Arc, 14, lastNode, pullUpsPwrE, newNode, pullUpsPwrW, cell);				Export pullUpsGnd2W = orCell.findExport("GND" + i + ".m-1." + side);				Export pullUpsGnd2E = orCell.findExport("GND" + (i+1) + ".m-1." + side);				if (pullUpsGnd1W != null && pullUpsGnd2W != null)					makeWire(m1Arc, 4, newNode, pullUpsGnd1W, orNode, pullUpsGnd2W, cell);				if (pullUpsGnd1E != null && pullUpsGnd2E != null)					makeWire(m1Arc, 4, newNode, pullUpsGnd1E, orNode, pullUpsGnd2E, cell);			}			lastNode = newNode;			for (int x = pullUpsCnt; x < pullUpsCnt+4; x++)			{				Export pPort = orCell.findExport("DATA" + x + ".m-1." + side);				Export nPort = pullUps.findExport("PULLUP" + (x%4) + ".m-1.s");				if (pPort != null && nPort != null)					makeWire(m1Arc, 4, orNode, pPort, newNode, nPort, cell);			}			pullUpsCnt += 4;		}		if (pullUpsPwrE != null)		{			PortInst pi = lastNode.findPortInstFromProto(pullUpsPwrE);			Poly poly = pi.getPoly();			double pwrY = poly.getCenterY();			NodeInst pwrNode2 = makePin(cell, highX+13, pwrY, 14, m2Pin);			if (pwrNode2 == null) return null;			makeWire(m2Arc, 14, lastNode, pullUpsPwrE, pwrNode2, pwrNode2.getProto().getPort(0), cell);			makeWire(m2Arc, 14, pwrNode1, pwrNode1.getProto().getPort(0), pwrNode2,				pwrNode2.getProto().getPort(0), cell);			Export.newInstance(cell, lastNode.findPortInstFromProto(pullUpsPwrE), "PWR0.m-2.e");		}		if (pullUpsGnd1E != null)			Export.newInstance(cell, lastNode.findPortInstFromProto(pullUpsGnd1E), "GND0.m-1.e");		int x = 0;		String aName = "ACCESS" + x + ".p.w";		PortProto pPort = orCell.findPortProto(aName);		while (pPort != null)		{			Export.newInstance(cell, orNode.findPortInstFromProto(pPort), aName);			x++;			aName = "ACCESS" + x + ".p.w";			pPort = orCell.findPortProto(aName);		}		return cell;	}	private Cell makePLA(Library library, String name)	{		Cell cell = Cell.makeInstance(library, name);		NodeInst decodeNode = makeInstance(cell, decodeCell, 0, 0, false);		if (decodeNode == null) return null;		Rectangle2D decodeBounds = decodeNode.getBounds();		NodeInst orNode = makeInstance(cell, orPlaneCell, decodeBounds.getMaxX()+27, 0, false);		if (orNode == null) return null;		Export orPort = orPlaneCell.findExport("ACCESS0.p.w");		Poly orPoly = orNode.findPortInstFromProto(orPort).getPoly();		double orY = orPoly.getCenterY();		Export decodePort = decodeCell.findExport("DATA0.m-1.n");		Poly decodePoly = decodeNode.findPortInstFromProto(decodePort).getPoly();		double decodeY = decodePoly.getCenterY();		double dY = decodeY - orY;		if (orY != decodeY) orNode.move(0, dY);		int x = 0;		while (orPort != null && decodePort != null)		{			makeWire(m1Arc, 4, orNode, orPort, decodeNode, decodePort, cell);			x++;			orPort = orPlaneCell.findExport("ACCESS" + x + ".p.w");			decodePort = decodeCell.findExport("DATA" + x + ".m-1.n");		}		return cell;	}	NodeInst makePin(Cell cell, double x, double y, double size, PrimitiveNode node)	{		double xS = node.getDefWidth();		double yS = node.getDefHeight();		if (size < xS) size = xS;		if (size < yS) size = yS;		NodeInst ni = NodeInst.makeInstance(node, new Point2D.Double(x, y), size, size, cell);		if (ni == null)			System.out.println("Unable to create " + node + " in " + cell);		return ni;	}	void makeWire(ArcProto typ, double width, NodeInst fromNodeInst,		PortProto fromPortProto, NodeInst toNodeInst, PortProto toPortProto, Cell cell)	{		PortInst fromPi = fromNodeInst.findPortInstFromProto(fromPortProto);		PortInst toPi = toNodeInst.findPortInstFromProto(toPortProto);		if (typ == null)		{			System.out.println("Attempting to wire with unknown arc layer");			return;		}		double wid = typ.getDefaultLambdaBaseWidth();//		double wid = typ.getDefaultLambdaFullWidth();//		w = us_widestarcinst(typ, fromnodeinst, fromportproto);//		if (w > wid) wid = w;//		w = us_widestarcinst(typ, tonodeinst, toportproto);//		if (w > wid) wid = w;		if (width > wid) wid = width;		ArcInst ai = ArcInst.makeInstanceBase(typ, wid, fromPi, toPi);//		ArcInst ai = ArcInst.makeInstanceFull(typ, wid, fromPi, toPi);		if (ai == null)		{			System.out.println("Unable to run " + typ + " from " + fromNodeInst +				", " + fromPortProto + " to " + toNodeInst + ", " +				toPortProto + " in " + cell);		}	}	NodeInst makeInstance(Cell cell, Cell instProto, double x, double y, boolean mirror)	{		Rectangle2D protoBounds = instProto.getBounds();		double sX = protoBounds.getWidth();		double sY = protoBounds.getHeight();		Orientation orient = Orientation.IDENT;		if (mirror)		{			orient = Orientation.Y;			double y1 = protoBounds.getMinY() + y;			double y2 = protoBounds.getMaxY() + y;			y = y2 + y1 - y;		}		NodeInst ni = NodeInst.makeInstance(instProto, new Point2D.Double(x, y), sX, sY, cell, orient, null, 0);		return ni;	}}

⌨️ 快捷键说明

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