?? technology.java
字號:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: Technology.java * * Copyright (c) 2003 Sun Microsystems and Static Free Software * * Electric(tm) is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Electric(tm) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Electric(tm); see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, Mass 02111-1307, USA. */package com.sun.electric.technology;import com.sun.electric.Main;import com.sun.electric.database.EObjectInputStream;import com.sun.electric.database.EObjectOutputStream;import com.sun.electric.database.ImmutableArcInst;import com.sun.electric.database.ImmutableNodeInst;import com.sun.electric.database.geometry.DBMath;import com.sun.electric.database.geometry.EPoint;import com.sun.electric.database.geometry.ERectangle;import com.sun.electric.database.geometry.Orientation;import com.sun.electric.database.geometry.Poly;import com.sun.electric.database.hierarchy.Cell;import com.sun.electric.database.hierarchy.EDatabase;import com.sun.electric.database.hierarchy.Library;import com.sun.electric.database.id.ArcProtoId;import com.sun.electric.database.id.IdManager;import com.sun.electric.database.id.PrimitiveNodeId;import com.sun.electric.database.id.TechId;import com.sun.electric.database.prototype.NodeProto;import com.sun.electric.database.prototype.PortCharacteristic;import com.sun.electric.database.prototype.PortProto;import com.sun.electric.database.text.ImmutableArrayList;import com.sun.electric.database.text.Pref;import com.sun.electric.database.text.Setting;import com.sun.electric.database.text.TextUtils;import com.sun.electric.database.text.Version;import com.sun.electric.database.topology.ArcInst;import com.sun.electric.database.topology.Connection;import com.sun.electric.database.topology.Geometric;import com.sun.electric.database.topology.NodeInst;import com.sun.electric.database.topology.PortInst;import com.sun.electric.database.variable.TextDescriptor;import com.sun.electric.database.variable.UserInterface;import com.sun.electric.database.variable.VarContext;import com.sun.electric.database.variable.Variable;import com.sun.electric.technology.technologies.Artwork;import com.sun.electric.technology.technologies.EFIDO;import com.sun.electric.technology.technologies.FPGA;import com.sun.electric.technology.technologies.GEM;import com.sun.electric.technology.technologies.Generic;import com.sun.electric.technology.technologies.Schematics;import com.sun.electric.technology.xml.XmlParam;import com.sun.electric.tool.Job;import com.sun.electric.tool.erc.ERC;import com.sun.electric.tool.user.ActivityLogger;import com.sun.electric.tool.user.User;import java.awt.Color;import java.awt.geom.AffineTransform;import java.awt.geom.Point2D;import java.io.IOException;import java.io.InvalidObjectException;import java.io.NotSerializableException;import java.io.PrintWriter;import java.io.Serializable;import java.net.URL;import java.util.ArrayList;import java.util.Collection;import java.util.Collections;import java.util.Comparator;import java.util.HashMap;import java.util.HashSet;import java.util.Iterator;import java.util.LinkedHashMap;import java.util.List;import java.util.Map;import java.util.NoSuchElementException;import java.util.TreeMap;import javax.swing.SwingUtilities;/** * Technology is the base class for all of the specific technologies in Electric. * * It is organized into two main areas: nodes and arcs. * Both nodes and arcs are composed of Layers. *<P> * Subclasses of Technology usually start by defining the Layers (such as Metal-1, Metal-2, etc.) * Then the ArcProto objects are created, built entirely from Layers. * Next PrimitiveNode objects are created, and they have Layers as well as connectivity to the ArcProtos. * The Technology concludes with miscellaneous data assignments of technology-wide information. * <P> * Here are the nodes in a sample CMOS technology. * Note that there are two types of transistors and diffusion contacts, one for Well and one for Substrate. * Each layer that can exist as a wire must have a pin node (in this case, metal, polysilicon, and two flavors of diffusion. * Note that there are pure-layer nodes at the bottom which allow arbitrary geometry to be constructed. * <CENTER><IMG SRC="doc-files/Technology-1.gif"></CENTER> * <P> * The Schematic technology has some unusual features. * <CENTER><IMG SRC="doc-files/Technology-2.gif"></CENTER> * <P> * Conceptually, a Technology has 3 types of information: * <UL><LI><I>Geometry</I>. Each node and arc can be described in terms of polygons on differnt Layers. * The ArcLayer and NodeLayer subclasses help define those polygons. * <LI><I>Connectivity</I>. The very structure of the nodes and arcs establisheds a set of rules of connectivity. * Examples include the list of allowable arc types that may connect to each port, and the use of port "network numbers" * to identify those that are connected internally. * <LI><I>Behavior</I>. Behavioral information takes many forms, but they can all find a place here. * For example, each layer, node, and arc has a "function" that describes its general behavior. * Some information applies to the technology as a whole, for example SPICE model cards. * Other examples include Design Rules and technology characteristics. * </UL> * @author Steven M. Rubin */public class Technology implements Comparable<Technology>, Serializable{ /** true to allow outlines to have "breaks" with multiple pieces in them */ public static final boolean HANDLEBROKENOUTLINES = true; /** true to handle duplicate points in an outline as a "break" */ public static final boolean DUPLICATEPOINTSAREBROKENOUTLINES = false; // Change in TechSettings takes effect only after restart private final boolean IMMUTABLE_TECHS = false; private static final boolean LAZY_TECHNOLOGIES = false; /** Jelib writes base sizes since this Electric Version */ public static final Version DISK_VERSION_1 = Version.parseVersion("8.05g"); /** Jelib writes oversize over standard primitive since this Electric Version */ public static final Version DISK_VERSION_2 = Version.parseVersion("8.05o"); public static final Technology[] NULL_ARRAY = {}; public static final ImmutableArrayList<Technology> EMPTY_LIST = new ImmutableArrayList<Technology>(NULL_ARRAY); /** key of Variable for saving scalable transistor contact information. */ public static final Variable.Key TRANS_CONTACT = Variable.newKey("MOCMOS_transcontacts"); // strings used in the Component Menu public static final String SPECIALMENUCELL = "Cell"; public static final String SPECIALMENUMISC = "Misc."; public static final String SPECIALMENUPURE = "Pure"; public static final String SPECIALMENUSPICE = "Spice"; public static final String SPECIALMENUEXPORT = "Export"; public static final String SPECIALMENUTEXT = "Text"; public static final String SPECIALMENUHIGH = "High"; public static final String SPECIALMENUPORT = "Port"; public static class Distance implements Serializable { public double k; public double lambdaValue; public final List<DistanceRule> terms = new ArrayList<DistanceRule>(); public void assign(Distance d) { k = d.k; lambdaValue = d.lambdaValue; for (DistanceRule term: d.terms) terms.add(term.clone()); } public Distance clone() { Distance d = new Distance(); d.assign(this); return d; } public double getLambda(DistanceContext context) { double value = lambdaValue; for (DistanceRule term: terms) value += term.getLambda(context); return value; } public void addLambda(double value) { lambdaValue += value; } public void addRule(String ruleName, double k) { DistanceRule term = new DistanceRule(); term.ruleName = ruleName; term.k = k; terms.add(term); } public boolean isEmpty() { return lambdaValue == 0 && terms.isEmpty(); } } public static interface DistanceContext { public double getRule(String ruleName); } public static DistanceContext EMPTY_CONTEXT = new DistanceContext() { public double getRule(String ruleName) { throw new UnsupportedOperationException(); } }; public static class DistanceRule implements Serializable, Cloneable { public String ruleName; public double k; public DistanceRule clone() { try { return (DistanceRule)super.clone(); } catch (CloneNotSupportedException e) { throw new AssertionError(); } } private double getLambda(DistanceContext context) { return context.getRule(ruleName)*k; } } /** * Defines a single layer of a ArcProto. * A ArcProto has a list of these ArcLayer objects, one for * each layer in a typical ArcInst. * Each ArcProto is composed of a number of ArcLayer descriptors. * A descriptor converts a specific ArcInst into a polygon that describe this particular layer. */ protected static class ArcLayer { private final Layer layer; private final Poly.Type style; private final Distance xmlExtend; private int gridExtend; /** * Constructs an <CODE>ArcLayer</CODE> with the specified description. * @param layer the Layer of this ArcLayer. * @param arcLayerWidth the width of this ArcLayer in standard ArcInst. * @param style the Poly.Style of this ArcLayer. */ public ArcLayer(Layer layer, double arcLayerWidth, Poly.Type style) { this(layer, style, arcLayerWidth*0.5); gridExtend = (int)DBMath.lambdaToGrid(arcLayerWidth*0.5); } /** * Constructs an <CODE>ArcLayer</CODE> with the specified description. * @param layer the Layer of this ArcLayer. * @param style the Poly.Style of this ArcLayer. * @param ruleNames rule names to make an expression for for extend of this ArcLayer */ public ArcLayer(Layer layer, Poly.Type style, String ... ruleNames) { this(layer, style, 0, ruleNames); } /** * Constructs an <CODE>ArcLayer</CODE> with the specified description. * @param layer the Layer of this ArcLayer. * @param style the Poly.Style of this ArcLayer. * @param lambdaExtend lambda fraction of extend * @param ruleNames rule names to make an expression for for extend of this ArcLayer */ public ArcLayer(Layer layer, Poly.Type style, double lambdaExtend, String ... ruleNames) { this(layer, style, new Distance()); if (ruleNames.length > 0) xmlExtend.addRule(ruleNames[0], 0.5); for (int i = 1; i < ruleNames.length; i++) xmlExtend.addRule(ruleNames[i], 1); xmlExtend.addLambda(DBMath.round(lambdaExtend)); }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -