📄 layer.java
字号:
if (extra == HEAVY) return "HEAVY";// if (extra == PSEUDO) return "PSEUDO"; if (extra == NONELEC) return "NONELEC"; if (extra == CONMETAL) return "CONMETAL"; if (extra == CONPOLY) return "CONPOLY"; if (extra == CONDIFF) return "CONDIFF"; if (extra == HLVT) return "HLVT"; if (extra == INTRANS) return "INTRANS"; if (extra == THICK) return "THICK"; if (extra == NATIVE) return "NATIVE"; return ""; } /** * Method to convert an "extra bits" name to its numeric value. * @param name the name of the bit. * @return the numeric equivalent of that bit. */ public static int parseExtraName(String name) { if (name.equalsIgnoreCase("p-type")) return PTYPE; if (name.equalsIgnoreCase("n-type")) return NTYPE; if (name.equalsIgnoreCase("depletion")) return DEPLETION; if (name.equalsIgnoreCase("enhancement")) return ENHANCEMENT; if (name.equalsIgnoreCase("light")) return LIGHT; if (name.equalsIgnoreCase("heavy")) return HEAVY;// if (name.equalsIgnoreCase("pseudo")) return PSEUDO; if (name.equalsIgnoreCase("nonelectrical")) return NONELEC; if (name.equalsIgnoreCase("connects-metal")) return CONMETAL; if (name.equalsIgnoreCase("connects-poly")) return CONPOLY; if (name.equalsIgnoreCase("connects-diff")) return CONDIFF; if (name.equalsIgnoreCase("inside-transistor")) return INTRANS; if (name.equalsIgnoreCase("thick")) return THICK; if (name.equalsIgnoreCase("vt")) return HLVT; if (name.equalsIgnoreCase("native")) return NATIVE; return 0; } /** * Method to get the level of this Layer. * The level applies to metal and polysilicon functions, and gives the layer number * (i.e. Metal-2 is level 2). * @return the level of this Layer. */ public int getLevel() { return level; } /** * Method to find the Function that corresponds to Metal on a given layer. * @param level the layer (starting at 1 for Metal-1). * @return the Function that represents that Metal layer. Null if the given layer level is invalid. */ public static Function getMetal(int level) { if (level > EGraphics.TRANSPARENT_12) { System.out.println("Invalid metal layer level:" + level); return null; } Function func = metalLayers.get(level); return func; } /** * Method to find the Function that corresponds to a contact on a given layer. * @param level the layer (starting at 1 for Contact-1). * @return the Function that represents that Contact layer. Null if the given layer level is invalid. */ public static Function getContact(int level) { if (level > EGraphics.TRANSPARENT_12) { System.out.println("Invalid via layer level:" + level); return null; } Function func = contactLayers.get(level); return func; } /** * Method to find the Function that corresponds to Polysilicon on a given layer. * @param level the layer (starting at 1 for Polysilicon-1). * @return the Function that represents that Polysilicon layer. */ public static Function getPoly(int level) { Function func = polyLayers.get(level); return func; } /** * Method to tell whether this layer function is metal. * @return true if this layer function is metal. */ public boolean isMetal() { return isMetal; } /** * Method to tell whether this layer function is diffusion (active). * @return true if this layer function is diffusion (active). */ public boolean isDiff() { if (this == DIFF || this == DIFFP || this == DIFFN) return true; return false; } /** * Method to tell whether this layer function is polysilicon. * @return true if this layer function is polysilicon. */ public boolean isPoly() { return isPoly || this == GATE; }; /** * Method to tell whether this layer function is polysilicon in the gate of a transistor. * @return true if this layer function is the gate of a transistor. */ public boolean isGatePoly() { if (isPoly() && (extraBits&INTRANS) != 0) return true; return false; } /** * Method to tell whether this layer function is a contact. * @return true if this layer function is contact. */ public boolean isContact() { return isContact; } /** * Method to tell whether this layer function is a well. * @return true if this layer function is a well. */ public boolean isWell() { if (this == WELL || this == WELLP || this == WELLN) return true; return false; } /** * Method to tell whether this layer function is substrate. * @return true if this layer function is substrate. */ public boolean isSubstrate() { if (this == SUBSTRATE || this == WELL || this == WELLP || this == WELLN || this == IMPLANT || this == IMPLANTN || this == IMPLANTP) return true; return false; } /** * Method to tell whether this layer function is implant. * @return true if this layer function is implant. */ public boolean isImplant() { return (this == IMPLANT || this == IMPLANTN || this == IMPLANTP); } /** * Method to tell whether this layer function is a dummy * @return true if this layer function is a dummy */ public boolean isDummy() { return (this == DMYDIFF || this == DMYPOLY1 || this == DMYPOLY2 || this == DMYPOLY3 || this == DMYMETAL1 || this == DMYMETAL2 || this == DMYMETAL3 || this == DMYMETAL4 || this == DMYMETAL5 || this == DMYMETAL6 || this == DMYMETAL7 || this == DMYMETAL8 || this == DMYMETAL9 || this == DMYMETAL10 || this == DMYMETAL11 || this == DMYMETAL12); } /** * Method to tell whether this layer function is a dummy exclusion * @return true if this layer function is a dummy exclusion */ public boolean isDummyExclusion() { return (this == DEXCLDIFF || this == DEXCLPOLY1 || this == DEXCLPOLY2 || this == DEXCLPOLY3 || this == DEXCLMETAL1 || this == DEXCLMETAL2 || this == DEXCLMETAL3 || this == DEXCLMETAL4 || this == DEXCLMETAL5 || this == DEXCLMETAL6 || this == DEXCLMETAL7 || this == DEXCLMETAL8 || this == DEXCLMETAL9 || this == DEXCLMETAL10 || this == DEXCLMETAL11 || this == DEXCLMETAL12); } /** * Method to tell whether this layer function is in subset * of layer functions restricted by specified number * of metals and polysilicons. * @param numMetals number of metals in subset. * @param numPolys number of polysilicons in subset * @return true if this layer function is in subset. */ public boolean isUsed(int numMetals, int numPolys) { if (isMetal || isContact) return level <= numMetals; else if (isPoly) return level <= numPolys; else return true; } /** * Method to tell the distance of this layer function. * @return the distance of this layer function. */ public int getHeight() { return height; } /** * A set of Layer.Functions */ public static class Set { final BitSet bits = new BitSet(); final int extraBits; // -1 means no check extraBits /** Set if all Layer.Functions */ public static final Set ALL = new Set(Function.class.getEnumConstants()); /** * Constructs Function.Set from a Function plus extra bits * @param f Function * @param extraB extra bits to check */ public Set(Function f, int extraB) { bits.set(f.ordinal()); extraBits = extraB; } /** * Constructs Function.Set from varargs Functions. * @param funs variable list of Functions. */ public Set(Function ... funs) { for (Function f: funs) bits.set(f.ordinal()); this.extraBits = noFunctionExtras; // same value as Layer.extraFunctions } /** * Constructs Function.Set from a collection of Functions. * @param funs a Collection of Functions. */ public Set(Collection<Function> funs) { for (Function f: funs) bits.set(f.ordinal()); this.extraBits = noFunctionExtras; // same value as Layer.extraFunctions; } /** * Returns true if specified Functions is in this Set. * @param f Function to test. * @param extraFunction * @return true if specified Functions is in this Set. */ public boolean contains(Function f, int extraFunction) { // Check first if there is a match in the extra bits boolean extraBitsM = extraBits == noFunctionExtras || (extraBits == extraFunction); return extraBitsM && bits.get(f.ordinal()); } } } /*************************************************************************************************** * Layer Comparators ***************************************************************************************************/ /** * A comparator object for sorting Layers by their name. * Created once because it is used often. */ public static final LayerSortByName layerSortByName = new LayerSortByName(); /** * Comparator class for sorting Layers by their name. */ private static class LayerSortByName implements Comparator<Layer> { /** * Method to compare two layers by their name. * @param l1 one layer. * @param l2 another layer. * @return an integer indicating their sorting order. */ public int compare(Layer l1, Layer l2) { String s1 = l1.getName(); String s2 = l2.getName();; return s1.compareToIgnoreCase(s2); } } /*************************************************************************************************** * End of Layer Comparators ***************************************************************************************************/ private final String name; private int index = -1; // contains index in technology or -1 for standalone layers private final Technology tech; private EGraphics graphics; private Function function; private static final int noFunctionExtras = 0; private int functionExtras; private boolean pseudo; private Setting cifLayerSetting; private Setting dxfLayerSetting;// private String gdsLayer; private Setting skillLayerSetting; private Setting resistanceSetting; private Setting capacitanceSetting;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -