1 /* -*- tab-width: 4 -*-
2  *
3  * Electric(tm) VLSI Design System
4  *
5  * File: sc1.h
6  * Header file for the QUISC Silicon Compiler
7  * Written by: Andrew R. Kostiuk, Queen's University
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 /***********************************************************************
38 	General Constants
39 ------------------------------------------------------------------------
40 */
41 #define VERSION			x_("1.00")
42 #define DATE			x_("Feb 24, 1987")
43 #define PARS			10
44 #define MAXLINE         80
45 #define GND				0
46 #define PWR				1
47 #define SCSIMFILE       x_("simset.tmp")
48 
49 /***********************************************************************
50 	Error Codes
51 ------------------------------------------------------------------------
52 */
53 
54 #define SC_NOERROR					0
55 #define SC_UNKNOWN					1
56 #define SC_NCREATE					2
57 #define SC_NCREATECELL				3
58 #define SC_CELLEXISTS				4
59 #define SC_CELLNOMAKE				5
60 #define SC_XCREATE					6
61 #define SC_NLIBRARY					7
62 #define SC_XLIBRARY					8
63 #define SC_NLIBRARYUSE				9
64 #define SC_NOLIBRARY				10
65 #define SC_NLIBRARYREAD				11
66 #define SC_LIBNOMAKE				12
67 #define SC_NOMEMORY					13
68 #define SC_LIBNSTYLE				14
69 #define SC_LIBNOREAD				15
70 #define SC_CRNODENONAME				16
71 #define SC_CRNODENOPROTO			17
72 #define SC_CRNODENOLIB				18
73 #define SC_CRNODEPROTONF			19
74 #define SC_NOCELL					20
75 #define SC_CRNODENOMAKE				21
76 #define SC_NODENAMENOMAKE			22
77 #define SC_NIEXISTS					23
78 #define SC_NSHOW					24
79 #define SC_XSHOW					25
80 #define SC_SHOWPNOCELL				26
81 #define SC_CELLNOFIND				27
82 #define SC_NCONNECT					28
83 #define SC_PORTNFIND				29
84 #define SC_NOUARC					30
85 #define SC_ARCNOMAKE				31
86 #define SC_COMPNFILE				32
87 #define SC_COMPFILENOPEN			33
88 #define SC_XCONLIST					34
89 #define SC_NPERR					35
90 #define SC_EDGEERROR				36
91 #define SC_SIMNPARS					37
92 #define SC_SIMXCMD					38
93 #define SC_SIMSETNPARS				39
94 #define SC_SIMXSETVAL				40
95 #define SC_SIMSHOWNPARS				41
96 #define SC_SIMNOVAR					42
97 #define SC_NIVARNOMAKE				43
98 #define SC_SIMWRITENPARS			44
99 #define SC_SIMWRITEFOPEN			45
100 #define SC_SCVARNOFIND				46
101 #define SC_SETNCMD					47
102 #define SC_SETXCMD					48
103 #define SC_NPNOTFIND				49
104 #define SC_PPNOTFIND				50
105 #define SC_SETXPORTDIR				51
106 #define SC_EXPORTNONODE				52
107 #define SC_EXPORTNODENOFIND			53
108 #define SC_EXPORTNOPORT				54
109 #define SC_EXPORTPORTNOFIND			55
110 #define SC_EXPORTXPORTTYPE			56
111 #define SC_EXPORTNONAME				57
112 #define SC_EXPORTNAMENOTUNIQUE		58
113 #define SC_SIMSETFERROR				59
114 #define SC_COMPVHDLERR				60
115 #define SC_NINOFIND					61
116 #define SC_ORDERNPARS				62
117 #define SC_SELECTNCMD				63
118 #define SC_SELECT_CELL_NONAME		64
119 #define SC_SELECT_XCMD				65
120 #define SC_SET_OUTPUT_FILE_XOPEN	66
121 #define SC_PLACE_NO_CONNECTIONS		67
122 #define SC_PLACE_XCMD				68
123 #define SC_PLACE_SET_NOCMD			69
124 #define SC_PLACE_SET_XCMD			70
125 #define SC_CELL_NO_PLACE			71
126 #define SC_ROUTE_XCMD				72
127 #define SC_ROUTE_SET_XCMD			73
128 #define SC_ROUTE_SET_NOCMD			74
129 #define SC_CELL_NO_ROUTE			75
130 #define SC_MAKE_XCMD				76
131 #define SC_MAKE_SET_NOCMD			77
132 #define SC_MAKE_SET_XCMD			78
133 #define SC_MAKER_NOCREATE_LEAF_CELL	79
134 #define SC_MAKER_NOCREATE_LEAF_INST	80
135 #define SC_MAKER_NOCREATE_LEAF_FEED	81
136 #define SC_MAKER_NOCREATE_VIA		82
137 #define SC_MAKER_NOCREATE_LAYER2	83
138 #define SC_MAKER_NOCREATE_LAYER1	84
139 #define SC_MAKER_NOCREATE_XPORT		85
140 #define SC_NOSET_CELL_NUMS			86
141 #define SC_SET_CNUMS_XOPT			87
142 #define SC_NO_LAYER1_NODE			88
143 #define SC_NO_LAYER2_NODE			89
144 #define SC_NO_VIA					90
145 #define SC_NO_LAYER1_ARC			91
146 #define SC_NO_LAYER2_ARC			92
147 #define SC_NO_LAYER_PWELL			93
148 #define SC_NOCREATE_PWELL			94
149 #define SC_NO_ALS					95
150 #define SC_NO_VHDL_PROG				96
151 #define SC_ORDER_XOPEN_FILE			97
152 #define SC_VERIFY_NO_CELLS			98
153 #define SC_SET_NAME_NO_PARS			99
154 #define SC_SET_NAME_INST_NO_FIND	100
155 #define SC_SET_NAME_PORT_NO_FIND	101
156 #define SC_SET_NAME_NO_NODE			102
157 
158 /***********************************************************************
159     Savable Parameters
160 ------------------------------------------------------------------------
161 */
162 #define SC_PARAM_MAKE_HORIZ_ARC          1
163 #define SC_PARAM_MAKE_VERT_ARC           2
164 #define SC_PARAM_MAKE_L1_WIDTH           3
165 #define SC_PARAM_MAKE_L2_WIDTH           4
166 #define SC_PARAM_MAKE_PWR_WIDTH          5
167 #define SC_PARAM_MAKE_MAIN_PWR_WIDTH     6
168 #define SC_PARAM_MAKE_MAIN_PWR_RAIL      7
169 #define SC_PARAM_MAKE_PWELL_SIZE         8
170 #define SC_PARAM_MAKE_PWELL_OFFSET       9
171 #define SC_PARAM_MAKE_NWELL_SIZE        10
172 #define SC_PARAM_MAKE_NWELL_OFFSET      11
173 #define SC_PARAM_MAKE_VIA_SIZE          12
174 #define SC_PARAM_MAKE_MIN_SPACING       13
175 #define SC_PARAM_ROUTE_FEEDTHRU_SIZE    14
176 #define SC_PARAM_ROUTE_PORT_X_MIN_DIST  15
177 #define SC_PARAM_ROUTE_ACTIVE_DIST      16
178 #define SC_PARAM_PLACE_NUM_ROWS         17
179 
180 /* default values for maker */
181 #define DEFAULT_MIN_SPACING			2400		/* minimum metal spacing */
182 #define DEFAULT_VIA_SIZE			1600		/* VIA size */
183 #define DEFAULT_ARC_HORIZONTAL		NOARCPROTO	/* arc name on layer 1 */
184 #define DEFAULT_ARC_VERTICAL		NOARCPROTO	/* arc name on layer 2 */
185 #define DEFAULT_L2_TRACK_WIDTH		1600		/* layer 2 track width */
186 #define DEFAULT_L1_TRACK_WIDTH		1600		/* layer 1 track width */
187 #define DEFAULT_POWER_TRACK_WIDTH	2000		/* power track width */
188 #define DEFAULT_MAIN_POWER_WIDTH	3200		/* main power buses width */
189 #define DEFAULT_MAIN_POWER_RAIL     0			/* main power on horizontal */
190 #define DEFAULT_PWELL_SIZE			0			/* P-well size */
191 #define DEFAULT_PWELL_OFFSET		0			/* P-well offset from bottom */
192 #define DEFAULT_NWELL_SIZE			0			/* N-well size */
193 #define DEFAULT_NWELL_OFFSET		0			/* N-well offset from bottom */
194 
195 /* default values for router */
196 #define DEFAULT_FEED_THROUGH_SIZE	6400	/* feed through size */
197 #define DEFAULT_PORT_X_MIN_DISTANCE	3200	/* min distance between ports*/
198 #define DEFAULT_ACTIVE_DISTANCE		3200	/* minimum distance to active*/
199 
200 /* default values for placer */
201 #define DEFAULT_NUM_OF_ROWS			4	/* default number of rows */
202 
203 /***********************************************************************
204 	QUISC Cell Structure
205 ------------------------------------------------------------------------
206 */
207 
208 typedef struct Isccell
209 {
210 	CHAR              *name;			/* name of complex cell */
211 	int                max_node_num;	/* maximum number of nodes */
212 	struct Iscnitree  *niroot;			/* root to instance tree for cell */
213 	struct Iscnitree  *nilist;			/* list of instances for cell */
214 	struct Iscsim     *siminfo;			/* simulation information */
215 	struct Iscextnode *ex_nodes;		/* extracted nodes */
216 	int                bits;			/* flags for processing cell */
217 	struct Iscextnode *power;			/* list of power ports */
218 	struct Iscextnode *ground;			/* list of ground ports */
219 	struct Iscport    *ports, *lastport; /* list of ports */
220 	struct Iscplace   *placement;		/* placement information of cell */
221 	struct Iscroute   *route;			/* routing information for cell */
222 	struct Isccell    *next;			/* list of SC cells */
223 } SCCELL;
224 
225 typedef struct Iscport
226 {
227 	CHAR             *name;				/* name of port */
228 	struct Iscnitree *node;				/* special node */
229 	struct Isccell   *parent;			/* complex cell on which */
230 										/* this port resides */
231 	int               bits;				/* port attributes */
232 	struct Iscport   *next;				/* pointer to next port */
233 } SCPORT;
234 
235 typedef struct Isccellnums
236 {
237 	int			top_active;			/* active area from top */
238 	int			bottom_active;		/* active are from bottom */
239 	int			left_active;		/* active area from left */
240 	int			right_active;		/* active are from right */
241 } SCCELLNUMS;
242 
243 /***********************************************************************
244 	Instance Tree Structure
245 ------------------------------------------------------------------------
246 */
247 
248 /***** Types of Instances *****/
249 #define SCLEAFCELL     0
250 #define SCCOMPLEXCELL  1
251 #define SCSPECIALCELL  2
252 #define SCFEEDCELL     3
253 #define SCSTITCH       4
254 #define SCLATERALFEED  5
255 
256 typedef struct Iscnitree
257 {
258 	CHAR				*name;		/* pointer to string of instance name */
259 	int					number;		/* alternative number of node */
260 	int					type;		/* type of instance */
261 	CHAR				*np;		/* pointer to leaf cell */
262 									/* or SCCELL if complex */
263 	int					size;		/* x size if leaf cell */
264 	struct Iscconlist	*connect;	/* pointer to connection list */
265 	struct Iscniport	*ports;		/* list of io ports and ext nodes */
266 	struct Iscniport	*power;		/* list of actual power ports */
267 	struct Iscniport	*ground;	/* list of actual ground ports */
268 	int					flags;		/* bits for silicon compiler */
269 	CHAR				*tp;		/* generic temporary pointer */
270 	struct Iscnitree	*next;		/* pointer to next instance in list */
271 	struct Iscnitree	*lptr;		/* left pointer for tree structure */
272 	struct Iscnitree	*rptr;		/* right pointer for tree structure */
273 } SCNITREE;
274 
275 typedef struct Iscniport
276 {
277 	CHAR				*port;		/* leaf port or */
278 									/* SCPORT if on complex cell */
279 	struct Iscextnode	*ext_node;	/* extracted node */
280 	int					bits;		/* bits for processing */
281 	int					xpos;		/* x position if leaf port */
282 	struct Iscniport	*next;		/* list of instance ports */
283 } SCNIPORT;
284 #define SCNIPORTSEEN	0x00000001
285 
286 /***********************************************************************
287 	Connection Structures
288 ------------------------------------------------------------------------
289 */
290 
291 typedef struct Iscconlist
292 {
293 	struct Iscniport	*portA;		/* pointer to port on node A */
294 	struct Iscnitree	*nodeB;		/* pointer to node B */
295 	struct Iscniport	*portB;		/* pointer to port on node B */
296 	struct Iscextnode	*ext_node;	/* pointer to extracted node */
297 	struct Iscconlist   *next;		/* pointer to next list element */
298 } SCCONLIST;
299 
300 /***********************************************************************
301 	Extraction Structures
302 ------------------------------------------------------------------------
303 */
304 
305 typedef struct Iscextport
306 {
307 	struct Iscnitree	*node;		/* instance of extracted node */
308 	struct Iscniport	*port;		/* instance port */
309 	struct Iscextport	*next;		/* next in list of common node */
310 } SCEXTPORT;
311 
312 #define SCEXTNODECLUSE	0x0003
313 #define SCEXTNODEGROUP1	0x0001
314 #define SCEXTNODEGROUP2	0x0002
315 
316 typedef struct Iscextnode
317 {
318 	CHAR				*name;		/* optional name of port */
319 	struct Iscextport	*firstport;	/* link list of ports */
320 	int					flags;		/* flags for processing */
321 	CHAR				*ptr;		/* generic pointer for processing */
322 	struct Iscextnode	*next;		/* link list of nodes */
323 } SCEXTNODE;
324 
325 /***********************************************************************
326 	Simulation Structures
327 ------------------------------------------------------------------------
328 */
329 
330 #define SCSIMWRITEBITS	0x00000003	/* flag bits for sim write */
331 #define SCSIMWRITENEED	0x00000001	/* needs to be written */
332 #define SCSIMWRITESEEN	0x00000002	/* has been written */
333 
334 typedef struct Iscsim
335 {
336 	CHAR		*model;
337 	struct Iscsim	*next;
338 } SCSIM;
339 
340 /***********************************************************************
341 	Placement Structures and Constants
342 ------------------------------------------------------------------------
343 */
344 
345 /***** general placement information *****/
346 typedef struct Iscplace
347 {
348 	int						num_inst;	/* number of instances */
349 	int						size_inst;	/* total size of instances */
350 	int						avg_size;	/* average size of inst */
351 	int						avg_height;	/* average height of inst */
352 	int						num_rows;	/* number of rows */
353 	int						size_rows;	/* target size of each row */
354 	struct Iscrowlist		*rows;		/* rows of placed cells */
355 	struct Iscnbplace		*plist;		/* start of cell list */
356 	struct Iscnbplace		*endlist;	/* end of cell list */
357 } SCPLACE;
358 
359 typedef struct Iscplacecontrol
360 {
361 	int		stats_flag;			/* TRUE = print statistics */
362 	int		sort_flag;			/* TRUE = sort cluster tree */
363 	int		net_balance_flag;	/* TRUE = do net balance */
364 	int		net_balance_limit;	/* limit of movement */
365 	int		vertical_cost;		/* scaling factor */
366 } SCPLACECONTROL;
367 
368 #define SCBITS_PLACEMASK	0x01
369 #define SCBITS_PLACED		0x01
370 #define SCBITS_EXTRACT		0x02
371 
372 typedef struct Isccluster
373 {
374 	struct Iscnitree		*node;	  /* instance of cluster */
375 	int						number;   /* number of cluster */
376 	int						size;	  /* total size of members */
377 	struct Isccluster		*last;	  /* pointer to last cluster */
378 	struct Isccluster		*next;	  /* pointer to next cluster */
379 } SCCLUSTER;
380 
381 typedef struct Iscclustertree
382 {
383 	struct Isccluster		*cluster; /* pointer to cluster */
384 										  /* NOSCCLUSTER if intermediate node*/
385 	int						bits;	  /* working bits */
386 	struct Iscclustertree	*parent;  /* parent node */
387 	struct Iscclustertree	*next;	  /* pointer to nodes on same level */
388 	struct Iscclustertree	*lptr;	  /* pointer to one group */
389 	struct Iscclustertree	*rptr;	  /* pointer to second group */
390 } SCCLUSTERTREE;
391 
392 typedef struct Iscclconnect
393 {
394 	struct Iscclustertree	*node[2]; /* pointers to names of nodes */
395 	int						count;    /* number of connections */
396 	struct Iscclconnect		*next;    /* pointer to next list element */
397 	struct Iscclconnect		*last;    /* pointer to previous list element*/
398 } SCCLCONNECT;
399 
400 typedef struct Iscrowlist
401 {
402 	struct Iscnbplace	*start;		/* start of row cells */
403 	struct Iscnbplace	*end;		/* end of row cells */
404 	int					row_num;	/* row number (0 = bottom) */
405 	int					row_size;	/* current row size */
406 	struct Iscrowlist	*next;		/* next in row list */
407 	struct Iscrowlist	*last;		/* last in row list */
408 } SCROWLIST;
409 
410 #define NOSCNBPLACE	((SCNBPLACE *)-1)
411 typedef struct Iscnbplace
412 {
413 	struct Iscnitree	*cell;		/* pointer to cell */
414 	int					xpos;		/* x position (0 at left) */
415 	struct Iscnbplace	*last;		/* pointer to last in list */
416 	struct Iscnbplace	*next;		/* pointer to right in list */
417 } SCNBPLACE;
418 
419 typedef struct Iscchannel
420 {
421 	int					number;		/* number of channel */
422 	struct Iscnbtrunk	*trunks;	/* list of trunks */
423 	struct Iscchannel	*last;		/* last in list of channels */
424 	struct Iscchannel	*next;		/* next in list of channels */
425 } SCCHANNEL;
426 
427 typedef struct Iscnbtrunk
428 {
429 	struct Iscextnode	*ext_node;	/* pointer to extracted node */
430 	int					minx;		/* minimum trunk going left */
431 	int					maxx;		/* maximum trunk going right */
432 	struct Iscnbtrunk	*same;		/* same in next channel */
433 	struct Iscnbtrunk	*next;		/* pointer to next trunk */
434 } SCNBTRUNK;
435 
436 #define SC_PLACE_SORT_ALL_TREES	0x0000000F
437 #define SC_PLACE_SORT_TREE_0	0x00000001
438 #define SC_PLACE_SORT_TREE_1	0x00000002
439 #define SC_PLACE_SORT_TREE_2	0x00000004
440 #define SC_PLACE_SORT_TREE_3	0x00000008
441 #define SC_PLACE_SORT_MASK_1	0x0000000D
442 #define SC_PLACE_SORT_MASK_2	0x0000000B
443 #define SC_PLACE_SORT_CASE_1	0x00000005
444 #define SC_PLACE_SORT_CASE_2	0x0000000A
445 
446 
447 /***********************************************************************
448 	Routing structures and constants
449 ------------------------------------------------------------------------
450 */
451 
452 /***** Directions that ports can be attached to *****/
453 #define SCPORTDIRMASK	0x0000000F	/* mask for port direction */
454 #define SCPORTDIRUP		0x00000001	/* port direction up */
455 #define SCPORTDIRDOWN	0x00000002	/* port direction down */
456 #define SCPORTDIRRIGHT	0x00000004	/* port direction right */
457 #define SCPORTDIRLEFT	0x00000008	/* port direction left */
458 #define SCPORTTYPE		0x000003F0	/* port type mask */
459 #define SCGNDPORT		0x00000010	/* ground port */
460 #define SCPWRPORT		0x00000020	/* power port */
461 #define SCBIDIRPORT		0x00000040	/* bidirectional port */
462 #define SCOUTPORT		0x00000080	/* output port */
463 #define SCINPORT		0x00000100	/* input port */
464 #define SCUNPORT		0x00000200	/* unknown port */
465 
466 #define SCROUTEMASK		0x00000007	/* mask for all bits */
467 #define SCROUTESEEN		0x00000001	/* seen in processing */
468 #define SCROUTEUNUSABLE	0x00000002	/* unusable in current track */
469 #define SCROUTETEMPNUSE	0x00000004	/* temporary not use */
470 
471 typedef struct Iscroute
472 {
473 	struct Iscroutechannel	*channels;	/* list of channels */
474 	struct Iscrouteexport	*exports;	/* exported ports */
475 	struct Iscrouterow		*rows;		/* route rows */
476 } SCROUTE;
477 
478 typedef struct Iscroutecontrol
479 {
480 	int			verbose;				/* verbose flag */
481 	int			fuzzy_window_limit;		/* for pass through window */
482 } SCROUTECONTROL;
483 
484 typedef struct Iscrouterow
485 {
486 	int						number;		/* number, 0 = bottom */
487 	struct Iscroutenode		*nodes;		/* list of extracted nodes */
488 	struct Iscrowlist		*row;		/* reference actual row */
489 	struct Iscrouterow		*last;		/* last in row list */
490 	struct Iscrouterow		*next;		/* next in row list */
491 } SCROUTEROW;
492 
493 typedef struct Iscroutenode
494 {
495 	struct Iscextnode		*ext_node;	/* extracted node */
496 	struct Iscrouterow		*row;		/* reference row */
497 	struct Iscrouteport		*firstport;	/* first port in row */
498 	struct Iscrouteport		*lastport;	/* last port in row */
499 	struct Iscroutenode		*same_next;	/* same nodes in above rows */
500 	struct Iscroutenode		*same_last;	/* same nodes in below rows */
501 	struct Iscroutenode		*next;		/* nodes in same row */
502 } SCROUTENODE;
503 
504 typedef struct Iscrouteport
505 {
506 	struct Iscnbplace		*place;		/* reference place */
507 	struct Iscniport		*port;		/* particular port */
508 	struct Iscroutenode		*node;		/* reference node */
509 	int						flags;		/* flags for processing */
510 	struct Iscrouteport		*last;		/* previous port in list */
511 	struct Iscrouteport		*next;		/* next port in list */
512 } SCROUTEPORT;
513 
514 typedef struct Iscroutechannel
515 {
516 	int						number;		/* number, 0 is bottom */
517 	struct Iscroutechnode	*nodes;		/* list of nodes */
518 	struct Iscroutetrack	*tracks;	/* list of tracks */
519 	struct Iscroutechannel	*last;		/* last in channel list */
520 	struct Iscroutechannel	*next;		/* next in channel list */
521 } SCROUTECHANNEL;
522 
523 typedef struct Iscroutechnode
524 {
525 	struct Iscextnode		*ext_node;	/* extracted node */
526 	int						number;		/* optional net number */
527 	struct Iscroutechport	*firstport;	/* first port in row */
528 	struct Iscroutechport	*lastport;	/* last port in row */
529 	struct Iscroutechannel	*channel;	/* reference channel */
530 	int						flags;		/* flags for processing */
531 	struct Iscroutechnode	*same_next;	/* same nodes in above rows */
532 	struct Iscroutechnode	*same_last;	/* same nodes in below rows */
533 	struct Iscroutechnode	*next;		/* nodes in same row */
534 } SCROUTECHNODE;
535 
536 typedef struct Iscroutechport
537 {
538 	struct Iscrouteport		*port;		/* reference port */
539 	struct Iscroutechnode	*node;		/* reference channel node */
540 	int						xpos;		/* x position */
541 	int						flags;		/* flags for processing */
542 	struct Iscroutechport	*last;		/* previous port in list */
543 	struct Iscroutechport	*next;		/* next port in list */
544 } SCROUTECHPORT;
545 
546 typedef struct Iscroutevcg
547 {
548 	struct Iscroutechnode	*chnode;	/* channel node */
549 	int						flags;		/* flags for processing */
550 	struct Iscroutevcgedge	*edges;		/* edges of graph */
551 } SCROUTEVCG;
552 
553 typedef struct Iscroutevcgedge
554 {
555 	struct Iscroutevcg		*node;		/* to which node */
556 	struct Iscroutevcgedge	*next;		/* next in list */
557 } SCROUTEVCGEDGE;
558 
559 typedef struct Iscroutezrg
560 {
561 	int						number;		/* number of zone */
562 	struct Iscroutezrgmem	*chnodes;	/* list of channel nodes */
563 	struct Iscroutezrg		*last;		/* last zone */
564 	struct Iscroutezrg		*next;		/* next zone */
565 } SCROUTEZRG;
566 
567 typedef struct Iscroutezrgmem
568 {
569 	struct Iscroutechnode	*chnode;	/* channel node */
570 	struct Iscroutezrgmem	*next;		/* next in zone */
571 } SCROUTEZRGMEM;
572 
573 typedef struct Iscroutetrack
574 {
575 	int						number;		/* number of track, 0 = top */
576 	struct Iscroutetrackmem	*nodes;		/* track member */
577 	struct Iscroutetrack	*last;		/* last track in list */
578 	struct Iscroutetrack	*next;		/* next track in list */
579 } SCROUTETRACK;
580 
581 typedef struct Iscroutetrackmem
582 {
583 	struct Iscroutechnode	*node;		/* channel node */
584 	struct Iscroutetrackmem	*next;		/* next in same track */
585 } SCROUTETRACKMEM;
586 
587 typedef struct Iscrouteexport
588 {
589 	struct Iscport			*xport;		/* export port */
590 	struct Iscroutechport	*chport;	/* channel port */
591 	struct Iscrouteexport	*next;		/* next export port */
592 } SCROUTEEXPORT;
593 
594 /***********************************************************************
595 	MAKER Structures
596 ------------------------------------------------------------------------
597 */
598 
599 typedef struct Iscmakerinfo
600 {
601 	int			x_size;				/* size in X */
602 	int			y_size;				/* size in Y */
603 	int			area;				/* total area */
604 	int			min_x;				/* minimum X coordinate */
605 	int			max_x;				/* maximum X coordinate */
606 	int			min_y;				/* minimum Y coordinate */
607 	int			max_y;				/* maximum Y coordinate */
608 	int			num_leaf_cells;		/* number of leaf cells */
609 	int			num_feeds;			/* number of feed throughs */
610 	int			num_rows;			/* number of rows of cells */
611 	int			num_channels;		/* number of routing channels */
612 	int			num_tracks;			/* number of routing tracks */
613 	int			track_length;		/* total track length */
614 } SCMAKERINFO;
615 
616 typedef struct Iscmakerdata
617 {
618 	struct Isccell			*cell;		/* cell being layed out */
619 	struct Iscmakerrow		*rows;		/* list of rows */
620 	struct Iscmakerchannel	*channels;	/* list of channels */
621 	struct Iscmakerpower	*power;		/* list of vdd ports */
622 	struct Iscmakerpower	*ground;	/* list of ground ports */
623 	int						minx;		/* minimum x position */
624 	int						maxx;		/* maximum x position */
625 	int						miny;		/* minimum y position */
626 	int						maxy;		/* maximum y position */
627 } SCMAKERDATA;
628 
629 typedef struct Iscmakerrow
630 {
631 	int						number;		/* row number */
632 	struct Iscmakerinst		*members;	/* instances in rows */
633 	int						minx;		/* minimum X position */
634 	int						maxx;		/* maximum X position */
635 	int						miny;		/* minimum Y position */
636 	int						maxy;		/* maximum Y position */
637 	int						flags;		/* processing bits */
638 	struct Iscmakerrow		*last;		/* last row */
639 	struct Iscmakerrow		*next;		/* next row */
640 } SCMAKERROW;
641 
642 typedef struct Iscmakerinst
643 {
644 	struct Iscnbplace		*place;		/* reference place */
645 	struct Iscmakerrow		*row;		/* reference row */
646 	int						xpos;		/* X position */
647 	int						ypos;		/* Y position */
648 	int						xsize;		/* size in X */
649 	int						ysize;		/* size in Y */
650 	int						flags;		/* processing flags */
651 	CHAR					*instance;	/* leaf instance */
652 	struct Iscmakerinst		*next;		/* next in row */
653 } SCMAKERINST;
654 
655 typedef struct Iscmakerchannel
656 {
657 	int						number;		/* number of channel */
658 	struct Iscmakertrack	*tracks;	/* list of tracks */
659 	int						num_tracks;	/* number of tracks */
660 	int						miny;		/* minimum Y position */
661 	int						ysize;		/* Y size */
662 	int						flags;		/* processing bits */
663 	struct Iscmakerchannel	*last;		/* last channel */
664 	struct Iscmakerchannel	*next;		/* next channel */
665 } SCMAKERCHANNEL;
666 
667 typedef struct Iscmakertrack
668 {
669 	int						number;		/* track number */
670 	struct Iscmakernode		*nodes;		/* nodes in track */
671 	struct Iscroutetrack	*track;		/* reference track */
672 	int						ypos;		/* Y position */
673 	int						flags;		/* processing bits */
674 	struct Iscmakertrack	*last;		/* previous track */
675 	struct Iscmakertrack	*next;		/* next track */
676 } SCMAKERTRACK;
677 
678 typedef struct Iscmakernode
679 {
680 	struct Iscmakervia		*vias;		/* list of vias */
681 	struct Iscmakernode		*next;		/* next node in track */
682 } SCMAKERNODE;
683 
684 #define SCVIASPECIAL	0x00000001
685 #define SCVIAEXPORT		0x00000002
686 #define SCVIAPOWER		0x00000004
687 typedef struct Iscmakervia
688 {
689 	int						xpos;		/* X position */
690 	struct Iscroutechport	*chport;	/* associated channel port */
691 	CHAR					*instance;	/* associated leaf instance */
692 	int						flags;		/* flags for processing */
693 	struct Iscrouteexport	*xport;		/* export port */
694 	struct Iscmakervia		*next;		/* next via */
695 } SCMAKERVIA;
696 
697 typedef struct Iscmakerpower
698 {
699 	struct Iscmakerpowerport *ports;	/* list of power ports */
700 	int						ypos;		/* vertical position of row */
701 	struct Iscmakerpower	*next;		/* next in row list */
702 	struct Iscmakerpower	*last;		/* last in row list */
703 } SCMAKERPOWER;
704 
705 typedef struct Iscmakerpowerport
706 {
707 	struct Iscmakerinst		*inst;		/* instance */
708 	struct Iscniport		*port;		/* port on instance */
709 	int						xpos;		/* resultant x position */
710 	struct Iscmakerpowerport *next;		/* next in list */
711 	struct Iscmakerpowerport *last;		/* last in list */
712 } SCMAKERPOWERPORT;
713 
714 /***********************************************************************
715 	CPU Time Usage Constants and Structures
716 ------------------------------------------------------------------------
717 */
718 
719 #define TIME_RESET	0
720 #define TIME_REL	1
721 #define TIME_ABS	2
722 
723 typedef struct tbuffer
724 {
725 	int		proc_user_time;
726 	int		proc_system_time;
727 	int		child_user_time;
728 	int		child_system_time;
729 } TBUFFER;
730 
731 /***********************************************************************
732 	Simulator information
733 -----------------------------------------------------------------------
734 */
735 #define SC_ALS_FORMAT 1
736 #define SC_SILOS_FORMAT 2
737 
738 extern TOOL       *sc_tool;				/* the Silicon Compiler tool object */
739 extern INTBIG      sc_filetypescsim;	/* Silicon compiler simulation file descriptor */
740 extern INTBIG      sc_filetypesctab;	/* Silicon compiler table file descriptor */
741 
742 /* prototypes for tool interface */
743 void sc_init(INTBIG*, CHAR1*[], TOOL*);
744 void sc_done(void);
745 void sc_set(INTBIG, CHAR*[]);
746 INTBIG sc_request(CHAR*, va_list);
747 void sc_slice(void);
748 
749 /* prototypes for intratool interface */
750 void Sc_clear_stop(void);
751 int Sc_stop(void);
752 int Sc_connect(int, CHAR*[]);
753 int Sc_create(int, CHAR*[]);
754 int Sc_delete(void);
755 int Sc_export(int, CHAR*[]);
756 int Sc_extract(int, CHAR*[]);
757 int Sc_maker(int, CHAR*[]);
758 int Sc_place(int, CHAR*[]);
759 int Sc_route(int, CHAR*[]);
760 void Sc_schematic(void);
761 int Sc_simulation(int, CHAR*[]);
762 int Sc_verify(void);
763 CHAR *Sc_find_leaf_cell(CHAR*);
764 CHAR *Sc_first_leaf_port(CHAR*);
765 CHAR *Sc_next_leaf_port(CHAR*);
766 int Sc_leaf_port_type(CHAR*);
767 int Sc_leaf_port_bits(CHAR*);
768 CHAR *Sc_leaf_port_name(CHAR*);
769 void Sc_leaf_cell_get_nums(CHAR*, SCCELLNUMS*);
770 void Sc_extract_print_nodes(SCCELL*);
771 void Sc_route_print_channel(SCROUTECHANNEL*);
772 CHAR *Sc_leaf_cell_name(CHAR*);
773 int Sc_leaf_cell_set_nums(CHAR*, SCCELLNUMS*);
774 SCNITREE **Sc_findni(SCNITREE**, CHAR*);
775 CHAR *Sc_find_leaf_port(CHAR*, CHAR*);
776 int *Sc_leaf_port_bits_address(CHAR*);
777 int Sc_library_read(CHAR*);
778 int Sc_library_use(CHAR*);
779 void Sc_leaf_port_set_next(CHAR*, CHAR*);
780 void Sc_leaf_port_set_first(CHAR*, CHAR*);
781 void Sc_remove_inst_from_itree(SCNITREE**, SCNITREE*);
782 void Sc_make_nilist(SCNITREE*, SCCELL*);
783 int Sc_seterrmsg(int, ...);
784 int Sc_leaf_cell_xsize(CHAR*);
785 int Sc_leaf_cell_ysize(CHAR*);
786 int Sc_leaf_port_xpos(CHAR*);
787 int Sc_leaf_port_ypos(CHAR*);
788 void Sc_initialize(void);
789 void Sc_main(void);
790 void Sc_one_command(int, CHAR*[]);
791 SCNIPORT *Sc_findpp(SCNITREE*, CHAR*);
792 SCNITREE *Sc_new_instance(CHAR*, int);
793 int Sc_conlist(SCNITREE*, SCNIPORT*, SCNITREE*, SCNIPORT*);
794 CHAR *Sc_cpu_time(int);
795 CHAR *Sc_create_leaf_cell(CHAR*);
796 int Sc_setup_for_maker(ARCPROTO*, ARCPROTO*);
797 CHAR *Sc_create_leaf_instance(CHAR*, CHAR*, int, int, int, int, int, int, CHAR*);
798 CHAR *Sc_create_layer2_node(int, int, int, int, CHAR*);
799 CHAR *Sc_create_via(int, int, CHAR*);
800 CHAR *Sc_create_layer1_node(int, int, int, int, CHAR*);
801 CHAR *Sc_create_nwell(int, int, int, int, CHAR*);
802 CHAR *Sc_create_pwell(int, int, int, int, CHAR*);
803 CHAR *Sc_create_track_layer1(CHAR*, CHAR*, CHAR*, CHAR*, int, CHAR*);
804 CHAR *Sc_create_track_layer2(CHAR*, CHAR*, CHAR*, CHAR*, int, CHAR*);
805 CHAR *Sc_create_export_port(CHAR*, CHAR*, CHAR*, int, CHAR*);
806 int Sc_free_placement(SCPLACE*);
807 int Sc_free_route(SCROUTE*);
808 int Sc_leaf_port_direction(CHAR*);
809 SCNIPORT *Sc_new_instance_port(SCNITREE*);
810 CHAR **Sc_leaf_cell_sim_info(CHAR*);
811 int Sc_leaf_cell_set_sim(SCSIM*, CHAR*);
812 CHAR *Sc_first_leaf_cell(void);
813 CHAR *Sc_next_leaf_cell(CHAR*);
814 int *Sc_leaf_cell_bits_address(CHAR*);
815 int Sc_leaf_cell_bits(CHAR*);
816 INTBIG ScGetParameter(INTBIG paramnum);
817 void ScSetParameter(INTBIG paramnum, INTBIG addr);
818 
819 #if defined(__cplusplus) && !defined(ALLCPLUSPLUS)
820 }
821 #endif
822