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

📄 lesizer.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                            if (ni != null) {                                errorLogger.logError(msg, ni, ni.getParent(), instance.getContext(), 1);                            }                        }                        // ignore if no loads, on all iterations                        if (numLoads == 0)                            continue;                        // For now, split effort equally amongst all drivers                        // Group 0 drives individually                        if (instance.getParallelGroup() <= 0) {                            newX = totalcap / instance.getLeSU() / arrayedDrivers.size();                        }                        else {                            newX = totalcap / instance.getLeSU() / drivers.size();                        }                        // also take into account mfactor of driver                        newX = newX / (float)instance.getMfactor();                    }                    // determine change in size                    float currentX = instance.getLeX();                    float deltaX;                    if (currentX == 0 && newX == 0) {                        // if before and after are 0, delta is 0                        deltaX = 0f;                    } else {                        // account for divide by 0                        if (currentX == 0) currentX = 0.001f;                        deltaX = Math.abs( (newX-currentX)/currentX);                    }                    currentLoopDeltaX = (deltaX > currentLoopDeltaX) ? deltaX : currentLoopDeltaX;                    if (verbose) {                        out.println("Optimized "+instanceName+": size:  "+                            TextUtils.formatDouble(instance.getLeX(), 3)+                            "x ==> "+TextUtils.formatDouble(newX, 3)+"x");                    }                    instance.setLeX(newX);                } // if (leGate)			} // while (instancesIter)            // All done, print some statistics about this iteration            String elapsed = TextUtils.getElapsedTime(System.currentTimeMillis()-startTime);            System.out.println("  ...done ("+elapsed+"), delta: "+currentLoopDeltaX);                        if (verbose) System.out.println("-----------------------------------");			loopcount++;            // check to see if we're diverging or not converging            if (currentLoopDeltaX >= lastLoopDeltaX) {                if (divergingIters > 2) {                    System.out.println("  Sizing diverging, aborting");                    return false;                }                divergingIters++;            }            lastLoopDeltaX = currentLoopDeltaX;		} // while (currentLoopDeltaX ... )        return true;	}    // ========================== Sizing for Path Optimization =====================    protected List getEndNets() {        List endNets = new ArrayList();        Iterator<Net> netIter = netlist.getAllNets().values().iterator();        while (netIter.hasNext()) {            Net net = netIter.next();        }        return null;    }    // =============================== Statistics ==================================    // ============================== Design Printing ===============================    /**     * Dump the design information for debugging purposes     */    protected void printDesign() 	{		out.println("Instances in design are:");		        		Iterator<Instance> instancesIter = netlist.getAllInstances().values().iterator();		while (instancesIter.hasNext()) {			Instance instance = instancesIter.next();			String instanceName = instance.getName();            StringBuffer buf = new StringBuffer();			out.println("\t"+instanceName+" ==> "+TextUtils.formatDouble(instance.getLeX(), 3)+"x");			ArrayList<Pin> pins = instance.getAllPins();						// now print out pinname ==> netname			Iterator<Pin> pinsIter = pins.iterator();			while (pinsIter.hasNext()) {				Pin pin = pinsIter.next();				out.println("\t\t"+pin.getName()+" ==> "+pin.getNetName());			}		}	}    /**     * Generate simple size file (for regression purposes)     * @param filename output filename     */    protected int printDesignSizes(String filename)	{		// open output file		try {			FileWriter fileWriter = new FileWriter(filename); // throws IOException						// iterate through all instances			Iterator<Instance> instancesIter = netlist.getAllInstances().values().iterator();			while (instancesIter.hasNext()) {				Instance instance = instancesIter.next();				String instanceName = instance.getName();				float leX = instance.getLeX();				fileWriter.write(instanceName+" "+leX+"\n"); // throws IOException				fileWriter.flush(); // throws IOException			}			fileWriter.close(); // throws IOException		} catch (IOException e) {			out.println("Writing to file "+filename+": "+e.getMessage());			return 1;		}		return 0;	}    /**     * Generate SKILL backannotation file     * @param filename output filename     * @param libname  The Opus library name to be annotated     * @param cellname  The Opus cell to be annotated     */    protected int printDesignSkill(String filename, String libname, String cellname)	{		// nothing here		return 0;	}    /**     * Dummy method to improve test coverage     */    protected void testcoverage()	{		// nothing here	}       //---------------------------------------TEST---------------------------------------    //---------------------------------------TEST---------------------------------------        /** run a contrived test */    public static void test1()    {        System.out.println("Running GASP test circuit");        System.out.println("=========================");                float su = (float)4.0;        LENetlister1 netlist = new LENetlister1(null, null);                        {        // inv1        Pin pin_a = new Pin("A", Pin.Dir.INPUT, (float)1.0, "nand1_out");        Pin pin_y = new Pin("Y", Pin.Dir.OUTPUT, (float)1.0, "inv1_out");        ArrayList<Pin> pins = new ArrayList<Pin>();        pins.add(pin_a);        pins.add(pin_y);        netlist.addInstance("inv1", Instance.Type.LEGATE, su, (float)1.0, pins, null);        }        {        // inv2        Pin pin_a = new Pin("A", Pin.Dir.INPUT, (float)1.0, "pu_out");        Pin pin_y = new Pin("Y", Pin.Dir.OUTPUT, (float)1.0, "inv2_out");        ArrayList<Pin> pins = new ArrayList<Pin>();        pins.add(pin_a);        pins.add(pin_y);        netlist.addInstance("inv2", Instance.Type.LEGATE, su, (float)1.0, pins, null);        }        {        // inv3        Pin pin_a = new Pin("A", Pin.Dir.INPUT, (float)1.0, "nand1_out");        Pin pin_y = new Pin("Y", Pin.Dir.OUTPUT, (float)1.0, "inv3_out");        ArrayList<Pin> pins = new ArrayList<Pin>();        pins.add(pin_a);        pins.add(pin_y);        netlist.addInstance("inv3", Instance.Type.LEGATE, su, (float)1.0, pins, null);        }                {        // nand1        Pin pin_a = new Pin("A", Pin.Dir.INPUT, (float)1.333, "inv2_out");        Pin pin_b = new Pin("B", Pin.Dir.INPUT, (float)1.333, "pd_out");        Pin pin_y = new Pin("Y", Pin.Dir.OUTPUT, (float)2.0, "nand1_out");        ArrayList<Pin> pins = new ArrayList<Pin>();        pins.add(pin_a);        pins.add(pin_b);        pins.add(pin_y);        netlist.addInstance("nand1", Instance.Type.LEGATE, su, (float)1.0, pins, null);        }        {        // pu        Pin pin_g = new Pin("G", Pin.Dir.INPUT, (float)0.667, "nand1_out");        Pin pin_d = new Pin("D", Pin.Dir.OUTPUT, (float)0.667, "pu_out");        ArrayList<Pin> pins = new ArrayList<Pin>();        pins.add(pin_g);        pins.add(pin_d);        netlist.addInstance("pu", Instance.Type.LEGATE, su, (float)1.0, pins, null);        }        {        // pd        Pin pin_g = new Pin("G", Pin.Dir.INPUT, (float)0.333, "inv3_out");        Pin pin_d = new Pin("D", Pin.Dir.OUTPUT, (float)0.333, "pd_out");        ArrayList<Pin> pins = new ArrayList<Pin>();        pins.add(pin_g);        pins.add(pin_d);        netlist.addInstance("pd", Instance.Type.LEGATE, su, (float)1.0, pins, null);        }        {        // cap1        Pin pin_c = new Pin("C", Pin.Dir.INPUT, (float)1.0, "pd_out");        ArrayList<Pin> pins = new ArrayList<Pin>();        pins.add(pin_c);        netlist.addInstance("cap1", Instance.Type.LOAD, su, (float)0.0, pins, null);        }        {        // cap2        Pin pin_c = new Pin("C", Pin.Dir.INPUT, (float)1.0, "pu_out");        ArrayList<Pin> pins = new ArrayList<Pin>();        pins.add(pin_c);        netlist.addInstance("cap2", Instance.Type.LOAD, su, (float)0.0, pins, null);        }        {        // cap3        Pin pin_c = new Pin("C", Pin.Dir.INPUT, (float)1.0, "inv1_out");        ArrayList<Pin> pins = new ArrayList<Pin>();        pins.add(pin_c);        netlist.addInstance("cap3", Instance.Type.LOAD, su, (float)100.0, pins, null);        }        netlist.getSizer().printDesign();        netlist.getSizer().optimizeLoops((float)0.01, 30, true, (float)0.7, (float)0.1);        System.out.println("After optimization:");        netlist.getSizer().printDesign();    }}

⌨️ 快捷键说明

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