📄 technology.java
字号:
nld.layer = getLayer().getNonPseudoLayer().getName(); nld.style = getStyle(); nld.portNum = getPortNum(); nld.inLayers = inLayers; nld.inElectricalLayers = inElectricalLayers; nld.representation = getRepresentation(); Technology.TechPoint[] points = getPoints(); if (nld.representation == Technology.NodeLayer.BOX || nld.representation == Technology.NodeLayer.MULTICUTBOX) { nld.lx.k = points[0].getX().getMultiplier()*2; nld.lx.addLambda(DBMath.round(points[0].getX().getAdder() + correction.getLambdaX()*points[0].getX().getMultiplier()*2)); nld.hx.k = points[1].getX().getMultiplier()*2; nld.hx.addLambda(DBMath.round(points[1].getX().getAdder() + correction.getLambdaX()*points[1].getX().getMultiplier()*2)); nld.ly.k = points[0].getY().getMultiplier()*2; nld.ly.addLambda(DBMath.round(points[0].getY().getAdder() + correction.getLambdaY()*points[0].getY().getMultiplier()*2)); nld.hy.k = points[1].getY().getMultiplier()*2; nld.hy.addLambda(DBMath.round(points[1].getY().getAdder() + correction.getLambdaY()*points[1].getY().getMultiplier()*2)); } else { for (Technology.TechPoint p: points) nld.techPoints.add(p.makeCorrection(correction)); } if (nld.representation == Technology.NodeLayer.MULTICUTBOX) { nld.sizex = DBMath.round(getMulticutSizeX()); nld.sizey = DBMath.round(getMulticutSizeY()); nld.sep1d = DBMath.round(getMulticutSep1D()); nld.sep2d = DBMath.round(getMulticutSep2D()); }// nld.sizeRule = sizeRule;// nld.sepRule = cutSep1DRule;// nld.sepRule2D = cutSep2DRule; if (isSerp) { nld.lWidth = DBMath.round(getSerpentineLWidth()); nld.rWidth = DBMath.round(getSerpentineRWidth()); nld.tExtent = DBMath.round(getSerpentineExtentT()); nld.bExtent = DBMath.round(getSerpentineExtentB()); } return nld; } XmlParam.NodeLayer makeXmlParam(boolean isSerp, EPoint correction, boolean inLayers, boolean inElectricalLayers) { XmlParam.NodeLayer nld = new XmlParam.NodeLayer(); nld.layer = getLayer().getNonPseudoLayer().getName(); nld.style = getStyle(); nld.portNum = getPortNum(); nld.inLayers = inLayers; nld.inElectricalLayers = inElectricalLayers; nld.representation = getRepresentation(); Technology.TechPoint[] points = getPoints(); if (nld.representation == Technology.NodeLayer.BOX || nld.representation == Technology.NodeLayer.MULTICUTBOX) { nld.lx.k = points[0].getX().getMultiplier()*2; nld.lx.addLambda(DBMath.round(points[0].getX().getAdder() + correction.getLambdaX()*points[0].getX().getMultiplier()*2)); nld.hx.k = points[1].getX().getMultiplier()*2; nld.hx.addLambda(DBMath.round(points[1].getX().getAdder() + correction.getLambdaX()*points[1].getX().getMultiplier()*2)); nld.ly.k = points[0].getY().getMultiplier()*2; nld.ly.addLambda(DBMath.round(points[0].getY().getAdder() + correction.getLambdaY()*points[0].getY().getMultiplier()*2)); nld.hy.k = points[1].getY().getMultiplier()*2; nld.hy.addLambda(DBMath.round(points[1].getY().getAdder() + correction.getLambdaY()*points[1].getY().getMultiplier()*2)); } else { for (Technology.TechPoint p: points) nld.techPoints.add(p.makeCorrection(correction)); } nld.sizeRule = sizeRule; nld.sepRule = cutSep1DRule; nld.sepRule2D = cutSep2DRule; if (isSerp) { nld.lWidth = DBMath.round(getSerpentineLWidth()); nld.rWidth = DBMath.round(getSerpentineRWidth()); nld.tExtent = DBMath.round(getSerpentineExtentT()); nld.bExtent = DBMath.round(getSerpentineExtentB()); } return nld; } void resize(DistanceContext context) { if (sizeRule != null) { double lambdaSize = context.getRule(sizeRule); cutGridSizeX = cutGridSizeY = (int)DBMath.lambdaToGrid(lambdaSize); double lambdaCutSep1D = context.getRule(cutSep1DRule); cutGridSep1D = (int)DBMath.lambdaToGrid(lambdaCutSep1D); if (cutSep2DRule != null) { double lambdaCutSep2D = context.getRule(cutSep2DRule); cutGridSep2D = (int)DBMath.lambdaToGrid(lambdaCutSep2D); } else { cutGridSep2D = cutGridSep1D; } } } } public class SizeCorrector { public final HashMap<ArcProtoId,Integer> arcExtends = new HashMap<ArcProtoId,Integer>(); public final HashMap<PrimitiveNodeId,EPoint> nodeExtends = new HashMap<PrimitiveNodeId,EPoint>(); private SizeCorrector(Version version, boolean isJelib) { int techVersion = 0; if (isJelib) { if (version.compareTo(DISK_VERSION_2) >= 0) techVersion = 2; else if (version.compareTo(DISK_VERSION_1) >= 0) techVersion = 1; } for (ArcProto ap: arcs.values()) { int correction = 0; switch (techVersion) { case 0: correction = ap.getGridBaseExtend() + (int)DBMath.lambdaToGrid(0.5*ap.getLambdaElibWidthOffset()); break; case 1: correction = ap.getGridBaseExtend(); break; } arcExtends.put(ap.getId(), Integer.valueOf(correction)); } for (PrimitiveNode pn: nodes.values()) { EPoint correction = techVersion == 2 ? EPoint.ORIGIN : pn.getSizeCorrector(techVersion);// switch (techVersion) {// case 0:// correction = EPoint.fromGrid(-pn.sizeCorrector.getGridX(), -pn.sizeCorrector.getGridY());// break;// case 1:// SizeOffset so = pn.getProtoSizeOffset();// double lambdaX = -0.5*(so.getLowXOffset() + so.getHighXOffset()) - pn.sizeCorrector.getLambdaX();// double lambdaY = -0.5*(so.getLowYOffset() + so.getHighYOffset()) - pn.sizeCorrector.getLambdaY();// correction = EPoint.fromLambda(lambdaX, lambdaY);// break;// } nodeExtends.put(pn.getId(), correction); } } public boolean isIdentity() { for (Integer arcExtend: arcExtends.values()) { if (arcExtend.intValue() != 0) return false; } for (EPoint nodeExtend: nodeExtends.values()) { if (nodeExtend.getX() != 0 || nodeExtend.getY() != 0) return false; } return true; } public long getExtendFromDisk(ArcProto ap, double width) { return DBMath.lambdaToGrid(0.5*width) - arcExtends.get(ap.getId()).longValue(); } public long getExtendToDisk(ImmutableArcInst a) { return a.getGridExtendOverMin() + arcExtends.get(a.protoId).intValue(); } public long getWidthToDisk(ImmutableArcInst a) { return 2*getExtendToDisk(a); } public EPoint getSizeFromDisk(PrimitiveNode pn, double width, double height) { EPoint correction = nodeExtends.get(pn.getId()); return EPoint.fromLambda(width - 2*correction.getLambdaX(), height - 2*correction.getLambdaY()); } public EPoint getSizeToDisk(ImmutableNodeInst n) { EPoint size = n.size; EPoint correction = nodeExtends.get(n.protoId); if (!correction.equals(EPoint.ORIGIN)) { size = EPoint.fromLambda(size.getLambdaX() + 2*correction.getLambdaX(), size.getLambdaY() + 2*correction.getLambdaY()); } return size; } } public SizeCorrector getSizeCorrector(Version version, Map<Setting,Object> projectSettings, boolean isJelib, boolean keepExtendOverMin) { return new SizeCorrector(version, isJelib); } protected void setArcCorrection(SizeCorrector sc, String arcName, double lambdaBaseWidth) { ArcProto ap = findArcProto(arcName); Integer correction = sc.arcExtends.get(ap.getId()); int gridBaseExtend = (int)DBMath.lambdaToGrid(0.5*lambdaBaseWidth); if (gridBaseExtend != ap.getGridBaseExtend()) { correction = Integer.valueOf(correction.intValue() + gridBaseExtend - ap.getGridBaseExtend()); sc.arcExtends.put(ap.getId(), correction); } } /** technology is not electrical */ private static final int NONELECTRICAL = 01; /** has no directional arcs */ private static final int NODIRECTIONALARCS = 02; /** has no negated arcs */ private static final int NONEGATEDARCS = 04; /** nonstandard technology (cannot be edited) */ private static final int NONSTANDARD = 010; /** statically allocated (don't deallocate memory) */ private static final int STATICTECHNOLOGY = 020; /** no primitives in this technology (don't auto-switch to it) */ private static final int NOPRIMTECHNOLOGY = 040; /** the current technology in Electric */ private static Technology curTech = null; /** the current tlayout echnology in Electric */ private static Technology curLayoutTech = null; /** counter for enumerating technologies */ private static int techNumber = 0; /** Generic technology for this Technology */ final Generic generic; /** name of this technology */ private final TechId techId; /** short, readable name of this technology */ private String techShortName; /** full description of this technology */ private String techDesc; /** flags for this technology */ private int userBits; /** 0-based index of this technology */ private int techIndex; /** true if "scale" is relevant to this technology */ private boolean scaleRelevant; /** number of transparent layers in technology */ private int transparentLayers; /** Settings for this Technology */ private final HashMap<String,Setting> settingsByXmlPath = new HashMap<String,Setting>(); /** preferences group for this technology */ private final Pref.Group prefs; /** User preferences group for this tecnology */ private final Pref.Group userPrefs; /** the saved transparent colors for this technology */ private Pref [] transparentColorPrefs; /** the color map for this technology */ private Color [] colorMap; /** list of layers in this technology */ private final List<Layer> layers = new ArrayList<Layer>(); /** map from layer names to layers in this technology */private final HashMap<String,Layer> layersByName = new HashMap<String,Layer>(); /** True when layer allocation is finished. */ private boolean layersAllocationLocked; /** list of primitive nodes in this technology */ private final LinkedHashMap<String,PrimitiveNode> nodes = new LinkedHashMap<String,PrimitiveNode>(); /** array of nodes by nodeId.chronIndex */ private PrimitiveNode[] nodesByChronIndex = {}; /** Old names of primitive nodes */ protected final HashMap<String,PrimitiveNode> oldNodeNames = new HashMap<String,PrimitiveNode>(); /** count of primitive nodes in this technology */ private int nodeIndex = 0; /** list of arcs in this technology */ private final LinkedHashMap<String,ArcProto> arcs = new LinkedHashMap<String,ArcProto>(); /** array of arcs by arcId.chronIndex */ private ArcProto[] arcsByChronIndex = {}; /** Old names of arcs */ protected final HashMap<String,ArcProto> oldArcNames = new HashMap<String,ArcProto>(); /** Spice header cards, level 1. */ private String [] spiceHeaderLevel1; /** Spice header cards, level 2. */ private String [] spiceHeaderLevel2; /** Spice header cards, level 3. */ private String [] spiceHeaderLevel3; /** resolution for this Technology */ private Pref prefResolution; /** static list of all Manufacturers in Electric */ protected final List<Foundry> foundries = new ArrayList<Foundry>(); /** default foundry for this Technology */ private final Setting cacheFoundry; /** scale for this Technology. */ private Setting cacheScale; /** number of metals for this Technology. */ private final Setting cacheNumMetalLayers; /** Minimum resistance for this Technology. */ private Setting cacheMinResistance; /** Minimum capacitance for this Technology. */ private Setting cacheMinCapacitance; /** Gate Length subtraction (in microns) for this Tech*/private final Setting cacheGateLengthSubtraction; /** Include gate in Resistance calculation */ private final Setting cacheIncludeGate; /** Include ground network in parasitics calculation */ private final Setting cacheIncludeGnd; /** Include ground network in parasitics calculation */ private final Setting cacheMaxSeriesResistance;// /** Logical effort global fanout preference. */ private final Setting cacheGlobalFanout;// /** Logical effort convergence (epsilon) preference. */ private final Setting cacheConvergenceEpsilon;// /** Logical effort maximum iterations preference. */ private final Setting cacheMaxIterations; /** Logical effort gate capacitance preference. */ private Setting cacheGateCapacitance; /** Logical effort wire ratio preference. */ private Setting cacheWireRatio; /** Logical effort diff alpha preference. */ private Setting cacheDiffAlpha;// /** Logical effort keeper ratio preference. */ private final Setting cacheKeeperRatio;// /** Default Logical effort global fanout. */ private static double DEFAULT_GLOBALFANOUT = 4.7;// /** Default Logical effort convergence (epsilon). */ private static double DEFAULT_EPSILON = 0.001;// /** Default Logical effort maximum iterations. */ private static int DEFAULT_MAXITER = 30;// /** Default Logical effort keeper ratio. */ private static double DEFAULT_KEEPERRATIO = 0.1; /** Default Logical effort gate capacitance. */ private static double DEFAULT_GATECAP = 0.4; /** Default Logical effort wire ratio. */ private static double DEFAULT_WIRERATIO = 0.16; /** Default Logical effort diff alpha. */ private static double DEFAULT_DIFFALPHA = 0.7; /** To group elements for the component menu */ protected Object[][] nodeGroups; /** Default element groups for the component menu */ protected Object[][] factoryNodeGroups; /** indicates n-type objects. */ public static final int N_TYPE = 1; /** indicates p-type objects. */ public static final int P_TYPE = 0; /** Factory rules for the technology. */ protected XMLRules factoryRules = null; /** Cached rules for the technology. */ protected XMLRules cachedRules = null; /** Xml representation of this Technology */ protected Xml.Technology xmlTech; /** Preference for saving component menus */ private Pref componentMenuPref = null; /** Preference for saving layer order */ private Pref layerOrderPref = null; /****************************** CONTROL ******************************/ /** * Constructs a <CODE>Technology</CODE>. * This should not be called directly, but instead is invoked through each subclass's factory. */ protected Technology(Generic generic, String techName) { this(generic, techName, Foundry.Type.NONE, 0); } /** * Constructs a <CODE>Technology</CODE>. * This should not be called directly, but instead is invoked through each subclass's factory. */ protected Technology(Generic generic, String techName, Foundry.Type defaultFoundry, int defaultNumMetals) { this(generic.getId().idManager, generic,techName, defaultFoundry, defaultNumMetals); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -