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

📄 drc.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            int errorCount = errorLog.getNumErrors();            int warnCount = errorLog.getNumWarnings();            System.out.println(errorCount + " errors and " + warnCount + " warnings found (took " + TextUtils.getElapsedTime(endTime - startTime) + ")");            if (onlyArea)                Job.getUserInterface().termLogging(errorLog, false, false); // otherwise the errors don't appear            return true;		}	}	private static class CheckDRCIncrementally extends CheckDRCJob	{		Geometric [] objectsToCheck;		protected CheckDRCIncrementally(Cell cell, Geometric[] objectsToCheck, boolean layout)		{			super(cell, tool, Job.Priority.ANALYSIS, layout);			this.objectsToCheck = objectsToCheck;			startJob();		}		public boolean doIt()		{			incrementalRunning = true;            ErrorLogger errorLog = getDRCErrorLogger(isLayout, true, null);            if (isLayout)                errorLog = Quick.checkDesignRules(errorLog, cell, objectsToCheck, null, null);            else                errorLog = Schematic.doCheck(errorLog, cell, objectsToCheck);            int errorsFound = errorLog.getNumErrors();			if (errorsFound > 0)				System.out.println("Incremental DRC found " + errorsFound + " errors/warnings in "+ cell);			incrementalRunning = false;			doIncrementalDRCTask();			return true;		}	}	/****************************** DESIGN RULE CONTROL ******************************/	/** The Technology whose rules are cached. */		private static Technology currentTechnology = null;	/**	 * Method to build a Rules object that contains the current design rules for a Technology.	 * The DRC dialogs use this to hold the values while editing them.	 * It also provides a cache for the design rule checker.	 * @param tech the Technology to examine.	 * @return a new Rules object with the design rules for the given Technology.	 */	public static DRCRules getRules(Technology tech)	{        XMLRules currentRules = tech.getCachedRules();		if (currentRules != null && tech == currentTechnology) return currentRules;		// constructing design rules: start with factory rules		currentRules = tech.getFactoryDesignRules();		if (currentRules != null)		{			// add overrides			StringBuffer override = getDRCOverrides(tech);			currentRules.applyDRCOverrides(override.toString(), tech);		}		// remember technology whose rules are cached		currentTechnology = tech;        tech.setCachedRules(currentRules);		return currentRules;	}	/**	 * Method to load a full set of design rules for a Technology.	 * @param tech the Technology to load.	 * @param newRules a complete design rules object.	 */	public static void setRules(Technology tech, DRCRules newRules)	{		// get factory design rules		DRCRules factoryRules = tech.getFactoryDesignRules();		// determine override differences from the factory rules		StringBuffer changes = Technology.getRuleDifferences(factoryRules, newRules);        if (Job.LOCALDEBUGFLAG)            System.out.println("This function needs attention");		// get current overrides of factory rules		StringBuffer override = getDRCOverrides(tech);		// if the differences are the same as before, stop		if (changes.toString().equals(override.toString())) return;		// update the preference for the rule overrides		setDRCOverrides(changes, tech);		// update variables on the technology		tech.setRuleVariables(newRules);		// flush the cache of rules		if (currentTechnology == tech) currentTechnology = null;	}	/****************************** INDIVIDUAL DESIGN RULES ******************************/	/**	 * Method to find the worst spacing distance in the design rules.	 * Finds the largest spacing rule in the Technology.	 * @param tech the Technology to examine.     * @param lastMetal     * @return the largest spacing distance in the Technology. Zero if nothing found	 */	public static double getWorstSpacingDistance(Technology tech, int lastMetal)	{		DRCRules rules = getRules(tech);		if (rules == null)            return 0;		return (rules.getWorstSpacingDistance(lastMetal));	}    /**	 * Method to find the maximum design-rule distance around a layer.	 * @param layer the Layer to examine.	 * @return the maximum design-rule distance around the layer. -1 if nothing found.	 */	public static double getMaxSurround(Layer layer, double maxSize)	{		Technology tech = layer.getTechnology();        if (tech == null) return -1; // case when layer is a Graphics		DRCRules rules = getRules(tech);		if (rules == null) return -1;        return (rules.getMaxSurround(layer, maxSize));	}	/**	 * Method to find the edge spacing rule between two layer.	 * @param layer1 the first layer.	 * @param layer2 the second layer.	 * @return the edge rule distance between the layers.	 * Returns null if there is no edge spacing rule.	 */	public static DRCTemplate getEdgeRule(Layer layer1, Layer layer2)	{		Technology tech = layer1.getTechnology();		DRCRules rules = getRules(tech);		if (rules == null) return null;		return (rules.getEdgeRule(layer1, layer2));	}	/**	 * Method to find the spacing rule between two layer.	 * @param layer1 the first layer.     * @param geo1	 * @param layer2 the second layer.     * @param geo2	 * @param connected true to find the distance when the layers are connected.	 * @param multiCut true to find the distance when this is part of a multicut contact.     * @param wideS widest polygon     * @param length length of the intersection	 * @return the spacing rule between the layers.	 * Returns null if there is no spacing rule.	 */	public static DRCTemplate getSpacingRule(Layer layer1, Geometric geo1, Layer layer2, Geometric geo2,                                             boolean connected, int multiCut, double wideS, double length)	{		Technology tech = layer1.getTechnology();		DRCRules rules = getRules(tech);		if (rules == null) return null;        return (rules.getSpacingRule(layer1, geo1, layer2, geo2, connected, multiCut, wideS, length));	}    /**     * Method to find all possible rules of DRCRuleType type associated a layer.     * @param layer1 the layer whose rules are desired.     * @return a list of DRCTemplate objects associated with the layer.     */    public static List<DRCTemplate> getRules(Layer layer1, DRCTemplate.DRCRuleType type)    {        Technology tech = layer1.getTechnology();        DRCRules rules = getRules(tech);		if (rules == null)            return null;		return (rules.getRules(layer1, type));    }    /**	 * Method to find the extension rule between two layer.	 * @param layer1 the first layer.	 * @param layer2 the second layer.     * @param isGateExtension to decide between the rule EXTENSIONGATE or EXTENSION	 * @return the extension rule between the layers.	 * Returns null if there is no extension rule.	 */	public static DRCTemplate getExtensionRule(Layer layer1, Layer layer2, boolean isGateExtension)	{		Technology tech = layer1.getTechnology();		DRCRules rules = getRules(tech);		if (rules == null) return null;        return (rules.getExtensionRule(layer1, layer2, isGateExtension));	}	/**	 * Method to tell whether there are any design rules between two layers.	 * @param layer1 the first Layer to check.	 * @param layer2 the second Layer to check.	 * @return true if there are design rules between the layers.	 */	public static boolean isAnySpacingRule(Layer layer1, Layer layer2)	{		Technology tech = layer1.getTechnology();		DRCRules rules = getRules(tech);		if (rules == null) return false;        return (rules.isAnySpacingRule(layer1, layer2));	}	/**	 * Method to get the minimum <type> rule for a Layer	 * where <type> is the rule type. E.g. MinWidth or Area	 * @param layer the Layer to examine.	 * @param type rule type	 * @return the minimum width rule for the layer.	 * Returns null if there is no minimum width rule.	 */	public static DRCTemplate getMinValue(Layer layer, DRCTemplate.DRCRuleType type)	{		Technology tech = layer.getTechnology();		if (tech == null) return null;		DRCRules rules = getRules(tech);		if (rules == null) return null;        return (rules.getMinValue(layer, type));	}    /**     * Determine if node represented by index in DRC mapping table is forbidden under     * this foundry.     */    public static DRCTemplate isForbiddenNode(int index1, int index2, DRCTemplate.DRCRuleType type, Technology tech)    {        DRCRules rules = getRules(tech);        if (rules == null) return null;        return isForbiddenNode(rules, index1, index2, type);    }    public static DRCTemplate isForbiddenNode(DRCRules rules, int index1, int index2, DRCTemplate.DRCRuleType type)    {        int index = index1; // In case of primitive nodes        if (index2 != -1 )            index = rules.getRuleIndex(index1, index2);        else            index += rules.getTechnology().getNumLayers(); // Node forbidden        return (rules.isForbiddenNode(index, type));    }    /**	 * Method to get the minimum size rule for a NodeProto.	 * @param np the NodeProto to examine.	 * @return the minimum size rule for the NodeProto.	 * Returns null if there is no minimum size rule.	 */	public static PrimitiveNode.NodeSizeRule getMinSize(NodeProto np)	{		if (np instanceof Cell) return null;		PrimitiveNode pnp = (PrimitiveNode)np;        return pnp.getMinSizeRule();	}	/****************************** SUPPORT FOR DESIGN RULES ******************************/	/**	 * Method to get the DRC overrides from the preferences for a given technology.	 * @param tech the Technology on which to get overrides.	 * @return a Pref describing DRC overrides for the Technology.	 */	private static StringBuffer getDRCOverrides(Technology tech)	{		Pref pref = prefDRCOverride.get(tech);		if (pref == null)		{			pref = Pref.makeStringPref("DRCOverridesFor" + tech.getTechName(), tool.prefs, "");			prefDRCOverride.put(tech, pref);		}		StringBuffer sb = new StringBuffer();		sb.append(pref.getString());		return sb;	}	/**	 * Method to set the DRC overrides for a given technology.	 * @param sb the overrides (a StringBuffer).	 * @param tech the Technology on which to get overrides.	 */	private static void setDRCOverrides(StringBuffer sb, Technology tech)	{		if (sb.length() >= Preferences.MAX_VALUE_LENGTH)		{			System.out.println("Warning: Design rule overrides are too complex to be saved (are " +				sb.length() + " long which is more than the limit of " + Preferences.MAX_VALUE_LENGTH + ")");		}		Pref pref = prefDRCOverride.get(tech);		if (pref == null)		{			pref = Pref.makeStringPref("DRCOverridesFor" + tech.getTechName(), tool.prefs, "");			prefDRCOverride.put(tech, pref);		}		pref.setString(sb.toString());	}    /**     * Method to clean those cells that were marked with a valid date due to     * changes in the DRC rules.     * @param f     */    public static void cleanCellsDueToFoundryChanges(Technology tech, Foundry f)    {        // Need to clean cells using this foundry 

⌨️ 快捷键说明

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