📄 mosrules.java
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: MOSRules.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.technologies.utils;import com.sun.electric.database.text.TextUtils;import com.sun.electric.database.topology.Geometric;import com.sun.electric.technology.DRCRules;import com.sun.electric.technology.DRCTemplate;import com.sun.electric.technology.Layer;import com.sun.electric.technology.PrimitiveNode;import com.sun.electric.technology.Technology;import java.util.Iterator;import java.util.List;import java.util.ArrayList;/** * Class to define a complete set of design rules. * Includes constructors for initializing the data from a technology. */public class MOSRules implements DRCRules { /** the technology */ private Technology tech; /** number of layers in the technology */ public int numLayers; /** size of upper-triangle of layers */ public int uTSize; /** width limit that triggers wide rules */ public Double wideLimit; /** names of layers */ public String [] layerNames; /** minimum width of layers */ public Double [] minWidth; /** minimum width rules */ public String [] minWidthRules; /** minimum distances when connected */ public Double [] conList; /** minimum distance ruless when connected */ public String [] conListRules; /** minimum distance ruless when connected */ public String [] conListNodes; /** minimum distances when unconnected */ public Double [] unConList; /** minimum distance rules when unconnected */ public String [] unConListRules; /** minimum distance rules when unconnected */ public String [] unConListNodes; /** minimum distances when connected (wide) */ public Double [] conListWide; /** minimum distance rules when connected (wide) */ public String [] conListWideRules; /** minimum distances when unconnected (wide) */ public Double [] unConListWide; /** minimum distance rules when unconnected (wide) */ public String [] unConListWideRules; /** minimum distances when connected (multi-cut) */ public Double [] conListMulti; /** minimum distance rules when connected (multi-cut) */ public String [] conListMultiRules; /** minimum distances when unconnected (multi-cut) */ public Double [] unConListMulti; /** minimum distance rules when unconnected (multi-cut) */ public String [] unConListMultiRules; /** minimum edge distances */ public Double [] edgeList; /** minimum edge distance rules */ public String [] edgeListRules; /** minimum area rules */ public Double [] minArea; /** minimum area rule names */ public String [] minAreaRules; /** maximum slot size rules */ public Double [] slotSize; /** maximum slot size rule names */ public String [] slotSizeRules; /** number of nodes in the technology */ public int numNodes; /** names of nodes */ public String [] nodeNames; /** minimim node size in the technology */ public Double [] minNodeSize; /** minimim node size rules */ public String [] minNodeSizeRules; /** cut size in the technology */ public Double [] cutNodeSize; /** cut size rules */ public String [] cutNodeSizeRules; /** cut 1D spacing in the technology */ public Double [] cutNodeSpa1D; /** cut 1D s[acing rules */ public String [] cutNodeSpa1DRules; /** cut 2D spacing in the technology */ public Double [] cutNodeSpa2D; /** cut 2D s[acing rules */ public String [] cutNodeSpa2DRules; /** Only 1 surround per contact node! **/ /** cut surround in the technology */ public Double [] cutNodeSurround; /** cut surround rules */ public String [] cutNodeSurroundRules; /** poly overhang/surround along gate **/ public double transPolyOverhang; /** number of rules stored */ private int numberOfRules; /** DEFAULT null rule */ private final static int MOSNORULE = -1; public MOSRules() {} /** * Method to set minimum node size * @param index represents node, widths are stored in index*2 and height in index*2+j * @param name * @param width * @param height */ private void setMinNodeSize(int index, String name, double width, double height) { minNodeSizeRules[index] = name; minNodeSize[index*2] = new Double(width); minNodeSize[index*2+1] = new Double(height); } /** * * @param index represents node, widths are stored in index*2 and height in index*2+j * @param when represents the foundry being used * @return a rule describing the minimum node size. */ public DRCTemplate getMinNodeSize(int index, int when) { // That division by 2 might be a problem double[] vals = {minNodeSize[index*2].doubleValue(), minNodeSize[index*2+1].doubleValue()}; // width and height DRCTemplate rule = new DRCTemplate(minNodeSizeRules[index], when, DRCTemplate.DRCRuleType.NODSIZ, 0, 0, null, null, vals, -1); return (rule); } /** * Method to determine the technology associated with this rules set. * @return the technology associated with this rules set. */ public Technology getTechnology() {return tech;} public MOSRules(Technology t) { this.tech = t; // compute sizes numLayers = tech.getNumLayers(); numNodes = tech.getNumNodes(); int numIndices = numLayers + numNodes; uTSize = (numIndices * numIndices + numIndices) / 2; //uTSize = (numLayers * numLayers + numLayers) / 2; // initialize the width limit wideLimit = new Double(0); // add names layerNames = new String[numLayers]; int j = 0; for(Iterator<Layer> it = tech.getLayers(); it.hasNext(); ) { Layer layer = it.next(); layerNames[j++] = layer.getName(); } nodeNames = new String[numNodes]; j = 0; for(Iterator<PrimitiveNode> it = tech.getNodes(); it.hasNext(); ) { PrimitiveNode np = it.next(); nodeNames[j++] = np.getName(); } // allocate tables conList = new Double[uTSize]; conListRules = new String[uTSize]; conListNodes = new String[uTSize]; unConList = new Double[uTSize]; unConListRules = new String[uTSize]; unConListNodes = new String[uTSize]; conListWide = new Double[uTSize]; conListWideRules = new String[uTSize]; unConListWide = new Double[uTSize]; unConListWideRules = new String[uTSize]; conListMulti = new Double[uTSize]; conListMultiRules = new String[uTSize]; unConListMulti = new Double[uTSize]; unConListMultiRules = new String[uTSize]; edgeList = new Double[uTSize]; edgeListRules = new String[uTSize]; minWidth = new Double[numLayers]; minWidthRules = new String[numLayers]; minArea = new Double[numLayers]; minAreaRules = new String[numLayers]; slotSize = new Double[numLayers]; slotSizeRules = new String[numLayers]; // clear all tables for(int i=0; i<uTSize; i++) { conList[i] = new Double(MOSNORULE); conListRules[i] = ""; unConList[i] = new Double(MOSNORULE); unConListRules[i] = ""; conListWide[i] = new Double(MOSNORULE); conListWideRules[i] = ""; unConListWide[i] = new Double(MOSNORULE); unConListWideRules[i] = ""; conListMulti[i] = new Double(MOSNORULE); conListMultiRules[i] = ""; unConListMulti[i] = new Double(MOSNORULE); unConListMultiRules[i] = ""; edgeList[i] = new Double(MOSNORULE); edgeListRules[i] = ""; } for(int i=0; i<numLayers; i++) { minWidth[i] = new Double(MOSNORULE); minWidthRules[i] = ""; minArea[i] = new Double(MOSNORULE); minAreaRules[i] = ""; slotSize[i] = new Double(MOSNORULE); slotSizeRules[i] = ""; } // build node size tables minNodeSize = new Double[numNodes*2]; minNodeSizeRules = new String[numNodes]; cutNodeSize = new Double[numNodes]; cutNodeSizeRules = new String[numNodes]; cutNodeSurround = new Double[numNodes]; cutNodeSurroundRules = new String[numNodes]; cutNodeSpa1D = new Double[numNodes]; cutNodeSpa1DRules = new String[numNodes]; cutNodeSpa2D = new Double[numNodes]; cutNodeSpa2DRules = new String[numNodes]; j = 0; for(Iterator<PrimitiveNode> it = tech.getNodes(); it.hasNext(); ) { PrimitiveNode np = it.next(); PrimitiveNode.NodeSizeRule minSizeRule = np.getMinSizeRule(); minNodeSize[j*2] = minSizeRule != null ? minSizeRule.getWidth() : 0; // autoboxing minNodeSize[j*2+1] = minSizeRule != null ? minSizeRule.getHeight() : 0; // autoboxing minNodeSizeRules[j] = minSizeRule != null ? minSizeRule.getRuleName() : ""; cutNodeSizeRules[j] = ""; cutNodeSize[j] = new Double(MOSNORULE); cutNodeSurroundRules[j] = ""; cutNodeSurround[j] = new Double(MOSNORULE); cutNodeSpa1DRules[j] = ""; cutNodeSpa1D[j] = new Double(MOSNORULE); cutNodeSpa2DRules[j] = ""; cutNodeSpa2D[j] = new Double(MOSNORULE); j++; } } /** * Method to determine the index in the upper-left triangle array for two layers/nodes. This function * assumes no rules for primitives nor single layers are stored. * @param index1 the first layer/node index. * @param index2 the second layer/node index. * @return the index in the array that corresponds to these two layers/nodes. */ public int getRuleIndex(int index1, int index2) { return getRuleIndex(index1, index2, tech.getNumLayers()); } /** * Method to determine the index in the upper-left triangle array for two layers/nodes. This function * assumes no rules for primitives nor single layers are stored. * @param index1 the first layer/node index. * @param index2 the second layer/node index. * @param numLayers the number of layers * @return the index in the array that corresponds to these two layers/nodes. */ public static int getRuleIndex(int index1, int index2, int numLayers) { if (index1 > index2) { int temp = index1; index1 = index2; index2 = temp; } int pIndex = (index1+1) * (index1/2) + (index1&1) * ((index1+1)/2); pIndex = index2 + numLayers * index1 - pIndex; return pIndex; } /** * Method to return overhang of poly in transistors along the gate * @return the overhang of poly in transistors along the gate. */ public double getPolyOverhang() { return transPolyOverhang; } /** * Method to determine if given node is not allowed by foundry. * @param nodeIndex index of node in DRC rules map to examine. * @param type rule type. * @return the rule if this is a forbidden node otherwise returns null. */ public DRCTemplate isForbiddenNode(int nodeIndex, DRCTemplate.DRCRuleType type) { return null; }// /**// * Method to create a set of Design Rules from some simple spacing arrays.// * Used by simpler technologies that do not have full-sets of design rules.// * @param tech the Technology to load.// * @param conDist an upper-diagonal array of layer-to-layer distances (when connected).// * @param unConDist an upper-diagonal array of layer-to-layer distances (when unconnected).// * @return a set of design rules for the Technology.// */// public static DRCRules makeSimpleRules(Technology tech, double [] conDist, double [] unConDist)// {// MOSRules rules = new MOSRules(tech);// if (conDist != null)// {// for(int i=0; i<conDist.length; i++)// {// rules.conList[i] = (conDist[i]); // autoboxing// }// }// if (unConDist != null)// {// for(int i=0; i<unConDist.length; i++)// {// rules.unConList[i] = (unConDist[i]); // autoboxing// }// }// rules.calculateNumberOfRules();// return rules;// } /** * Method to find the worst spacing distance in the design rules. * Finds the largest spacing rule in the Technology. * @return the largest spacing distance in the Technology. Zero if nothing found * @param lastMetal */ public double getWorstSpacingDistance(int lastMetal) { assert(lastMetal == -1); // not implemented for only metals yet double worstInteractionDistance = 0; for(int i = 0; i < uTSize; i++) { double dist = unConList[i]; if (dist > worstInteractionDistance) worstInteractionDistance = dist; dist = unConListWide[i]; if (dist > worstInteractionDistance) worstInteractionDistance = dist; dist = unConListMulti[i]; if (dist > worstInteractionDistance) worstInteractionDistance = dist; } return worstInteractionDistance;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -