📄 lenetlister.java
字号:
if ((var = ni.getParameterOrVariable(ATTR_su)) != null) su = VarContext.objectToFloat(context.evalVar(var), su); if ((var = ni.getParameterOrVariable(ATTR_wire_ratio)) != null) wireRatio = VarContext.objectToFloat(context.evalVar(var), wireRatio); if ((var = ni.getParameterOrVariable(ATTR_epsilon)) != null) epsilon = VarContext.objectToFloat(context.evalVar(var), epsilon); if ((var = ni.getParameterOrVariable(ATTR_max_iter)) != null) maxIterations = VarContext.objectToInt(context.evalVar(var), maxIterations); if ((var = ni.getParameterOrVariable(ATTR_gate_cap)) != null) gateCap = VarContext.objectToFloat(context.evalVar(var), gateCap); if ((var = ni.getParameterOrVariable(ATTR_alpha)) != null) alpha = VarContext.objectToFloat(context.evalVar(var), alpha); if ((var = ni.getParameterOrVariable(ATTR_keeper_ratio)) != null) keeperRatio = VarContext.objectToFloat(context.evalVar(var), keeperRatio); return new NetlisterConstants(su, wireRatio, epsilon, maxIterations, gateCap, alpha, keeperRatio); } } return null; } /** * This checks for LE settings in the cell, and returns true if they conflict. * It also warns the user that there are conflicting settings from the subcell. * @param current the current settings (from the top level cell, or global options) * @return true if there was a conflict, false otherwise */ protected boolean isSettingsConflict(NetlisterConstants current, Cell topLevelCell, VarContext context, Cell localCell) { assert(current != null); NetlisterConstants local = getSettings(localCell); if (local == null) return false; if (!current.equals(local)) { System.out.println("Error: Global settings from "+topLevelCell+" do not match global settings from \""+context.getInstPath("/") +": "+localCell.noLibDescribe()+"\" in (" + localCell.getLibrary().getName()+")"); System.out.println(" Global settings are by definition global, and differences may indicate an inconsistency in your design."); System.out.println(" Note that step-up, \"su\", can be made local by defining a \"su\" parameter on an instance."); System.out.println("\tglobal/parent vs local:"); if (current.su != local.su) System.out.println("su:\t"+current.su+" vs "+local.su); if (current.wireRatio != local.wireRatio) System.out.println("wireRatio:\t"+current.wireRatio+" vs "+local.wireRatio); if (current.epsilon != local.epsilon) System.out.println("epsilon:\t"+current.epsilon+" vs "+local.epsilon); if (current.maxIterations != local.maxIterations) System.out.println("maxIterations:\t"+current.maxIterations+" vs "+local.maxIterations); if (current.gateCap != local.gateCap) System.out.println("gateCap:\t"+current.gateCap+" vs "+local.gateCap); if (current.alpha != local.alpha) System.out.println("alpha:\t"+current.alpha+" vs "+local.alpha); if (current.keeperRatio != local.keeperRatio) System.out.println("keeperRatio:\t"+current.keeperRatio+" vs "+local.keeperRatio); //SwingUtilities.invokeLater(new Runnable() { // public void run() { Job.getUserInterface().showErrorMessage("Conflicting global parameter settings were found, " + "please see message window for details", "Settings Conflict Found!!"); // } //}); return true; } return false; } /** * Saves the Global settings to the cell. Note that this does not overwrite * settings already there. If any settings are found, it does nothing and returns false. * @return true if settings saved, false otherwise */ protected boolean saveSettings(NetlisterConstants constants, Cell cell) { // make sure no settings already on cell if (getSettings(cell) != null) return false; // first we need to find the LESettings Cell Cell settings = null; for (Iterator<Library> it = Library.getLibraries(); it.hasNext(); ) { Library lib = (Library)it.next(); for (Iterator<Cell> it2 = lib.getCells(); it2.hasNext(); ) { Cell c = (Cell)it2.next(); if (c.getParameterOrVariable(ATTR_LESETTINGS) != null) { settings = c; break; } } if (settings != null) break; } if (settings == null) { System.out.println("Could not find LESETTINGS cell in order to save settings to "+cell); return false; } System.out.println("Creating new LESETTINGS box on "+cell+" from User Preferences because none found. Logical effort requires this box"); SaveSettings job = new SaveSettings(cell, settings, constants); return true; } private static class SaveSettings extends Job { private Cell cell; private Cell settings; private NetlisterConstants constants; public SaveSettings(Cell cell, Cell settings, NetlisterConstants constants) { super("Clear LE Sizes", LETool.getLETool(), Job.Type.CHANGE, null, null, Job.Priority.USER); this.cell = cell; this.settings = settings; this.constants = constants; startJob(); } public boolean doIt() throws JobException { Rectangle2D bounds = cell.getBounds(); int x = (int)bounds.getMaxX(); int y = (int)bounds.getMinY(); Cell temp = settings.iconView(); if (temp != null) settings = temp; NodeInst ni = NodeInst.makeInstance(settings, new Point2D.Double(x, y), settings.getDefWidth(), settings.getDefHeight(), cell); if (ni == null) { System.out.println("Could not make instance of LESETTINGS in "+cell+" to save settings."); return false; } ni.updateVar(ATTR_su, new Float(constants.su)); ni.updateVar(ATTR_wire_ratio, new Float(constants.wireRatio)); ni.updateVar(ATTR_epsilon, new Float(constants.epsilon)); ni.updateVar(ATTR_max_iter, new Integer(constants.maxIterations)); ni.updateVar(ATTR_gate_cap, new Float(constants.gateCap)); ni.updateVar(ATTR_alpha, new Float(constants.alpha)); ni.updateVar(ATTR_keeper_ratio, new Float(constants.keeperRatio)); return true; } } protected static class LECellInfo extends HierarchyEnumerator.CellInfo { /** M-factor to be applied to size */ private float mFactor; /** SU to be applied to gates in cell */ private float cellsu; /** local settings */ private NetlisterConstants localSettings; protected void leInit(NetlisterConstants constants) { HierarchyEnumerator.CellInfo parent = getParentInfo(); // check for M-Factor from parent if (parent == null) mFactor = 1f; else mFactor = ((LECellInfo)parent).getMFactor(); // check for su from parent if (parent == null) cellsu = constants.su; else cellsu = ((LECellInfo)parent).getSU(); // get info from node we pushed into Nodable ni = getContext().getNodable(); if (ni != null) { // get mfactor from instance we pushed into Variable mvar = LETool.getMFactor(ni); if (mvar != null) { Object mval = getContext().evalVar(mvar, null); if (mval != null) mFactor = mFactor * VarContext.objectToFloat(mval, 1f); } // get su from instance we pushed into Variable suvar = ni.getParameterOrVariable(ATTR_su); if (suvar != null) { float su = VarContext.objectToFloat(getContext().evalVar(suvar, null), -1f); if (su != -1f) cellsu = su; } } localSettings = new NetlisterConstants( cellsu, constants.wireRatio, constants.epsilon, constants.maxIterations, constants.gateCap, constants.alpha, constants.keeperRatio ); } /** get mFactor */ protected float getMFactor() { return mFactor; } protected float getSU() { return cellsu; } protected NetlisterConstants getSettings() { return localSettings; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -