?? technology.java
字號:
/** * Constructs a <CODE>Technology</CODE>. * This should not be called directly, but instead is invoked through each subclass's factory. */ protected Technology(IdManager idManager, Generic generic, String techName, Foundry.Type defaultFoundry, int defaultNumMetals) { if (this instanceof Generic) { assert generic == null; generic = (Generic)this; } this.generic = generic; this.techId = idManager.newTechId(techName); //this.scale = 1.0; this.scaleRelevant = true; this.techIndex = techNumber++; userBits = 0; prefs = Pref.groupForPackage(Generic.class, true); userPrefs = Pref.groupForPackage(User.class, true);// ercPrefs = Pref.groupForPackage(ERC.class, true); cacheFoundry = makeStringSetting("SelectedFoundryFor"+techName, "Technology tab", techName + " foundry", "Foundry", defaultFoundry.getName().toUpperCase()); cacheNumMetalLayers = makeIntSetting(techName + "NumberOfMetalLayers", "Technology tab", techName + ": Number of Metal Layers", "NumMetalLayers", defaultNumMetals); cacheMaxSeriesResistance = makeParasiticSetting("MaxSeriesResistance", 10.0); cacheGateLengthSubtraction = makeParasiticSetting("GateLengthSubtraction", 0.0); cacheIncludeGate = makeParasiticSetting("Gate Inclusion", false); cacheIncludeGnd = makeParasiticSetting("Ground Net Inclusion", false);// cacheGlobalFanout = makeLESetting("GlobalFanout", DEFAULT_GLOBALFANOUT);// cacheConvergenceEpsilon = makeLESetting("ConvergenceEpsilon", DEFAULT_EPSILON);// cacheMaxIterations = makeLESetting("MaxIterations", DEFAULT_MAXITER);// cacheGateCapacitance = makeLESetting("GateCapacitance", DEFAULT_GATECAP);// cacheWireRatio = makeLESetting("WireRatio", DEFAULT_WIRERATIO);// cacheDiffAlpha = makeLESetting("DiffAlpha", DEFAULT_DIFFALPHA);// cacheKeeperRatio = makeLESetting("KeeperRatio", DEFAULT_KEEPERRATIO); } protected Object writeReplace() { return new TechnologyKey(this); } private static class TechnologyKey extends EObjectInputStream.Key<Technology> { public TechnologyKey() {} private TechnologyKey(Technology tech) { super(tech); } @Override public void writeExternal(EObjectOutputStream out, Technology tech) throws IOException { TechId techId = tech.getId(); if (techId.idManager != out.getIdManager()) throw new NotSerializableException(tech + " from other IdManager"); if (out.getDatabase().getTechPool().getTech(techId) != tech) throw new NotSerializableException(tech + " not linked"); out.writeInt(techId.techIndex); } @Override public Technology readExternal(EObjectInputStream in) throws IOException, ClassNotFoundException { int techIndex = in.readInt(); TechId techId = in.getIdManager().getTechId(techIndex); Technology tech = in.getDatabase().getTech(techId); if (tech == null) throw new InvalidObjectException(techId + " not linked"); return tech; } } public Technology(Generic generic, Xml.Technology t) { this(generic, t.techName, Foundry.Type.valueOf(t.defaultFoundry), t.defaultNumMetals); xmlTech = t; setTechShortName(t.shortTechName); setTechDesc(t.description); setFactoryScale(t.scaleValue, t.scaleRelevant); setFactoryParasitics(t.minResistance, t.minCapacitance); if (!t.transparentLayers.isEmpty()) setFactoryTransparentLayers(t.transparentLayers.toArray(new Color[t.transparentLayers.size()])); HashMap<String,Layer> layers = new HashMap<String,Layer>(); for (Xml.Layer l: t.layers) { Layer layer = Layer.newInstance(this, l.name, l.desc); layers.put(l.name, layer); layer.setFunction(l.function, l.extraFunction); if (l.cif != null) layer.setFactoryCIFLayer(l.cif); if (l.skill != null) layer.setFactorySkillLayer(l.skill); layer.setFactory3DInfo(l.thick3D, l.height3D, l.mode3D, l.factor3D); layer.setFactoryParasitics(l.resistance, l.capacitance, l.edgeCapacitance); } HashMap<String,ArcProto> arcs = new HashMap<String,ArcProto>(); for (Xml.ArcProto a: t.arcs) { if (findArcProto(a.name) != null) { System.out.println("Error: technology " + getTechName() + " has multiple arcs named " + a.name); continue; } ArcLayer[] arcLayers = new ArcLayer[a.arcLayers.size()];// long minGridExtend = Long.MAX_VALUE;// long maxGridExtend = Long.MIN_VALUE;// for (int i = 0; i < arcLayers.length; i++) {// Xml.ArcLayer al = a.arcLayers.get(i);// long gridLayerExtend = DBMath.lambdaToGrid(al.extend.getLambda(context));// minGridExtend = Math.min(minGridExtend, gridLayerExtend);// maxGridExtend = Math.max(maxGridExtend, gridLayerExtend);// }// if (maxGridExtend < 0 || maxGridExtend > Integer.MAX_VALUE/8) {// System.out.println("ArcProto " + getTechName() + ":" + a.name + " has invalid width offset " + DBMath.gridToLambda(2*maxGridExtend));// continue;// }// long gridFullExtend = minGridExtend + DBMath.lambdaToGrid(a.elibWidthOffset*0.5); for (int i = 0; i < arcLayers.length; i++) { Xml.ArcLayer al = a.arcLayers.get(i); Distance d = new Distance(); d.addLambda(al.extend.value); arcLayers[i] = new ArcLayer(layers.get(al.layer),al.style, d); }// if (minGridExtend < 0 || minGridExtend != DBMath.lambdaToGrid(a.arcLayers.get(0).extend.getLambda(context)))// assert true; Double diskOffset1 = a.diskOffset.get(Integer.valueOf(1)); Double diskOffset2 = a.diskOffset.get(Integer.valueOf(2)); long halfElibWidthOffset = 0; if (diskOffset1 != null && diskOffset2 != null) halfElibWidthOffset = DBMath.lambdaToGrid(diskOffset1.doubleValue() - diskOffset2.doubleValue()); ArcProto ap = new ArcProto(this, a.name, halfElibWidthOffset, 0, a.function, arcLayers, arcs.size());// ArcProto ap = new ArcProto(this, a.name, (int)maxGridExtend, (int)minGridExtend, defaultWidth, a.function, arcLayers, arcs.size()); addArcProto(ap); if (a.oldName != null) oldArcNames.put(a.oldName, ap); arcs.put(a.name, ap); if (a.wipable) ap.setWipable(); if (a.curvable) ap.setCurvable(); if (a.special) ap.setSpecialArc(); if (a.notUsed) ap.setNotUsed(true); if (a.skipSizeInPalette) ap.setSkipSizeInPalette(); ap.setFactoryExtended(a.extended); ap.setFactoryFixedAngle(a.fixedAngle); ap.setFactoryAngleIncrement(a.angleIncrement); ERC.getERCTool().setAntennaRatio(ap, a.antennaRatio);// if (a.arcPin != null)// ap.makeWipablePin(a.arcPin.name, a.arcPin.portName, a.arcPin.elibSize, makeConnections(a.arcPin.portArcs, arcs)); } setNoNegatedArcs(); DistanceContext context = EMPTY_CONTEXT; for (Xml.PrimitiveNode n: t.nodes) { EPoint sizeCorrector1 = n.diskOffset.get(Integer.valueOf(1)); EPoint sizeCorrector2 = n.diskOffset.get(Integer.valueOf(2)); if (sizeCorrector2 == null) sizeCorrector2 = EPoint.ORIGIN; if (sizeCorrector1 == null) sizeCorrector1 = sizeCorrector2; String minSizeRule = null; long lx, hx, ly, hy; if (n.nodeSizeRule != null) { hx = DBMath.lambdaToGrid(0.5*n.nodeSizeRule.width); lx = -hx; hy = DBMath.lambdaToGrid(0.5*n.nodeSizeRule.height); ly = -hy; minSizeRule = n.nodeSizeRule.rule; } else { lx = Long.MAX_VALUE; hx = Long.MIN_VALUE; ly = Long.MAX_VALUE; hy = Long.MIN_VALUE; for (int i = 0; i < n.nodeLayers.size(); i++) { Xml.NodeLayer nl = n.nodeLayers.get(i); long x, y; if (nl.representation == NodeLayer.BOX || nl.representation == NodeLayer.MULTICUTBOX) { x = DBMath.lambdaToGrid(nl.lx.value); lx = Math.min(lx, x); hx = Math.max(hx, x); x = DBMath.lambdaToGrid(nl.hx.value); lx = Math.min(lx, x); hx = Math.max(hx, x); y = DBMath.lambdaToGrid(nl.ly.value); ly = Math.min(ly, y); hy = Math.max(hy, y); y = DBMath.lambdaToGrid(nl.hy.value); ly = Math.min(ly, y); hy = Math.max(hy, y); } else { for (TechPoint p: nl.techPoints) { x = p.x.getGridAdder(); lx = Math.min(lx, x); hx = Math.max(hx, x); y = p.y.getGridAdder(); ly = Math.min(ly, y); hy = Math.max(hy, y); } } } } ERectangle fullRectangle = ERectangle.fromGrid(lx, ly, hx - lx, hy - ly); EPoint fullSize = EPoint.fromGrid((hx - lx + 1)/2, (hy - ly + 1)/2); boolean needElectricalLayers = false; ArrayList<NodeLayer> nodeLayers = new ArrayList<NodeLayer>(); ArrayList<NodeLayer> electricalNodeLayers = new ArrayList<NodeLayer>(); for (int i = 0; i < n.nodeLayers.size(); i++) { Xml.NodeLayer nl = n.nodeLayers.get(i); TechPoint[] techPoints; if (nl.representation == NodeLayer.BOX || nl.representation == NodeLayer.MULTICUTBOX) { techPoints = new TechPoint[2]; if (nl.lx.value > nl.hx.value || nl.lx.k > nl.hx.k || nl.ly.value > nl.hy.value || nl.ly.k > nl.hy.k) System.out.println("Strange polygon in " + getTechName() + ":" + n.name); techPoints[0] = makeTechPoint(nl.lx, nl.ly, context, fullSize); techPoints[1] = makeTechPoint(nl.hx, nl.hy, context, fullSize); } else { techPoints = nl.techPoints.toArray(new TechPoint[nl.techPoints.size()]); for (int j = 0; j < techPoints.length; j++) techPoints[j] = makeTechPoint(techPoints[j], fullSize); } NodeLayer nodeLayer; Layer layer = layers.get(nl.layer); if (n.shrinkArcs) { if (layer.getPseudoLayer() == null) layer.makePseudo(); layer = layer.getPseudoLayer(); } if (nl.representation == NodeLayer.MULTICUTBOX) { nodeLayer = NodeLayer.makeMulticut(layer, nl.portNum, nl.style, techPoints, nl.sizex, nl.sizey, nl.sep1d, nl.sep2d); } else if (n.specialType == PrimitiveNode.SERPTRANS) nodeLayer = new NodeLayer(layer, nl.portNum, nl.style, nl.representation, techPoints, nl.lWidth, nl.rWidth, nl.tExtent, nl.bExtent); else nodeLayer = new NodeLayer(layer, nl.portNum, nl.style, nl.representation, techPoints); if (!(nl.inLayers && nl.inElectricalLayers)) needElectricalLayers = true; if (nl.inLayers) nodeLayers.add(nodeLayer); if (nl.inElectricalLayers) electricalNodeLayers.add(nodeLayer); } if (n.sizeOffset != null) { lx += n.sizeOffset.getLowXGridOffset(); hx -= n.sizeOffset.getHighXGridOffset(); ly += n.sizeOffset.getLowYGridOffset(); hy -= n.sizeOffset.getHighYGridOffset(); } ERectangle baseRectangle = ERectangle.fromGrid(lx, ly, hx - lx, hy - ly); PrimitiveNode pnp = PrimitiveNode.newInstance(n.name, this, sizeCorrector1, sizeCorrector2, minSizeRule, DBMath.round(n.defaultWidth.value + 2*fullSize.getLambdaX()), DBMath.round(n.defaultHeight.value + 2*fullSize.getLambdaY()), fullRectangle, baseRectangle, nodeLayers.toArray(new NodeLayer[nodeLayers.size()])); if (n.oldName != null) oldNodeNames.put(n.oldName, pnp); pnp.setFunction(n.function); if (needElectricalLayers) pnp.setElectricalLayers(electricalNodeLayers.toArray(new NodeLayer[electricalNodeLayers.size()])); if (n.shrinkArcs) { pnp.setArcsWipe(); pnp.setArcsShrink(); } if (n.square) pnp.setSquare(); if (n.canBeZeroSize) pnp.setCanBeZeroSize(); if (n.wipes) pnp.setWipeOn1or2(); if (n.lockable) pnp.setLockedPrim(); if (n.edgeSelect) pnp.setEdgeSelect(); if (n.skipSizeInPalette) pnp.setSkipSizeInPalette(); if (n.notUsed) pnp.setNotUsed(true); if (n.lowVt) pnp.setNodeBit(PrimitiveNode.LOWVTBIT); if (n.highVt)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -