-
Notifications
You must be signed in to change notification settings - Fork 2
/
ds.h
208 lines (177 loc) · 3.63 KB
/
ds.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#ifndef BASIC_STRUCTURE_H
#define BASIC_STRUCTURE_H
#define ABS(a) ((a)<0.0?(-(a)):(a))
#define MHT(s,t) (ABS((s.x)-(t.x)) + ABS((s.y)-(t.y)))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)>(b)?(b):(a))
#define Manhattan(x1,y1,x2,y2) ((( (x1)-(x2) ) >= 0? ((x1)-(x2)) : ((x2)-(x1))) + (((y1)-(y2) ) >= 0? ((y1)-(y2)) : ((y2)-(y1))))
#define INFINITE 2<<29 // big number to denote infinite
#define _L_ INFINITE
#define SMALL_BUF_SIZE 100
#define LARGE_BUF_SIZE 1000
#define ELMORE 1
#define BIG_NUM 20
#define EPSILON 1E-9 // double type precision
#define OFFSET 100
#define LAMBADA_w1 1400001
#define LAMBADA_w2 700001
#define LARGESTNODE 9999
//#define LAMBADA 200000.00
//
typedef unsigned long UINT;
typedef char BOOL;
typedef char DIRECTION;
enum BOOL_VAL{FALSE,TRUE};
enum POS{LL,LR,UR,UL}; // low-left, low-right, up-right, up-left
enum DIRS{INVALID,LEFT,RIGHT,UP,DOWN};
enum LINE_STYLE{SOLID,Dashed};
enum COLORS{BLACK,BLUE,GREEN,CYAN,RED,WHITE};
typedef struct inode{
int x ;
int y ;
DIRECTION dir_to;
DIRECTION dir_from;
}NODE ;
typedef struct isnode{
int index ;
int x;
int y;
int lc;
}SNODE;
typedef struct ibox{
NODE ll;
NODE ur;
} BOX;
typedef struct isource{
int name ;
NODE location;
int bufname ;
}SOURCE;
typedef struct iwire{
int wiretype ;
double r;
double c;
} WIRE;
typedef struct ibuffer{
int buf_id;
char *spice_subckt ;
int inverted;
double icap ;
double ocap ;
double ores ;
} BUFFER;
typedef struct isink{
int num;
SNODE *pool ;
}SINK ;
typedef struct iwirelib{
int num;
WIRE *lib;
}WIRELIB ;
typedef struct ibuflib{
int num;
BUFFER *lib;
}BUFLIB ;
typedef struct ivddlib{
int num;
double *lib;
}VDDLIB ;
typedef struct iblockage{
int num;
BOX *pool;
} BLOCKAGE ;
typedef struct dme_node{
int left;
int right;
int upper;
int lower;
int x1;
int y1;
int x2;
int y2;
double weight;
double capacitance;
double resistance;
double left_length;
double right_length;
double to_sink_delay;
double downstream_length;
double first_buf_fraction;
int delta_length_buf;
int select_x;
int select_y;
int sx;
int sy;
int visited;
BOOL is_select;
int blockage_node;
int sink_index;
int node_id;
int buf_num;
int buf_unit;
int level;
int tree_level;
int duplicate_first_buf;
int downstream_buf_num;
int downstream_total_buf_num;
int upstream_buf_num;
int reduntant;
int detour;
int wire_type;
double factor;
struct dme_node * pleft;
DIRECTION left_direction;
struct dme_node * pright;
DIRECTION right_direction;
}DME_NODE;
typedef struct buf_node{
double x;
double y;
int buf_id;
int wire_type;
int buf_type;
int units;
// int buf_lev;
struct buf_node * next ;
}BUF_NODE ;
typedef struct dme_tree_node{
struct dme_tree_node * ls;
DIRECTION left_direction;
struct dme_tree_node * rs;
DIRECTION right_direction;
struct dme_tree_node * fa ;
int buf_num ;
// int delta_length_buf ;
double factor ;
double delay;
int is_fake ;
int duplicate_first_buf;
int altitude;
int x;
int y;
int left;
int right;
int node_id;
int is_sink ;
int sink_index ;
int is_blk ;
int reduntant ;
int detour ;
int wire_type;
double first_buf_fraction;
double capacitance;
}DME_TREE_NODE;
typedef struct tem_node{
int altitude ;
int x;
int y;
int prev ;
int next ;
int isit ;
} BUF_POS;
typedef struct cusink{
int node_id;
int sink_index;
double latency[4];
} CUSINK;
#endif