当我们从版图文件中读取数据并生成我们基于角勾链的数据模式后,下一步就是在我们的版图上进行DRC(设计规则检查),接下来让我们看一下magic是如何进行常用的DRC的。
DRC部分涉及的源码主要有以下几个源文件
drc.h #declaration of the main interface, defination of global variables
DRCarray.c #implementation of array related design rule check
DRCbasic.c #implementation of basic design rule check method
#including interatcion, overlap, distance, etc...
DRCcif.c #maybe related to the cif format layout file
DRCcontin.c #implementation of continuously design rule check method
DRCextend.c #implementation of extend design rule check method
#including angle, length, width, rect size, etc...
DRCmain.c #implementation of main interface and command
DRCprint.c #some additional function related printing
DRCsubcell.c #implementation of subcell design rule check method
#including interaction, overlap, flat, etc...
DRCtech.c #Technology initialization for the DRC module
先从DRCmain.c
看起。
首先是一系列全局变量的定义,这些全局变量用来存储DRC发现的错误数据,magic将DRC检查DRCBasicCheck
与错误的打印drcPrintError
和绘制drcPrintError
解耦为不同的方法,用全局变量来传递数据。
DRCKeep *DRCStyleList = NULL;
DRCStyle *DRCCurStyle = NULL;
/* Used by both routines: */
int DRCErrorCount; /* Incremented by each call to either routine.
*/
/* Used by drcPaintError: */
CellDef *DRCErrorDef; /* Place to paint error tiles. */
TileType DRCErrorType; /* Type of error tile to paint. */
/* Used by drcPrintError: */
int *DRCErrorList; /* List of DRC error type counts */
HashTable DRCErrorTable; /* Table of DRC errors and geometry */
/* Global variables used by all DRC modules to record statistics.
* For each statistic we keep two values, the count since stats
* were last printed (in DRCstatXXX), and the total count (in
* drcTotalXXX).
*/
int DRCstatSquares = 0; /* Number of DRCStepSize-by-DRCStepSize
* squares processed by continuous checker.
*/
int DRCstatTiles = 0; /* Number of tiles processed by basic
* checker.
*/
int DRCstatEdges = 0; /* Number of "atomic" edges processed
* by basic checker.
*/
int DRCstatRules = 0; /* Number of rules processed by basic checker
* (rule = one constraint for one edge).
*/
int DRCstatSlow = 0; /* Number of places where constraint doesn't
* all fall in a single tile.
*/
int DRCstatInteractions = 0; /* Number of times drcInt is called to check
* an interaction area.
*/
int DRCstatIntTiles = 0; /* Number of tiles processed as part of
* subcell interaction checks.
*/
int DRCstatCifTiles = 0; /* Number of tiles processed as part of
* cif checks.
*/
int DRCstatArrayTiles = 0; /* Number of tiles processed as part of
* array interaction checks.
*/
接下来的drcPrintError
和drcPrintError
就不多说了,分别是对应的错误打印和窗口UI的更新的实现,我们继续往下看:
/*
* 找出某个给定区域内的所有错误并打印所有不同类型的违背的规则
*/
void
DRCWhy(dolist, use, area)
bool dolist; /*
* Generate Tcl list for value
*/
CellUse *use; /* Use in whose definition to start
* the hierarchical check.
*/
Rect *area; /* Area, in def's coordinates, that
* is to be checked.
*/
{
SearchContext scx;
Rect box;
int i;
extern int drcWhyFunc(); /*