📄 drc.java
字号:
sortKey = theRuleName.hashCode(); if (errorLogger.getGroupName(sortKey) == null) // only if nothing was found errorLogger.setGroupName(sortKey, theRuleName); break; } if (onlyWarning) errorLogger.logWarning(errorMessage.toString(), geomList, null, null, null, polyList, cell, sortKey); else errorLogger.logError(errorMessage.toString(), geomList, null, null, null, polyList, cell, sortKey); // Temporary display of errors. if (reportInfo.interactiveLogger) Job.getUserInterface().termLogging(errorLogger, false, false); } private static boolean checkExclusionMap(Map<Cell, Area> exclusionMap, Cell cell, List<PolyBase> polyList, List<Geometric> geomList, StringBuffer DRCexclusionMsg) { Area area = exclusionMap.get(cell); if (area == null) return false; int count = 0, i = -1; for (PolyBase thisPoly : polyList) { i++; if (thisPoly == null) continue; // MinNode case boolean found = area.contains(thisPoly.getBounds2D()); if (found) count++; else { Rectangle2D rect = (geomList.get(i) != null) ? geomList.get(i).getBounds() : thisPoly.getBounds2D(); DRCexclusionMsg.append("\n\t(DRC Exclusion in '" + cell.getName() + "' does not completely contain element (" + rect.getMinX() + "," + rect.getMinY() + ") (" + rect.getMaxX() + "," + rect.getMaxY() + "))"); } }// At least one DRC exclusion that contains both// if (count == polyList.size()) if (count >= 1) // at one element is inside the DRC exclusion return true; return false; } /*********************************** END DRC ERROR REPORTING ***********************************/ private static class StoreDRCInfo { long date; int bits; StoreDRCInfo(long d, int b) { date = d; bits = b; } } private static boolean incrementalRunning = false; /** key of Variable for last valid DRC date on a Cell. Only area rules */// private static final int DRC_BIT_AREA = 01; /* Min area condition */ private static final int DRC_BIT_EXTENSION = 02; /* Coverage DRC condition */ private static final int DRC_BIT_ST_FOUNDRY = 04; /* For ST foundry selection */ private static final int DRC_BIT_TSMC_FOUNDRY = 010; /* For TSMC foundry selection */ private static final int DRC_BIT_MOSIS_FOUNDRY = 020; /* For Mosis foundry selection */ public enum DRCCheckMinArea { AREA_BASIC("Simple") /*brute force algorithm*/, AREA_LOCAL("Local"); private final String name; DRCCheckMinArea(String s) { name = s; } public String toString() {return name;} } public enum DRCCheckLogging { DRC_LOG_FLAT("Flat")/*original strategy*/, DRC_LOG_PER_CELL("By Cell"), DRC_LOG_PER_RULE("By Rule"); private final String name; DRCCheckLogging(String s) { name = s; } public String toString() {return name;} } /** Control different level of error checking */ public enum DRCCheckMode { ERROR_CHECK_DEFAULT (0), /** DRC stops after first error between 2 nodes is found (default) */ ERROR_CHECK_CELL (1), /** DRC stops after first error per cell is found */ ERROR_CHECK_EXHAUSTIVE (2); /** DRC checks all combinations */ private final int mode; // mode DRCCheckMode(int m) {this.mode = m;} public int mode() { return this.mode; } public String toString() {return name();} } /****************************** TOOL CONTROL ******************************/ /** * The constructor sets up the DRC tool. */ private DRC() { super("drc"); } /** * Method to initialize the DRC tool. */ public void init() { setOn(); } /** * Method to retrieve the singleton associated with the DRC tool. * @return the DRC tool. */ public static DRC getDRCTool() { return tool; } private static void includeGeometric(Geometric geom) { if (!isIncrementalDRCOn()) return; Cell cell = geom.getParent(); synchronized (cellsToCheck) { Set<Geometric> cellSet = cellsToCheck.get(cell); if (cellSet == null) { cellSet = new HashSet<Geometric>(); cellsToCheck.put(cell, cellSet); } cellSet.add(geom); } } private static void doIncrementalDRCTask() { if (!isIncrementalDRCOn()) return; if (incrementalRunning) return; Library curLib = Library.getCurrent(); if (curLib == null) return; Cell cellToCheck = Job.getUserInterface().getCurrentCell(curLib); Set<Geometric> cellSet = null; // get a cell to check synchronized (cellsToCheck) { if (cellToCheck != null) cellSet = cellsToCheck.get(cellToCheck); if (cellSet == null && cellsToCheck.size() > 0) { cellToCheck = cellsToCheck.keySet().iterator().next(); cellSet = cellsToCheck.get(cellToCheck); } if (cellSet != null) cellsToCheck.remove(cellToCheck); } if (cellToCheck == null) return; // nothing to do // don't check if cell not in database anymore if (!cellToCheck.isLinked()) return; // Handling clipboard case (one type of hidden libraries) if (cellToCheck.getLibrary().isHidden()) return; // if there is a cell to check, do it if (cellSet != null) { Geometric [] objectsToCheck = new Geometric[cellSet.size()]; int i = 0; for(Geometric geom : cellSet) objectsToCheck[i++] = geom; // cleaning previous errors on the cells to check now. for (Geometric geo : objectsToCheck) { Cell c = geo.getParent(); ArrayList<ErrorLogger.MessageLog> getAllLogs = errorLoggerIncremental.getAllLogs(c); Job.updateIncrementalDRCErrors(c, null, getAllLogs); } new CheckDRCIncrementally(cellToCheck, objectsToCheck, cellToCheck.getTechnology().isScaleRelevant()); } } /** * Handles database changes of a Job. * @param oldSnapshot database snapshot before Job. * @param newSnapshot database snapshot after Job and constraint propagation. * @param undoRedo true if Job was Undo/Redo job. */ public void endBatch(Snapshot oldSnapshot, Snapshot newSnapshot, boolean undoRedo) { for (CellId cellId: newSnapshot.getChangedCells(oldSnapshot)) { Cell cell = Cell.inCurrentThread(cellId); if (cell == null) continue; CellBackup oldBackup = oldSnapshot.getCell(cellId); for (Iterator<NodeInst> it = cell.getNodes(); it.hasNext(); ) { NodeInst ni = it.next(); ImmutableNodeInst d = ni.getD(); if (oldBackup == null || oldBackup.cellRevision.getNode(d.nodeId) != d) includeGeometric(ni); } for (Iterator<ArcInst> it = cell.getArcs(); it.hasNext(); ) { ArcInst ai = it.next(); ImmutableArcInst d = ai.getD(); if (oldBackup == null || oldBackup.cellRevision.getArc(d.arcId) != d) includeGeometric(ai); } } doIncrementalDRCTask(); } /****************************** DRC INTERFACE ******************************/ public static ErrorLogger getDRCErrorLogger(boolean layout, boolean incremental, String extraMsg) { ErrorLogger errorLogger = null; String title = (layout) ? "Layout " : "Schematic "; if (incremental) {// if (errorLoggerIncremental == null) errorLoggerIncremental = ErrorLogger.newInstance("DRC (incremental)"/*, true*/); errorLogger = errorLoggerIncremental; } else { errorLogger = ErrorLogger.newInstance(title + "DRC (full)" + ((extraMsg != null) ? extraMsg:"")); } return errorLogger; } public static ErrorLogger getDRCIncrementalLogger() {return errorLoggerIncremental;} /** * This method generates a DRC job from the GUI or for a bash script. */ public static void checkDRCHierarchically(Cell cell, List<Geometric> objs, Rectangle2D bounds, GeometryHandler.GHMode mode, boolean onlyArea) { if (cell == null) return; boolean isLayout = true; // hierarchical check of layout by default if (cell.isSchematic() || cell.getTechnology() == Schematics.tech() || cell.isIcon() || cell.getTechnology() == Artwork.tech()) // hierarchical check of schematics isLayout = false; if (mode == null) mode = GeometryHandler.GHMode.ALGO_SWEEP; new CheckDRCHierarchically(cell, isLayout, objs, bounds, mode, onlyArea); } /** * Base class for checking design rules. * */ public static class CheckDRCJob extends Job { Cell cell; boolean isLayout; // to check layout private static String getJobName(Cell cell) { return "Design-Rule Check " + cell; } protected CheckDRCJob(Cell cell, Listener tool, Priority priority, boolean layout) { super(getJobName(cell), tool, Job.Type.EXAMINE, null, null, priority); this.cell = cell; this.isLayout = layout; } // never used public boolean doIt() { return (false);} } /** * Class for hierarchical DRC for layout and schematics */ private static class CheckDRCHierarchically extends CheckDRCJob { Rectangle2D bounds; private GeometryHandler.GHMode mergeMode; // to select the merge algorithm private boolean onlyArea; private Geometric[] geoms; /** * Check bounds within cell. If bounds is null, check entire cell. * @param cell * @param layout * @param bounds */ protected CheckDRCHierarchically(Cell cell, boolean layout, List<Geometric> objs, Rectangle2D bounds, GeometryHandler.GHMode mode, boolean onlyA) { super(cell, tool, Job.Priority.USER, layout); this.bounds = bounds; this.mergeMode = mode; this.onlyArea = onlyA; if (objs != null) { this.geoms = new Geometric[objs.size()]; objs.toArray(this.geoms); } startJob(); } public boolean doIt() { long startTime = System.currentTimeMillis(); ErrorLogger errorLog = getDRCErrorLogger(isLayout, false, null); checkNetworks(errorLog, cell, isLayout); if (isLayout) Quick.checkDesignRules(errorLog, cell, geoms, null, bounds, this, mergeMode, onlyArea); else Schematic.doCheck(errorLog, cell, geoms); long endTime = System.currentTimeMillis();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -