1 /* -*- tab-width: 4 -*-
2  *
3  * Electric(tm) VLSI Design System
4  *
5  * File: drc.h
6  * Design-rule check tool
7  * Written by: Steven M. Rubin, Static Free Software
8  *
9  * Copyright (c) 2000 Static Free Software.
10  *
11  * Electric(tm) is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * Electric(tm) is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with Electric(tm); see the file COPYING.  If not, write to
23  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
24  * Boston, Mass 02111-1307, USA.
25  *
26  * Static Free Software
27  * 4119 Alpine Road
28  * Portola Valley, California 94028
29  * info@staticfreesoft.com
30  */
31 
32 #if defined(__cplusplus) && !defined(ALLCPLUSPLUS)
33 extern "C"
34 {
35 #endif
36 
37 /* #define SURROUNDRULES 1 */		/* uncomment to add surround rule code (not ready yet) */
38 
39 /* the meaning of "DRC_options" */
40 #define DRCFIRSTERROR              2		/* set to stop after first error in a cell */
41 #define DRCREASONABLE              4		/* set to only examine "reasonable" number of polygons per node */
42 #define DRCMULTIPROC             010		/* set to use multiple processors for DRC */
43 #define DRCNUMPROC          07777760		/* number of processors to use for DRC */
44 #define DRCNUMPROCSH               4		/* right-shift of DRCNUMPROC */
45 
46 /* the bits in the return value of "dr_rulesdlog()" */
47 #define RULECHANGEMINWID          01		/* minimum width changed */
48 #define RULECHANGEMINWIDR         02		/* minimum width rule changed */
49 #define RULECHANGECONSPA          04		/* connected spacing changed */
50 #define RULECHANGECONSPAR        010		/* connected spacing rule changed */
51 #define RULECHANGEUCONSPA        020		/* unconnected spacing changed */
52 #define RULECHANGEUCONSPAR       040		/* unconnected spacing rule changed */
53 #define RULECHANGECONSPAW       0100		/* wide connected spacing changed */
54 #define RULECHANGECONSPAWR      0200		/* wide connected spacing rule changed */
55 #define RULECHANGEUCONSPAW      0400		/* wide unconnected spacing changed */
56 #define RULECHANGEUCONSPAWR    01000		/* wide unconnected spacing rule changed */
57 #define RULECHANGECONSPAM      02000		/* multicut connected spacing changed */
58 #define RULECHANGECONSPAMR     04000		/* multicut connected spacing rule changed */
59 #define RULECHANGEUCONSPAM    010000		/* multicut unconnected spacing changed */
60 #define RULECHANGEUCONSPAMR   020000		/* multicut unconnected spacing rule changed */
61 #define RULECHANGEEDGESPA     040000		/* edge spacing changed */
62 #define RULECHANGEEDGESPAR   0100000		/* edge spacing rule changed */
63 #define RULECHANGEWIDLIMIT   0200000		/* width limit changed */
64 #define RULECHANGEMINSIZE    0400000		/* minimum node size changed */
65 #define RULECHANGEMINSIZER  01000000		/* minimum node size rule changed */
66 
67 
68 #define NODRCRULES ((DRCRULES *)-1)
69 
70 typedef struct
71 {
72 	CHAR    *techname;			/* name of the technology */
73 	INTBIG   numlayers;			/* number of layers in the technology */
74 	INTBIG   utsize;			/* size of upper-triangle of layers */
75 	INTBIG   widelimit;			/* width limit that triggers wide rules */
76 	CHAR   **layernames;		/* names of layers */
77 	INTBIG  *minwidth;			/* minimum width of layers */
78 	CHAR   **minwidthR;			/* minimum width rules */
79 	INTBIG  *conlist;			/* minimum distances when connected */
80 	CHAR   **conlistR;			/* minimum distance ruless when connected */
81 	INTBIG  *unconlist;			/* minimum distances when unconnected */
82 	CHAR   **unconlistR;		/* minimum distance rules when unconnected */
83 	INTBIG  *conlistW;			/* minimum distances when connected (wide) */
84 	CHAR   **conlistWR;			/* minimum distance rules when connected (wide) */
85 	INTBIG  *unconlistW;		/* minimum distances when unconnected (wide) */
86 	CHAR   **unconlistWR;		/* minimum distance rules when unconnected (wide) */
87 	INTBIG  *conlistM;			/* minimum distances when connected (multi-cut) */
88 	CHAR   **conlistMR;			/* minimum distance rules when connected (multi-cut) */
89 	INTBIG  *unconlistM;		/* minimum distances when unconnected (multi-cut) */
90 	CHAR   **unconlistMR;		/* minimum distance rules when unconnected (multi-cut) */
91 	INTBIG  *edgelist;			/* edge distances */
92 	CHAR   **edgelistR;			/* edge distance rules */
93 	INTBIG   numnodes;			/* number of nodes in the technology */
94 	CHAR   **nodenames;			/* names of nodes */
95 	INTBIG  *minnodesize;		/* minimim node size in the technology */
96 	CHAR   **minnodesizeR;		/* minimim node size rules */
97 } DRCRULES;
98 
99 extern TOOL       *dr_tool;								/* the DRC tool object */
100 extern INTBIG      dr_max_distanceskey;					/* key for "DRC_max_distances" */
101 extern INTBIG      dr_wide_limitkey;					/* key for "DRC_wide_limit" */
102 extern INTBIG      dr_min_widthkey;						/* key for "DRC_min_width" */
103 extern INTBIG      dr_min_width_rulekey;				/* key for "DRC_min_width_rule" */
104 extern INTBIG      dr_min_node_sizekey;					/* key for "DRC_min_node_size" */
105 extern INTBIG      dr_min_node_size_rulekey;			/* key for "DRC_min_node_size_rule" */
106 extern INTBIG      dr_connected_distanceskey;			/* key for "DRC_min_connected_distances" */
107 extern INTBIG      dr_connected_distances_rulekey;		/* key for "DRC_min_connected_distances_rule" */
108 extern INTBIG      dr_unconnected_distanceskey;			/* key for "DRC_min_unconnected_distances" */
109 extern INTBIG      dr_unconnected_distances_rulekey;	/* key for "DRC_min_unconnected_distances_rule" */
110 extern INTBIG      dr_connected_distancesWkey;			/* key for "DRC_min_connected_distances_wide" */
111 extern INTBIG      dr_connected_distancesW_rulekey;		/* key for "DRC_min_connected_distances_wide_rule" */
112 extern INTBIG      dr_unconnected_distancesWkey;		/* key for "DRC_min_unconnected_distances_wide" */
113 extern INTBIG      dr_unconnected_distancesW_rulekey;	/* key for "DRC_min_unconnected_distances_wide_rule" */
114 extern INTBIG      dr_connected_distancesMkey;			/* key for "DRC_min_connected_distances_multi" */
115 extern INTBIG      dr_connected_distancesM_rulekey;		/* key for "DRC_min_connected_distances_multi_rule" */
116 extern INTBIG      dr_unconnected_distancesMkey;		/* key for "DRC_min_unconnected_distances_multi" */
117 extern INTBIG      dr_unconnected_distancesM_rulekey;	/* key for "DRC_min_unconnected_distances_multi_rule" */
118 extern INTBIG      dr_edge_distanceskey;				/* key for "DRC_min_edge_distances" */
119 extern INTBIG      dr_edge_distances_rulekey;			/* key for "DRC_min_edge_distances_rule" */
120 #ifdef SURROUNDRULES
121 extern INTBIG      dr_surround_layer_pairskey;			/* key for "DRC_surround_layer_pairs" */
122 extern INTBIG      dr_surround_distanceskey;			/* key for "DRC_surround_distances" */
123 extern INTBIG      dr_surround_rulekey;					/* key for "DRC_surround_rule" */
124 #endif
125 extern INTBIG      dr_ignore_listkey;					/* key for tool:drc.DRC_ignore_list */
126 extern INTBIG      dr_lastgooddrckey;					/* key for "DRC_last_good_drc" */
127 extern BOOLEAN     dr_logerrors;						/* TRUE to log errors in error reporting system */
128 extern TECHNOLOGY *dr_curtech;							/* technology whose valid layers are cached */
129 extern BOOLEAN    *dr_layersvalid;						/* list of valid layers in cached technology */
130 
131 void      dr_init(INTBIG*, CHAR1*[], TOOL*);
132 void      dr_done(void);
133 void      dr_set(INTBIG, CHAR*[]);
134 void      dr_examinenodeproto(NODEPROTO*);
135 void      dr_slice(void);
136 INTBIG    dr_request(CHAR *command, va_list ap);
137 void      dr_modifynodeinst(NODEINST*,INTBIG,INTBIG,INTBIG,INTBIG,INTBIG,INTBIG);
138 void      dr_modifyarcinst(ARCINST*,INTBIG,INTBIG,INTBIG,INTBIG,INTBIG,INTBIG);
139 void      dr_newobject(INTBIG, INTBIG);
140 void      dr_killobject(INTBIG, INTBIG);
141 void      dr_newvariable(INTBIG, INTBIG, INTBIG, INTBIG);
142 void      dr_eraselibrary(LIBRARY*);
143 
144 /* intertool prototypes */
145 void      dr_flatwrite(NODEPROTO*);
146 void      dr_flatignore(CHAR*);
147 void      dr_flatunignore(CHAR*);
148 INTBIG    dr_rulesdlog(TECHNOLOGY *tech, DRCRULES *rules);
149 DRCRULES *dr_allocaterules(INTBIG layercount, INTBIG nodecount, CHAR *techname);
150 void      dr_freerules(DRCRULES *rules);
151 INTBIG    dr_getoptionsvalue(void);
152 void      dr_reset_dates(void);
153 void      dr_cachevalidlayers(TECHNOLOGY *tech);
154 INTBIG    dr_adjustedmindist(TECHNOLOGY *tech, LIBRARY *lib, INTBIG layer1, INTBIG size1,
155 			INTBIG layer2, INTBIG size2, BOOLEAN con, BOOLEAN multi, INTBIG *edge, CHAR **rule);
156 
157 INTBIG    drcb_check(NODEPROTO *cell, BOOLEAN report, BOOLEAN justarea);
158 void      drcb_initincrementalcheck(NODEPROTO *cell);
159 void      drcb_checkincremental(GEOM *geom, BOOLEAN partial);
160 void      drcb_term(void);
161 
162 void      dr_quickcheck(NODEPROTO *cell, INTBIG count, NODEINST **nodestocheck, BOOLEAN *validity, BOOLEAN justarea);
163 void      dr_quickterm(void);
164 
165 #if defined(__cplusplus) && !defined(ALLCPLUSPLUS)
166 }
167 #endif
168