📄 layer.java
字号:
private Setting edgeCapacitanceSetting; /** the pseudo layer (if exists) */ private Layer pseudoLayer; /** the "real" layer (if this one is pseudo) */ private Layer nonPseudoLayer; /** true if this layer is visible */ private boolean visible; /** true if this layer's visibity has been initialized */ private boolean visibilityInitialized; /** true if dimmed (drawn darker) undimmed layers are highlighted */ private boolean dimmed; /** the pure-layer node that contains just this layer */ private PrimitiveNode pureLayerNode; /** the Xml expression for size pf pure-layer node */ private Technology.Distance pureLayerNodeXmlSize;// private static Map<String,Pref> gdsLayerPrefs = new HashMap<String,Pref>(); private static final Map<Layer,Pref> layerVisibilityPrefs = new HashMap<Layer,Pref>(); // 3D options private static final Map<Layer,Pref> layer3DThicknessPrefs = new HashMap<Layer,Pref>(); private static final Map<Layer,Pref> layer3DDistancePrefs = new HashMap<Layer,Pref>(); private static final Map<Layer,Pref> layer3DTransModePrefs = new HashMap<Layer,Pref>(); // NONE is the default private static final Map<Layer,Pref> layer3DTransFactorPrefs = new HashMap<Layer,Pref>(); // 0 is the default private static final Map<Layer,Pref> areaCoveragePrefs = new HashMap<Layer,Pref>(); // Used by area coverage tool private Layer(String name, Technology tech, EGraphics graphics) { this.name = name; this.tech = tech; this.graphics = graphics; this.nonPseudoLayer = this; this.visible = true; visibilityInitialized = false; this.dimmed = false; this.function = Function.UNKNOWN; } /** * Method to create a new layer with the given name and graphics. * @param tech the Technology that this layer belongs to. * @param name the name of the layer. * @param graphics the appearance of the layer. * @return the Layer object. */ public static Layer newInstance(Technology tech, String name, EGraphics graphics) { if (tech == null) throw new NullPointerException(); int transparent = graphics.getFactoryTransparentLayer(); if (transparent != 0) { Color colorFromMap = tech.getFactoryColorMap()[1 << (transparent - 1)]; if ((colorFromMap.getRGB() & 0xFFFFFF) != graphics.getRGB()) throw new IllegalArgumentException(); } Layer layer = new Layer(name, tech, graphics); tech.addLayer(layer); if (graphics.getLayer() == null) graphics.setLayer(layer); return layer; } /** * Method to create a new layer with the given name and graphics. * Layer is not attached to any technology but still has a technology pointer. * @param name the name of the layer. * @param graphics the appearance of the layer. * @return the Layer object. */ public static Layer newInstanceFree(Technology tech, String name, EGraphics graphics) { Layer layer = new Layer(name, tech, graphics); graphics.setLayer(layer); return layer; } /** * Method to create a pseudo-layer for this Layer with a standard name "Pseudo-XXX". * @return the pseudo-layer. */ public Layer makePseudo() { assert pseudoLayer == null; String pseudoLayerName = "Pseudo-" + name; pseudoLayer = new Layer(pseudoLayerName, tech, graphics); pseudoLayer.setFunction(function, functionExtras, true); pseudoLayer.nonPseudoLayer = this; return pseudoLayer; } /** * Method to return the name of this Layer. * @return the name of this Layer. */ public String getName() { return name; } /** * Method to return the index of this Layer. * The index is 0-based. * @return the index of this Layer. */ public int getIndex() { return index; } /** * Method to set the index of this Layer. * The index is 0-based. * @param index the index of this Layer. */ public void setIndex(int index) { this.index = index; } /** * Method to return the Technology of this Layer. * @return the Technology of this Layer. */ public Technology getTechnology() { return tech; } /** * Method to return the graphics description of this Layer. * @return the graphics description of this Layer. */ public EGraphics getGraphics() { return graphics; } /** * Method to set the Function of this Layer. * @param function the Function of this Layer. */ public void setFunction(Function function) { this.function = function; this.functionExtras = noFunctionExtras; } /** * Method to set the Function of this Layer when the function is complex. * Some layer functions have extra bits of information to describe them. * For example, P-Type Diffusion has the Function DIFF but the extra bits PTYPE. * @param function the Function of this Layer. * @param functionExtras extra bits to describe the Function of this Layer. */ public void setFunction(Function function, int functionExtras) { setFunction(function, functionExtras, false); } /** * Method to set the Function of this Layer when the function is complex. * Some layer functions have extra bits of information to describe them. * For example, P-Type Diffusion has the Function DIFF but the extra bits PTYPE. * @param function the Function of this Layer. * @param functionExtras extra bits to describe the Function of this Layer. * @param pseudo true if the Layer is pseudo-layer */ public void setFunction(Function function, int functionExtras, boolean pseudo) { this.function = function; int numBits = 0; for (int i = 0; i < 32; i++) { if ((functionExtras & (1 << i)) != 0) numBits++; } if (numBits >= 2 && functionExtras != (DEPLETION|HEAVY) && functionExtras != (DEPLETION|LIGHT) && functionExtras != (ENHANCEMENT|HEAVY) && functionExtras != (ENHANCEMENT|LIGHT)) throw new IllegalArgumentException("functionExtras=" + Integer.toHexString(functionExtras)); this.functionExtras = functionExtras; this.pseudo = pseudo; } /** * Method to return the Function of this Layer. * @return the Function of this Layer. */ public Function getFunction() { return function; } /** * Method to return the Function "extras" of this Layer. * The "extras" are a set of modifier bits, such as "p-type". * @return the Function extras of this Layer. */ public int getFunctionExtras() { return functionExtras; } /** * Method to set the Pure Layer Node associated with this Layer. * @param pln the Pure Layer PrimitiveNode to use for this Layer. */ public void setPureLayerNode(PrimitiveNode pln) { pureLayerNode = pln; } /** * Method to make the Pure Layer Node associated with this Layer. * @param nodeName the name of the PrimitiveNode. * Primitive names may not contain unprintable characters, spaces, tabs, a colon (:), semicolon (;) or curly braces ({}). * @param size the width and the height of the PrimitiveNode. * @param style the Poly.Type this PrimitiveNode will generate (polygon, cross, etc.). * @return the Pure Layer PrimitiveNode to use for this Layer. */ public PrimitiveNode makePureLayerNode(String nodeName, double size, Poly.Type style, String portName, ArcProto ... connections) { Technology.Distance d = new Technology.Distance(); d.addLambda(size); return makePureLayerNode(nodeName, size, null, style, portName, connections); } /** * Method to make the Pure Layer Node associated with this Layer. * @param nodeName the name of the PrimitiveNode. * Primitive names may not contain unprintable characters, spaces, tabs, a colon (:), semicolon (;) or curly braces ({}). * @param size the width and the height of the PrimitiveNode. * @param xmlSize expression for default size of this pure layer node depending on tech parameters * @param style the Poly.Type this PrimitiveNode will generate (polygon, cross, etc.). * @return the Pure Layer PrimitiveNode to use for this Layer. */ public PrimitiveNode makePureLayerNode(String nodeName, double size, Technology.Distance xmlSize, Poly.Type style, String portName, ArcProto ... connections) { PrimitiveNode pln = PrimitiveNode.newInstance0(nodeName, tech, size, size, new Technology.NodeLayer [] { new Technology.NodeLayer(this, 0, style, Technology.NodeLayer.BOX, Technology.TechPoint.makeFullBox()) }); pln.addPrimitivePorts(new PrimitivePort[] { PrimitivePort.newInstance(tech, pln, connections, portName, 0,180, 0, PortCharacteristic.UNKNOWN, EdgeH.makeLeftEdge(), EdgeV.makeBottomEdge(), EdgeH.makeRightEdge(), EdgeV.makeTopEdge()) }); pln.setFunction(PrimitiveNode.Function.NODE); pln.setHoldsOutline(); pln.setSpecialType(PrimitiveNode.POLYGONAL); pureLayerNode = pln; pureLayerNodeXmlSize = xmlSize; return pln; } void resizePureLayerNode(Technology.DistanceContext context) { if (pureLayerNodeXmlSize == null) return; double lambdaSize = pureLayerNodeXmlSize.getLambda(context); pureLayerNode.setDefSize(lambdaSize, lambdaSize); } /** * Method to return the Pure Layer Node associated with this Layer. * @return the Pure Layer Node associated with this Layer. */ public PrimitiveNode getPureLayerNode() { return pureLayerNode; } /** * Method to tell whether this layer function is non-electrical. * Non-electrical layers do not carry any signal (for example, artwork, text). * @return true if this layer function is non-electrical. */ public boolean isNonElectrical() { return (functionExtras&Function.NONELEC) != 0; } /** * Method to determine if the layer function corresponds to a diffusion layer. * Used in parasitic calculation * @return true if this Layer is diffusion. */ public boolean isDiffusionLayer() { return !isPseudoLayer() && getFunction().isDiff(); } /** * Method to determine if the layer corresponds to a VT layer. Used in DRC * @return true if this layer is a VT layer. */ public boolean isVTImplantLayer() { return (function.isImplant() && (functionExtras&Layer.Function.HLVT) != 0); } /** * Method to determine if the layer corresponds to a poly cut layer. Used in 3D View * @return true if this layer is a poly cut layer. */ public boolean isPolyCutLayer() { return (function.isContact() && (functionExtras&Layer.Function.CONPOLY) != 0); } /** * Method to return true if this is pseudo-Layer. * Pseudo layers are those used in pins, and have no real geometry. * @return true if this is pseudo-layer. */ public boolean isPseudoLayer() { return pseudo; } /** * Method to return the pseudo layer associated with this real-Layer. * Pseudo layers are those used in pins, and have no real geometry. * @return the pseudo layer associated with this read-Layer. * If this layer is hass not pseudo, the null is returned. */ public Layer getPseudoLayer() { return pseudoLayer; } /** * Method to return the non-pseudo layer associated with this pseudo-Layer. * Pseudo layers are those used in pins, and have no real geometry. * @return the non-pseudo layer associated with this pseudo-Layer. * If this layer is already not pseudo, this layer is returned. */ public Layer getNonPseudoLayer() { return nonPseudoLayer; }// /**// * Method to set the non-pseudo layer associated with this pseudo-Layer.// * Pseudo layers are those used in pins, and have no real geometry.// * @param nonPseudoLayer the non-pseudo layer associated with this pseudo-Layer.// */// private void setNonPseudoLayer(Layer nonPseudoLayer) { this.nonPseudoLayer = nonPseudoLayer; } /** * Method to reset the graphics on this Layer. */ public void factoryResetGraphics() { if (tech == null) return; if (!visibilityInitialized)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -