⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lenetlister1.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            } else {                var = ni.getParameterOrVariable(ATTR_L);                if (var == null) {                    System.out.println("Error, no L attribute found on LEWIRE "+info.getContext().push(ni).getInstPath("."));                }                float len = VarContext.objectToFloat(info.getContext().evalVar(var), 0.0f);                var = ni.getParameterOrVariable(Schematics.ATTR_WIDTH);                if (var == null) {                    System.out.println("Warning, no width attribute found on LEWIRE "+info.getContext().push(ni).getInstPath("."));                }                float width = VarContext.objectToFloat(info.getContext().evalVar(var), 3.0f);                cap = (float)(0.95f*len + 0.05f*len*(width/3.0f));      // capacitance            }            leX = cap*constants.wireRatio/9.0f;     // drive strength X=1 is 9 lambda of gate            wire = true;        }        else if ((ni.getProto() != null) && (ni.getProto().getFunction().isTransistor())) {            // handle transistor loads            type = Instance.Type.STATICGATE;            var = ni.getParameterOrVariable(Schematics.ATTR_WIDTH);            if (var == null) {                System.out.println("Error: transistor "+ni+" has no width in Cell "+info.getCell());                errorLogger.logError("Error: transistor "+ni+" has no width in Cell "+info.getCell(),                	ni.getNodeInst(), info.getCell(), info.getContext(), 0);                return false;            }            float width = VarContext.objectToFloat(info.getContext().evalVar(var), (float)3.0);            // note that LE will handle any gate load bloat due to increased gate length            leX = (float)(width/9.0f);            primitiveTransistor = true;        }        else if ((ni.getProto() != null) && (ni.getProto().getFunction() == PrimitiveNode.Function.CAPAC)) {            type = Instance.Type.CAPACITOR;            var = ni.getVar(Schematics.SCHEM_CAPACITANCE);            if (var == null) {                System.out.println("Error: capacitor "+ni+" has no capacitance in Cell "+ni.getParent());                //errorLogger.logError("Error: capacitor "+no+" has no capacitance in Cell "+info.getCell(), ni.getNodeInst(), true, no.getParent(), context, 0);                return false;            }            float cap = VarContext.objectToFloat(info.getContext().evalVar(var), (float)0.0);            leX = (float)(cap/constants.gateCap/1e-15/9.0f);        }        else if (ni.getParameterOrVariable(ATTR_LESETTINGS) != null)            return false;        else if (ni.getParameterOrVariable(ATTR_LEIGNORE) != null)            return false;        if (type == null) return true;              // descend into and process        if (DEBUG) System.out.println("------------------------------------");        // If got to this point, this is either an LEGATE or an LEWIRE        // Both require us to build an instance.        ArrayList<Pin> pins = new ArrayList<Pin>();		Netlist netlist = info.getNetlist();		for (Iterator<PortProto> ppIt = ni.getProto().getPorts(); ppIt.hasNext();) {			PortProto pp = ppIt.next();            // Note default 'le' value should be one            float le = getLE(ni, type, pp, info);            String netName = info.getUniqueNetName(info.getNetID(netlist.getNetwork(ni,pp,0)), ".");            Pin.Dir dir = Pin.Dir.INPUT;            // if it's not an output, it doesn't really matter what it is.            if (pp.getCharacteristic() == PortCharacteristic.OUT) dir = Pin.Dir.OUTPUT;            if (primitiveTransistor) {                // primitive Electric Transistors have their source and drain set to BIDIR, we                // want them set to OUTPUT so that they count as diffusion capacitance                if (pp.getCharacteristic() == PortCharacteristic.BIDIR) dir = Pin.Dir.OUTPUT;            }            if (dir == Pin.Dir.INPUT && type == Instance.Type.STATICGATE) {                // gate load: check if length > 2, if so, increase LE to account for added capacitance                var = ni.getParameterOrVariable(Schematics.ATTR_LENGTH);                if (var == null) {                    System.out.println("Error: transistor "+ni+" has no length in Cell "+info.getCell());                    errorLogger.logError("Error: transistor "+ni+" has no length in Cell "+info.getCell(),                    	ni.getNodeInst(), info.getCell(), info.getContext(), 0);                }                float length = VarContext.objectToFloat(info.getContext().evalVar(var), (float)2.0);                // not exactly correct because assumes all cap is area cap, which it isn't                if (length != 2.0f)                    le = le * length / 2.0f;            }            pins.add(new Pin(pp.getName(), dir, le, netName));            if (DEBUG) System.out.println("    Added "+dir+" pin "+pp.getName()+", le: "+le+", netName: "+netName+", Network: "+netlist.getNetwork(ni,pp,0));            if (type == Instance.Type.WIRE) break;    // this is LEWIRE, only add one pin of it        }        // see if passed-down step-up exists        float localsu = constants.su;        if (((LECellInfo)info).getSU() != -1f)            localsu = ((LECellInfo)info).getSU();        // check for step-up on gate        var = ni.getParameterOrVariable(ATTR_su);        if (var != null) {            float nisu = VarContext.objectToFloat(info.getContext().evalVar(var), -1f);            if (nisu != -1f)                localsu = nisu;        }        // create new leGate instance        VarContext vc = info.getContext().push(ni);                   // to create unique flat name        Instance inst = addInstance(vc.getInstPath("."), type, localsu, leX, pins, ni);        inst.setContext(info.getContext());        // set instance parameters for sizeable gates        if (type == Instance.Type.LEGATE || type == Instance.Type.LEKEEPER) {            var = ni.getParameterOrVariable(ATTR_LEPARALLGRP);            if (var != null) {                // set parallel group number                int g = VarContext.objectToInt(info.getContext().evalVar(var), 0);                inst.setParallelGroup(g);            }        }        // set mfactor        float parentM = ((LECellInfo)info).getMFactor();        inst.setMfactor(parentM);        var = LETool.getMFactor(ni);        if (var != null) {            // set mfactor            float m = VarContext.objectToFloat(info.getContext().evalVar(var), 1.0f);            m = m * parentM;            inst.setMfactor(m);        }        if (DEBUG) {            if (wire) System.out.println("  Added LEWire "+vc.getInstPath(".")+", X="+leX);            else System.out.println("  Added instance "+vc.getInstPath(".")+" of type "+type+", X="+leX);        }        instancesMap.add(inst);        return false;    }    private float getLE(Nodable ni, Instance.Type type, PortProto pp, HierarchyEnumerator.CellInfo info) {        boolean leFound = false;        // Note default 'le' value should be one        float le = 1.0f;		if (!(pp instanceof Export))			return le;        Variable var = ((Export)pp).getParameterOrVariable(ATTR_le);        if (var != null) {            leFound = true;            le = VarContext.objectToFloat(info.getContext().evalVar(var), 1.0f);        } else if ((pp.getCharacteristic() == PortCharacteristic.OUT) &&                (type == Instance.Type.LEGATE || type == Instance.Type.LEKEEPER)) {            // if this is an Sizeable gate's output, look for diffn and diffp            float diff = 0;            var = ((Export)pp).getParameterOrVariable(ATTR_diffn);            if (var != null) {                diff += VarContext.objectToFloat(info.getContext().evalVar(var), 0);                leFound = true;            }            var = ((Export)pp).getParameterOrVariable(ATTR_diffp);            if (var != null) {                diff += VarContext.objectToFloat(info.getContext().evalVar(var), 0);                leFound = true;            }            le = diff/3.0f;        }        if (!leFound && (type == Instance.Type.LEGATE || type == Instance.Type.LEKEEPER)) {            Cell cell = (Cell)ni.getProto();            Export exp = cell.findExport(pp.getName());            if (exp != null && lePortError.get(exp) == null) {                String msg = "Warning: Sizeable gate has no logical effort specified for port "+pp.getName()+" in "+cell;                System.out.println(msg);                errorLogger.logWarning(msg, exp, cell, info.getContext().push(ni), 0);                lePortError.put(exp, exp);            }        }        return le;    }    private Variable getVar(Nodable no, Variable.Key key) {        Variable var = no.getParameter(key);        //if (var == null) var = no.getVarDefaultOwner().getVar(key);        return var;    }    public void doneVisitNodeInst(Nodable ni, HierarchyEnumerator.CellInfo info) {}    /**     * Nothing to do for exitCell     */    public void exitCell(HierarchyEnumerator.CellInfo info) {    }    /**     * Logical Effort Cell Info class.  Keeps track of:     * <p>- M factors     */    public class LECellInfo extends LENetlister.LECellInfo {    }    // =============================== Statistics ==================================    public void printStatistics() {        Collection<Instance> instances = getAllInstances().values();        float totalsize = 0f;        float instsize = 0f;        int numLEGates = 0;        int numLEWires = 0;        for (Instance inst : instances) {            totalsize += inst.getLeX();            if (inst.getType() == Instance.Type.LEGATE || inst.getType() == Instance.Type.LEKEEPER) {                numLEGates++;                instsize += inst.getLeX();            }            if (inst.getType() == Instance.Type.WIRE)                numLEWires++;        }        System.out.println("Number of LEGATEs: "+numLEGates);        System.out.println("Number of Wires: "+numLEWires);        System.out.println("Total size of all LEGATEs: "+instsize);        System.out.println("Total size of all instances (sized and loads): "+totalsize);    }    public float getTotalLESize() {        return getTotalSize(Instance.Type.LEGATE) + getTotalSize(Instance.Type.LEKEEPER);    }    /**     * return total size of all instances of the specified type     * if type is null, uses all types     */    public float getTotalSize(Instance.Type type) {        Collection<Instance> instances = getAllInstances().values();        float totalsize = 0f;        for (Instance inst : instances) {            if (type == null)                totalsize += inst.getLeX();            else if (inst.getType() == type)                totalsize += inst.getLeX();        }        return totalsize;    }    public boolean printResults(Nodable no, VarContext context) {        // if this is a NodeInst, convert to Nodable        if (no instanceof NodeInst) {            no = Netlist.getNodableFor((NodeInst)no, 0);        }        Instance inst = null;        for (Instance instance : instancesMap) {            if (instance.getNodable() == no) {                if (instance.getContext().getInstPath(".").equals(context.getInstPath("."))) {                    inst = instance;                    break;                }            }        }        if (inst == null) return false;                 // failed//        MessagesWindow msgs = TopLevel.getMessagesWindow();        //Font oldFont = msgs.getFont();        //msgs.setFont(new Font("Courier", Font.BOLD, oldFont.getSize()));        // print netlister info        System.out.println("Netlister: Gate Cap="+constants.gateCap+", Alpha="+constants.alpha);        // print instance info        inst.print();        // collect info about what is driven        Pin out = inst.getOutputPins().get(0);        Net net = out.getNet();        ArrayList<Pin> gatesDrivenPins = new ArrayList<Pin>();        ArrayList<Pin> loadsDrivenPins = new ArrayList<Pin>();        ArrayList<Pin> wiresDrivenPins = new ArrayList<Pin>();        ArrayList<Pin> gatesFightingPins = new ArrayList<Pin>();        for (Pin pin : net.getAllPins()) {            Instance in = pin.getInstance();            if (pin.getDir() == Pin.Dir.INPUT) {                if (in.isGate()) gatesDrivenPins.add(pin);                //if (in.getType() == Instance.Type.STATICGATE) staticGatesDriven.add(in);                if (in.getType() == Instance.Type.LOAD) loadsDrivenPins.add(pin);                if (in.getType() == Instance.Type.CAPACITOR) loadsDrivenPins.add(pin);                if (in.getType() == Instance.Type.WIRE) wiresDrivenPins.add(pin);            }            if (pin.getDir() == Pin.Dir.OUTPUT) {                if (in.isGate()) gatesFightingPins.add(pin);            }        }        System.out.println("Note: Load = Size * LE * M");        System.out.println("Note: Load = Size * LE * M * Alpha, for Gates Fighting");        float totalLoad = 0f;        System.out.println("  -------------------- Gates Driven ("+gatesDrivenPins.size()+") --------------------");        for (Pin pin : gatesDrivenPins) {            totalLoad += pin.getInstance().printLoadInfo(pin, constants.alpha);        }        System.out.println("  -------------------- Loads Driven ("+loadsDrivenPins.size()+") --------------------");        for (Pin pin : loadsDrivenPins) {            totalLoad += pin.getInstance().printLoadInfo(pin, constants.alpha);        }        System.out.println("  -------------------- Wires Driven ("+wiresDrivenPins.size()+") --------------------");        for (Pin pin : wiresDrivenPins) {            totalLoad += pin.getInstance().printLoadInfo(pin, constants.alpha);        }        System.out.println("  -------------------- Gates Fighting ("+gatesFightingPins.size()+") --------------------");        for (Pin pin : gatesFightingPins) {            totalLoad += pin.getInstance().printLoadInfo(pin, constants.alpha);        }        System.out.println("*** Total Load: "+TextUtils.formatDouble(totalLoad, 2));        //msgs.setFont(oldFont);        return true;    }    // ---- TEST STUFF -----  REMOVE LATER ----    public static void test1() {        LESizer.test1();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -