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

📄 layer.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: Layer.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.database.geometry.DBMath;import com.sun.electric.database.geometry.EGraphics;import com.sun.electric.database.geometry.Poly;import com.sun.electric.database.prototype.PortCharacteristic;import com.sun.electric.database.text.Pref;import com.sun.electric.database.text.Setting;import com.sun.electric.technology.xml.XmlParam;import com.sun.electric.tool.Job;import com.sun.electric.tool.user.Resources;import java.awt.Color;import java.io.PrintWriter;import java.lang.reflect.Method;import java.util.ArrayList;import java.util.Arrays;import java.util.BitSet;import java.util.Collection;import java.util.Comparator;import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;/** * The Layer class defines a single layer of material, out of which NodeInst and ArcInst objects are created. * The Layers are defined by the PrimitiveNode and ArcProto classes, and are used in the generation of geometry. * In addition, layers have extra information that is used for output and behavior. */public class Layer{    public static final double DEFAULT_THICKNESS = 0; // 3D default thickness    public static final double DEFAULT_DISTANCE = 0; // 3D default distance    public static final String DEFAULT_MODE = "NONE"; // 3D default transparency mode DEFAULT_FACTOR    public static final double DEFAULT_FACTOR = 0.0; // 3D default transparency factor    private static final double DEFAULT_AREA_COVERAGE = 10; // 10%    /** Describes a P-type layer. */												private static final int PTYPE =          0100;    /** Describes a N-type layer. */												private static final int NTYPE =          0200;    /** Describes a depletion layer. */												private static final int DEPLETION =      0400;    /** Describes a enhancement layer. */											private static final int ENHANCEMENT =   01000;    /** Describes a light doped layer. */											private static final int LIGHT =         02000;    /** Describes a heavy doped layer. */											private static final int HEAVY =         04000;//    /** Describes a pseudo layer. */												private static final int PSEUDO =       010000;    /** Describes a deep layer. */												    private static final int DEEP =         010000;    /** Describes a nonelectrical layer (does not carry signals). */				private static final int NONELEC =      020000;    /** Describes a layer that contacts metal (used to identify contacts/vias). */	private static final int CONMETAL =     040000;    /** Describes a layer that contacts polysilicon (used to identify contacts). */	private static final int CONPOLY =     0100000;    /** Describes a layer that contacts diffusion (used to identify contacts). */	private static final int CONDIFF =     0200000;    /** Describes a layer that is native. */	                                    private static final int NATIVE =      0400000;    /** Describes a layer that is VTH or VTL */								        private static final int HLVT =      010000000;    /** Describes a layer that is inside transistor. */								private static final int INTRANS =   020000000;    /** Describes a thick layer. */								                    private static final int THICK =     040000000;    private static final ArrayList<Function> metalLayers = new ArrayList<Function>();    private static final ArrayList<Function> contactLayers = new ArrayList<Function>();    private static final ArrayList<Function> polyLayers = new ArrayList<Function>();    private static List<Function> allFunctions;	/**	 * Function is a typesafe enum class that describes the function of a layer.	 * Functions are technology-independent and describe the nature of the layer (Metal, Polysilicon, etc.)	 */	public static enum Function	{		/** Describes an unknown layer. */						UNKNOWN   ("unknown",     0, 0, 0, 35, 0, 0),		/** Describes a metal layer 1. */						METAL1    ("metal-1",     1, 0, 0, 17, 0, 0),		/** Describes a metal layer 2. */						METAL2    ("metal-2",     2, 0, 0, 19, 0, 0),		/** Describes a metal layer 3. */						METAL3    ("metal-3",     3, 0, 0, 21, 0, 0),		/** Describes a metal layer 4. */						METAL4    ("metal-4",     4, 0, 0, 23, 0, 0),		/** Describes a metal layer 5. */						METAL5    ("metal-5",     5, 0, 0, 25, 0, 0),		/** Describes a metal layer 6. */						METAL6    ("metal-6",     6, 0, 0, 27, 0, 0),		/** Describes a metal layer 7. */						METAL7    ("metal-7",     7, 0, 0, 29, 0, 0),		/** Describes a metal layer 8. */						METAL8    ("metal-8",     8, 0, 0, 31, 0, 0),		/** Describes a metal layer 9. */						METAL9    ("metal-9",     9, 0, 0, 33, 0, 0),		/** Describes a metal layer 10. */						METAL10   ("metal-10",   10, 0, 0, 35, 0, 0),		/** Describes a metal layer 11. */						METAL11   ("metal-11",   11, 0, 0, 37, 0, 0),		/** Describes a metal layer 12. */						METAL12   ("metal-12",   12, 0, 0, 39, 0, 0),		/** Describes a polysilicon layer 1. */					POLY1     ("poly-1",      0, 0, 1, 12, 0, 0),		/** Describes a polysilicon layer 2. */					POLY2     ("poly-2",      0, 0, 2, 13, 0, 0),		/** Describes a polysilicon layer 3. */					POLY3     ("poly-3",      0, 0, 3, 14, 0, 0),		/** Describes a polysilicon gate layer. */				GATE      ("gate",        0, 0, 0, 15, Layer.INTRANS, 0),		/** Describes a diffusion layer. */						DIFF      ("diffusion",   0, 0, 0, 11, 0, 0),		/** Describes a P-diffusion layer. */					DIFFP     ("p-diffusion", 0, 0, 0, 11, Layer.PTYPE, 0),		/** Describes a N-diffusion layer. */					DIFFN     ("n-diffusion", 0, 0, 0, 11, Layer.NTYPE, 0),		/** Describes an implant layer. */						IMPLANT   ("implant",     0, 0, 0, 2, 0, 0),		/** Describes a P-implant layer. */						IMPLANTP  ("p-implant",   0, 0, 0, 2, Layer.PTYPE, 0),		/** Describes an N-implant layer. */					IMPLANTN  ("n-implant",   0, 0, 0, 2, Layer.NTYPE, 0),		/** Describes a contact layer 1. */						CONTACT1  ("contact-1",   0, 1, 0, 16, 0, 0),		/** Describes a contact layer 2. */						CONTACT2  ("contact-2",   0, 2, 0, 18, 0, 0),		/** Describes a contact layer 3. */						CONTACT3  ("contact-3",   0, 3, 0, 20, 0, 0),		/** Describes a contact layer 4. */						CONTACT4  ("contact-4",   0, 4, 0, 22, 0, 0),		/** Describes a contact layer 5. */						CONTACT5  ("contact-5",   0, 5, 0, 24, 0, 0),		/** Describes a contact layer 6. */						CONTACT6  ("contact-6",   0, 6, 0, 26, 0, 0),		/** Describes a contact layer 7. */						CONTACT7  ("contact-7",   0, 7, 0, 28, 0, 0),		/** Describes a contact layer 8. */						CONTACT8  ("contact-8",   0, 8, 0, 30, 0, 0),		/** Describes a contact layer 9. */						CONTACT9  ("contact-9",   0, 9, 0, 32, 0, 0),		/** Describes a contact layer 10. */					CONTACT10 ("contact-10",  0,10, 0, 34, 0, 0),		/** Describes a contact layer 11. */					CONTACT11 ("contact-11",  0,11, 0, 36, 0, 0),		/** Describes a contact layer 12. */					CONTACT12 ("contact-12",  0,12, 0, 38, 0, 0),		/** Describes a sinker (diffusion-to-buried plug). */	PLUG      ("plug",        0, 0, 0, 40, 0, 0),		/** Describes an overglass layer (passivation). */		OVERGLASS ("overglass",   0, 0, 0, 41, 0, 0),		/** Describes a resistor layer. */						RESISTOR  ("resistor",    0, 0, 0, 4, 0, 0),		/** Describes a capacitor layer. */						CAP       ("capacitor",   0, 0, 0, 5, 0, 0),		/** Describes a transistor layer. */					TRANSISTOR("transistor",  0, 0, 0, 3, 0, 0),		/** Describes an emitter of bipolar transistor. */		EMITTER   ("emitter",     0, 0, 0, 6, 0, 0),		/** Describes a base of bipolar transistor. */			BASE      ("base",        0, 0, 0, 7, 0, 0),		/** Describes a collector of bipolar transistor. */		COLLECTOR ("collector",   0, 0, 0, 8, 0, 0),		/** Describes a substrate layer. */						SUBSTRATE ("substrate",   0, 0, 0, 1, 0, 0),		/** Describes a well layer. */							WELL      ("well",        0, 0, 0, 0, 0, 0),		/** Describes a P-well layer. */						WELLP     ("p-well",      0, 0, 0, 0, Layer.PTYPE, 0),		/** Describes a N-well layer. */						WELLN     ("n-well",      0, 0, 0, 0, Layer.NTYPE, 0),		/** Describes a guard layer. */							GUARD     ("guard",       0, 0, 0, 9, 0, 0),		/** Describes an isolation layer (bipolar). */			ISOLATION ("isolation",   0, 0, 0, 10, 0, 0),		/** Describes a bus layer. */							BUS       ("bus",         0, 0, 0, 42, 0, 0),		/** Describes an artwork layer. */						ART       ("art",         0, 0, 0, 43, 0, 0),		/** Describes a control layer. */						CONTROL   ("control",     0, 0, 0, 44, 0, 0),        /** Describes a tileNot layer. */						TILENOT   ("tileNot",     0, 0, 0, 45, 0, 0),        /** Describes a dummy polysilicon layer 1 */            DMYPOLY1  ("dmy-poly-1",  0, 0, 0, POLY1.getHeight(), 0, 0),        /** Describes a dummy polysilicon layer 2 */            DMYPOLY2  ("dmy-poly-2",  0, 0, 0, POLY2.getHeight(), 0, 0),        /** Describes a dummy polysilicon layer 3 */            DMYPOLY3  ("dmy-poly-3",  0, 0, 0, POLY3.getHeight(), 0, 0),        /** Describes a dummy diffusion layer */                DMYDIFF   ("dmy-diffusion", 0, 0, 0, DIFF.getHeight(), 0, 0),        /** Describes a dummy metal layer 1 */                  DMYMETAL1 ("dmy-metal-1", 0, 0, 0, METAL1.getHeight(), 0, 1),        /** Describes a dummy metal layer 2 */                  DMYMETAL2 ("dmy-metal-2", 0, 0, 0, METAL2.getHeight(), 0, 2),        /** Describes a dummy metal layer 3 */                  DMYMETAL3 ("dmy-metal-3", 0, 0, 0, METAL3.getHeight(), 0, 3),        /** Describes a dummy metal layer 4 */                  DMYMETAL4 ("dmy-metal-4", 0, 0, 0, METAL4.getHeight(), 0, 4),        /** Describes a dummy metal layer 5 */                  DMYMETAL5 ("dmy-metal-5", 0, 0, 0, METAL5.getHeight(), 0, 5),        /** Describes a dummy metal layer 6 */                  DMYMETAL6 ("dmy-metal-6", 0, 0, 0, METAL6.getHeight(), 0, 6),        /** Describes a dummy metal layer 7 */                  DMYMETAL7 ("dmy-metal-7", 0, 0, 0, METAL7.getHeight(), 0, 7),        /** Describes a dummy metal layer 8 */                  DMYMETAL8 ("dmy-metal-8", 0, 0, 0, METAL8.getHeight(), 0, 8),        /** Describes a dummy metal layer 9 */                  DMYMETAL9 ("dmy-metal-9", 0, 0, 0, METAL9.getHeight(), 0, 9),        /** Describes a dummy metal layer 10 */                 DMYMETAL10 ("dmy-metal-10", 0, 0, 0, METAL10.getHeight(), 0, 10),        /** Describes a dummy metal layer 11 */                 DMYMETAL11 ("dmy-metal-11", 0, 0, 0, METAL11.getHeight(), 0, 11),        /** Describes a dummy metal layer 12 */                 DMYMETAL12 ("dmy-metal-12", 0, 0, 0, METAL12.getHeight(), 0, 12),        /** Describes a exclusion polysilicon layer 1 */        DEXCLPOLY1  ("dexcl-poly-1",  0, 0, 0, POLY1.getHeight(), 0, 0),        /** Describes a exclusion polysilicon layer 2 */        DEXCLPOLY2  ("dexcl-poly-2",  0, 0, 0, POLY2.getHeight(), 0, 0),        /** Describes a exclusion polysilicon layer 3 */        DEXCLPOLY3  ("dexcl-poly-3",  0, 0, 0, POLY3.getHeight(), 0, 0),        /** Describes a exclusion diffusion layer */            DEXCLDIFF   ("dexcl-diffusion", 0, 0, 0, DIFF.getHeight(), 0, 0),        /** Describes a exclusion metal layer 1 */              DEXCLMETAL1 ("dexcl-metal-1", 0, 0, 0, METAL1.getHeight(), 0, 1),        /** Describes a exclusion metal layer 2 */              DEXCLMETAL2 ("dexcl-metal-2", 0, 0, 0, METAL2.getHeight(), 0, 2),        /** Describes a exclusion metal layer 3 */              DEXCLMETAL3 ("dexcl-metal-3", 0, 0, 0, METAL3.getHeight(), 0, 3),        /** Describes a exclusion metal layer 4 */              DEXCLMETAL4 ("dexcl-metal-4", 0, 0, 0, METAL4.getHeight(), 0, 4),        /** Describes a exclusion metal layer 5 */              DEXCLMETAL5 ("dexcl-metal-5", 0, 0, 0, METAL5.getHeight(), 0, 5),        /** Describes a exclusion metal layer 6 */              DEXCLMETAL6 ("dexcl-metal-6", 0, 0, 0, METAL6.getHeight(), 0, 6),        /** Describes a exclusion metal layer 7 */              DEXCLMETAL7 ("dexcl-metal-7", 0, 0, 0, METAL7.getHeight(), 0, 7),        /** Describes a exclusion metal layer 8 */              DEXCLMETAL8 ("dexcl-metal-8", 0, 0, 0, METAL8.getHeight(), 0, 8),        /** Describes a exclusion metal layer 9 */              DEXCLMETAL9 ("dexcl-metal-9", 0, 0, 0, METAL9.getHeight(), 0, 9),        /** Describes a exclusion metal layer 10 */             DEXCLMETAL10 ("dexcl-metal-10", 0, 0, 0, METAL10.getHeight(), 0, 10),        /** Describes a exclusion metal layer 11 */             DEXCLMETAL11 ("dexcl-metal-11", 0, 0, 0, METAL11.getHeight(), 0, 11),        /** Describes a exclusion metal layer 12 */             DEXCLMETAL12 ("dexcl-metal-12", 0, 0, 0, METAL12.getHeight(), 0, 12);//        /** Describes a P-type layer. */												public static final int PTYPE = Layer.PTYPE;//        /** Describes a N-type layer. */												public static final int NTYPE = Layer.NTYPE;        /** Describes a depletion layer. */												public static final int DEPLETION = Layer.DEPLETION;        /** Describes a enhancement layer. */											public static final int ENHANCEMENT = Layer.ENHANCEMENT;        /** Describes a light doped layer. */											public static final int LIGHT = Layer.LIGHT;        /** Describes a heavy doped layer. */											public static final int HEAVY = Layer.HEAVY;//        /** Describes a pseudo layer. */												public static final int PSEUDO = Layer.PSEUDO;        /** Describes a nonelectrical layer (does not carry signals). */				public static final int NONELEC = Layer.NONELEC;        /** Describes a layer that contacts metal (used to identify contacts/vias). */	public static final int CONMETAL = Layer.CONMETAL;        /** Describes a layer that contacts polysilicon (used to identify contacts). */	public static final int CONPOLY = Layer.CONPOLY;        /** Describes a layer that contacts diffusion (used to identify contacts). */	public static final int CONDIFF = Layer.CONDIFF;        /** Describes a layer that is VTH or VTL */								        public static final int HLVT = Layer.HLVT;//        /** Describes a layer that is inside transistor. */								public static final int INTRANS = Layer.INTRANS;        /** Describes a thick layer. */								                    public static final int THICK = Layer.THICK;        /** Describes a native layer. */								                public static final int NATIVE = Layer.NATIVE;        /** Describes a deep layer. */								                    public static final int DEEP = Layer.DEEP;        private final String name;        private final boolean isMetal;        private final boolean isContact;        private final boolean isPoly;		private int level;		private final int height;		private final int extraBits;		private static final int [] extras = {PTYPE, NTYPE, DEPLETION, ENHANCEMENT, LIGHT, HEAVY, /*PSEUDO,*/ NONELEC, CONMETAL, CONPOLY, CONDIFF, HLVT, INTRANS, THICK};        static {            allFunctions = Arrays.asList(Function.class.getEnumConstants());        }		private Function(String name, int metalLevel, int contactLevel, int polyLevel, int height, int extraBits, int genericLevel)		{			this.name = name;			this.height = height;			this.extraBits = extraBits;            isMetal = metalLevel != 0;            isContact = contactLevel != 0;            isPoly = polyLevel != 0;            level = 0;            if (genericLevel != 0) level = genericLevel;            if (isMetal) addToLayers(metalLayers, metalLevel);			if (contactLevel != 0) addToLayers(contactLayers, contactLevel);			if (polyLevel != 0) addToLayers(polyLayers, polyLevel);		}        private void addToLayers(ArrayList<Function> layers, int level) {            this.level = level;            while (layers.size() <= level) layers.add(null);            Function oldFunction = layers.set(level, this);            assert oldFunction == null;        }		/**		 * Returns a printable version of this Function.		 * @return a printable version of this Function.		 */		public String toString()		{			String toStr = name;			for(int i=0; i<extras.length; i++)			{				if ((extraBits & extras[i]) == 0) continue;				toStr += "," + getExtraName(extras[i]);			}			return toStr;		}		/**		 * Returns the name for this Function.		 * @return the name for this Function.		 */		public String getName() { return name; }		/**		 * Returns the constant name for this Function.		 * Constant names are used when writing Java code, so they must be the same as the actual symbol name.		 * @return the constant name for this Function.		 */		public String getConstantName() { return name(); }		/**		 * Method to return a list of all Layer Functions.		 * @return a list of all Layer Functions.		 */		public static List<Function> getFunctions() { return allFunctions; }		/**		 * Method to return an array of the Layer Function "extra bits".		 * @return an array of the Layer Function "extra bits".		 * Each entry in the array is a single "extra bit", but they can be ORed together to combine them.		 */		public static int [] getFunctionExtras() { return extras; }		/**		 * Method to convert an "extra bits" value to a name.		 * @param extra the extra bits value (must be a single bit, not an ORed combination).		 * @return the name of that extra bit.		 */		public static String getExtraName(int extra)		{			if (extra == PTYPE) return "p-type";			if (extra == NTYPE) return "n-type";			if (extra == DEPLETION) return "depletion";			if (extra == ENHANCEMENT) return "enhancement";			if (extra == LIGHT) return "light";			if (extra == HEAVY) return "heavy";//			if (extra == PSEUDO) return "pseudo";			if (extra == NONELEC) return "nonelectrical";			if (extra == CONMETAL) return "connects-metal";			if (extra == CONPOLY) return "connects-poly";			if (extra == CONDIFF) return "connects-diff";            if (extra == HLVT) return "vt";			if (extra == INTRANS) return "inside-transistor";			if (extra == THICK) return "thick";            if (extra == NATIVE) return "native";            return "";		}		/**		 * Method to convert an "extra bits" value to a constant name.		 * Constant names are used when writing Java code, so they must be the same as the actual symbol name.		 * @param extra the extra bits value (must be a single bit, not an ORed combination).		 * @return the name of that extra bit's constant.		 */		public static String getExtraConstantName(int extra)		{			if (extra == PTYPE) return "PTYPE";			if (extra == NTYPE) return "NTYPE";			if (extra == DEPLETION) return "DEPLETION";			if (extra == ENHANCEMENT) return "ENHANCEMENT";			if (extra == LIGHT) return "LIGHT";

⌨️ 快捷键说明

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