1 /* ----------------------------------------------------------------- 2 "@(#) standard.h (Yale) version 4.16 4/2/92" 3 FILE: standard.h 4 DESCRIPTION:TimberwolfSC main insert file. 5 CONTENTS: 6 DATE: Mar 27, 1989 7 REVISIONS: Sat Dec 15 22:08:21 EST 1990 - modified pinloc values 8 so that it will always be positive. 9 Thu Dec 20 00:05:40 EST 1990 - made timing values doubles 10 for more accuracy. 11 Thu Jan 24 16:34:51 PST 1991 - added user initialization. 12 Fri Mar 22 15:20:24 CST 1991 - added SHORT_LONG 13 definitions for large designs. 14 Tue Mar 26 11:33:47 EST 1991 - added NO_FEED_INSTANCES 15 conditional compile. 16 ----------------------------------------------------------------- */ 17 #ifndef YSTANDARD_H 18 #define YSTANDARD_H 19 20 #ifdef VMS 21 #define lINT 22 #endif 23 /* a cheap way of avoiding the inclusions of the sccs 24 stuff for VMS systems 25 */ 26 27 #include <yalecad/base.h> 28 29 30 #ifndef NO_FEED_INSTANCES 31 #define FEED_INSTANCES /* ---selection of this keyword will cause */ 32 /* each feed-through cell to have */ 33 /* a distinct (instance) name */ 34 #endif /* NO_FEED_INSTANCES */ 35 36 /* I/O macros */ 37 #include <yalecad/file.h> 38 39 /* Pin list includes an embedded hash table */ 40 #include <yalecad/hash.h> 41 42 #ifdef MAIN_VARS 43 #define EXTERN 44 #else 45 #define EXTERN extern 46 #endif 47 48 /* ***********LEAVE THE BELOW UNCHANGED *************************** */ 49 /* remove graphics lines of code if compile switch is on */ 50 #ifdef NOGRAPHICS 51 #define G(x_xz) 52 53 #else 54 #define G(x_xz) x_xz 55 56 #endif /* NOGRAPHICS */ 57 58 #define MAXINT 0x7FFFFFFF 59 60 #define ALLOC(type) ( (type *) Ysafe_malloc ( sizeof(type) ) ) 61 #define SetBin(x) (( (TrybinG=((x)-binOffstG)/binWidthG)<0 ) ? 0 : \ 62 ((TrybinG>numBinsG) ? numBinsG : TrybinG )) 63 64 #ifdef USER_DEFS /* allow user to add custom interface */ 65 66 #define USER_INITIALIZATION() User_initialization() 67 #define USER_NEXT_METER() User_next_meter() 68 #define USER_INCR_METER() User_incr_meter() 69 #define USER_SEND_VALUE( a ) User_send_value( a ) 70 71 #else /* NO USER DEFINITIONS */ 72 73 #define USER_INITIALIZATION() 74 #define USER_NEXT_METER() 75 #define USER_INCR_METER() 76 #define USER_SEND_VALUE( a ) 77 78 #endif /* USER_DEFINITIONS */ 79 80 #define CULLNULL (CBOXPTR) NULL 81 #define PINNULL (PINBOXPTR) NULL 82 #define DIMNULL (DBOXPTR) NULL 83 #define TILENULL (TIBOXPTR) NULL 84 #define LEFT_MOST 0 85 #define RITE_MOST 1 86 #define FEED_FLAG 2 87 #define NOT_DONE -2 88 #define NO_PINS -1000 89 #define BIG_NUMBER 32000 90 #define TW_PRIME 49999 91 #define TW_PRIME2 1009 92 #define GATE_ARRAY_MAGIC_CONSTANT -1000001 93 94 /* used to describe pin location */ 95 #define LEFTCELL 1 /* was -2 */ 96 #define BOTCELL 2 /* was -1 */ 97 #define NEITHER 3 /* was 0 */ 98 #define TOPCELL 4 /* was 1 */ 99 #define RITECELL 5 /* was 2 */ 100 #define PINLOC_OFFSET 3 /* diff needed to make field positive */ 101 102 typedef struct blockbox { 103 INT bxcenter ; 104 INT bycenter ; 105 INT bleft ; 106 INT bright ; 107 INT desire ; 108 INT blength ; 109 INT oldsize ; 110 INT newsize ; 111 INT orig_desire ; 112 INT bbottom ; 113 INT btop ; 114 INT bheight ; 115 SHORT bclass ; 116 SHORT borient ; 117 } *BBOXPTR, BBOX ; 118 119 typedef struct glistbox { /* generic list */ 120 union { 121 INT net ; /* make code easier to read */ 122 INT path ; 123 INT cell ; 124 } p ; 125 struct glistbox *next ; 126 } GLISTBOX , *GLISTPTR ; 127 128 129 typedef struct equiv_box { 130 char *pinname ; 131 char unequiv ; 132 char txoff ; 133 SHORT_LONG typos ; 134 } 135 EQ_NBOX , 136 *EQ_NBOXPTR ; 137 138 typedef struct pinbox { 139 struct pinbox *next ; /* next pin on this net */ 140 struct pinbox *nextpin ; /* next pin on this cell */ 141 char *pinname ; 142 INT terminal ; 143 INT xpos ; /* global positions */ 144 INT ypos ; 145 INT newx ; 146 INT newy ; 147 SHORT_LONG txpos[2] ; /* cell relative position */ 148 SHORT_LONG typos[2] ; /* cell relative position */ 149 INT cell ; 150 INT net ; 151 SHORT row ; 152 char pinloc ; 153 char flag ; 154 struct adjacent_seg *adjptr ; 155 struct equiv_box *eqptr ; 156 } *PINBOXPTR, PINBOX ; 157 158 typedef struct pathbox { 159 INT path_len ; /* bound on the calculated half perim */ 160 INT new_path_len ; /* new path */ 161 INT priority ; 162 INT upper_bound ; 163 INT lower_bound ; 164 GLISTPTR nets ; 165 struct pathbox *next ; /* build a list first then array for speed */ 166 } PATHBOX , *PATHPTR ; 167 168 169 typedef struct tilebox { 170 SHORT_LONG left ; 171 SHORT_LONG right ; 172 SHORT_LONG bottom ; 173 SHORT_LONG top ; 174 } *TIBOXPTR, TIBOX ; 175 176 // Each cell defines any number of swap groups. 177 // Each swap group has a record containing the 178 // swap group number and the number of pin groups 179 // in the cell belonging to that swap group. 180 // 181 // The most common uses are clock/buffer tree 182 // optimization and scan chain optimization. 183 // For these, num_pin_group is normally 1. 184 // 185 // Note that this record does not specify 186 // where in the swap group to find the pin 187 // group(s). 188 189 typedef struct swapgrouplist { 190 SHORT swap_group ; 191 SHORT num_pin_group ; 192 } *SGLISTPTR, SGLIST ; 193 194 typedef struct cellbox { 195 char *cname ; 196 char corient ; 197 char orflag ; 198 char ECO_flag ; 199 INT cxcenter ; 200 INT cycenter ; 201 INT border ; 202 INT cclass ; 203 UNSIGNED_INT cbclass[8] ; 204 SHORT_LONG cheight ; 205 SHORT_LONG clength ; 206 SHORT cblock ; 207 SHORT numterms ; 208 SHORT num_swap_group ; 209 SGLISTPTR swapgroups ; 210 GLISTPTR paths ; /* timing paths of a cell */ 211 struct pad_rec *padptr; 212 struct fencebox *fence; 213 struct imp_box *imptr ; 214 PINBOXPTR pins ; /* the pins of the cell */ 215 TIBOXPTR tileptr ; 216 } *CBOXPTR, CBOX ; 217 218 typedef struct fencebox { 219 INT min_block ; 220 INT max_block ; 221 INT min_xpos ; 222 INT max_xpos ; 223 struct fencebox *next_fence ; 224 } *FENCEBOXPTR, FENCEBOX ; 225 226 typedef struct dimbox { 227 PINBOXPTR pins ; /* pins of the net */ 228 char *name ; 229 char dflag ; 230 char feedflag ; 231 char ignore ; 232 INT xmin ; 233 INT newxmin ; 234 INT xmax ; 235 INT newxmax ; 236 INT ymin ; 237 INT newymin ; 238 INT ymax ; 239 INT newymax ; 240 SHORT Lnum ; 241 SHORT newLnum ; 242 SHORT Rnum ; 243 SHORT newRnum ; 244 SHORT Bnum ; 245 SHORT newBnum ; 246 SHORT Tnum ; 247 SHORT newTnum ; 248 SHORT numpins ; 249 GLISTPTR paths ; /* paths which this net belongs */ 250 INT newhalfPx ; /* new half perimeter bounding box */ 251 INT newhalfPy ; /* new half perimeter: y portion */ 252 INT halfPx ; /* current half perimeter bounding box */ 253 INT halfPy ; /* current half perimeter: y portion */ 254 } *DBOXPTR, DBOX ; 255 256 257 typedef struct hash { 258 char *hname ; 259 INT hnum ; 260 struct hash *hnext ; 261 } HASHBOX, *HASHPTR ; 262 263 typedef struct binbox { 264 INT left ; 265 INT right ; 266 INT *cell ; 267 INT penalty ; 268 INT nupenalty ; 269 } BINBOX, *BINPTR ; 270 271 typedef struct pin_list { /* list of pins */ 272 PINBOXPTR swap_pin ; 273 struct pin_list *next ; /* Next pin in pin group */ 274 struct pin_list *next_grp ; /* Next pin group in same cell */ 275 } PINLIST, *PINLISTPTR ; 276 277 typedef struct swapbox { /* list of list of pins to be swapped */ 278 INT num_pin_grps ; 279 YHASHPTR pin_grp_hash ; 280 } SWAPBOX ; 281 282 typedef struct graph_edge_cost { 283 INT node1 ; 284 INT node2 ; 285 INT cost ; 286 INT channel ; 287 } 288 *EDGE_COST , 289 EDGE_COST_BOX ; 290 291 /* ****************** GLOBALS ************************** */ 292 /* THE MAJOR PARTS OF THE DATA STRUCTURES */ 293 EXTERN CBOXPTR *carrayG ; 294 EXTERN DBOXPTR *netarrayG ; 295 EXTERN PINBOXPTR *tearrayG ; 296 EXTERN BBOXPTR *barrayG ; 297 EXTERN BINBOX ***binptrG ; 298 EXTERN PATHPTR *patharrayG ; /* array of timing paths */ 299 300 EXTERN DOUBLE vertical_path_weightG ; 301 EXTERN DOUBLE horizontal_path_weightG ; 302 EXTERN DOUBLE vertical_wire_weightG ; 303 304 /* the configuration */ 305 EXTERN INT numcellsG ; 306 EXTERN INT numtermsG ; 307 extern INT numnetsG ; 308 EXTERN INT numpadgrpsG ; 309 EXTERN INT lastpadG ; 310 EXTERN INT maxtermG ; 311 EXTERN INT numRowsG ; 312 EXTERN INT numChansG ; 313 EXTERN INT numpathsG ; 314 EXTERN INT numBinsG ; 315 EXTERN INT binWidthG ; 316 EXTERN INT binOffstG ; 317 EXTERN INT TotRegPinsG ; 318 EXTERN INT implicit_feed_countG ; 319 320 /* for the penalties */ 321 EXTERN INT TrybinG ; 322 EXTERN INT binpenalG ; 323 EXTERN INT funccostG ; 324 EXTERN INT newbinpenalG ; 325 EXTERN INT newrowpenalG ; 326 EXTERN INT penaltyG ; 327 EXTERN INT rowpenalG ; 328 EXTERN INT timingcostG ; 329 EXTERN DOUBLE binpenConG ; 330 EXTERN DOUBLE roLenConG ; 331 EXTERN DOUBLE timeFactorG ; 332 333 #undef EXTERN 334 335 /* *********************** PROTOTYPES FOR TWSC ******************** */ 336 extern void init_table( P1(void) ) ; 337 extern BOOL acceptt( P3(INT d_wire,INT d_time,INT d_penal) ) ; 338 extern BOOL accept_greedy( P3(INT d_wire,INT d_time,INT d_penal) ) ; 339 340 341 #endif /* YSTANDARD_H */ 342