Ophidian
 All Classes Namespaces Functions
flute.h
1 //
2 // Created by renan on 3/10/16.
3 //
4 
5 #ifndef ophidian_FLUTE_H
6 
7 #define POWVFILE "3rdparty/flute/POWV9.dat" // LUT for POWV (Wirelength Vector)
8 #define PORTFILE "3rdparty/flute/PORT9.dat" // LUT for PORT (Routing Tree)
9 #define FLUTE_D 9 // LUT is used for d <= FLUTE_D, FLUTE_D <= 9
10 #define FLUTEROUTING 1 // 1 to construct routing, 0 to estimate WL only
11 #define REMOVE_DUPLICATE_PIN 0 // Remove dup. pin for flute_wl() & flute()
12 #define ACCURACY 8 // Default accuracy is 3
13 //#define MAXD 2008840 // max. degree of a net that can be handled
14 #define MAXD 1000 // max. degree of a net that can be handled
15 
16 #ifndef DTYPE // Data type for distance
17 #define DTYPE unsigned
18 #endif
19 
20 #define ophidian_FLUTE_H
21 
22 namespace ophidian {
23  namespace interconnection {
24  typedef struct
25  {
26  unsigned x, y; // starting point of the branch
27  int n; // index of neighbor
28  } tree_branch;
29 
30  struct tree
31  {
32  int deg; // degree
33  unsigned length; // total wirelength
34  tree_branch * branch; // array of tree branches
35  };
36 
37  // Major functions
38  extern void readLUT();
39  extern DTYPE flute_wl(int d, DTYPE x[], DTYPE y[], int acc);
40 //Macro: DTYPE flutes_wl(int d, DTYPE xs[], DTYPE ys[], int s[], int acc);
41  extern tree flute(int d, DTYPE x[], DTYPE y[], int acc);
42 //Macro: Tree flutes(int d, DTYPE xs[], DTYPE ys[], int s[], int acc);
43  extern DTYPE wirelength(tree t);
44  extern void printtree(tree t);
45 
46 //extern Tree flautist(int d, DTYPE x[], DTYPE y[], int acc, const uofm::vector<BBox> &obs, const uofm::vector<unsigned> &relevantObs, unsigned &legal);
47 
48 
49 // Other useful functions
50  extern DTYPE flutes_wl_LD(int d, DTYPE xs[], DTYPE ys[], int s[]);
51  extern DTYPE flutes_wl_MD(int d, DTYPE xs[], DTYPE ys[], int s[], int acc);
52  extern DTYPE flutes_wl_RDP(int d, DTYPE xs[], DTYPE ys[], int s[], int acc);
53  extern tree flutes_LD(int d, DTYPE xs[], DTYPE ys[], int s[]);
54  extern tree flutes_MD(int d, DTYPE xs[], DTYPE ys[], int s[], int acc);
55  extern tree flutes_RDP(int d, DTYPE xs[], DTYPE ys[], int s[], int acc);
56 
57 #if REMOVE_DUPLICATE_PIN==1
58  #define flutes_wl(d, xs, ys, s, acc) flutes_wl_RDP(d, xs, ys, s, acc)
59  #define flutes(d, xs, ys, s, acc) flutes_RDP(d, xs, ys, s, acc)
60 #else
61 #define flutes_wl(d, xs, ys, s, acc) flutes_wl_ALLD(d, xs, ys, s, acc)
62 #define flutes(d, xs, ys, s, acc) flutes_ALLD(d, xs, ys, s, acc)
63 #endif
64 
65 #define flutes_wl_ALLD(d, xs, ys, s, acc) flutes_wl_LMD(d, xs, ys, s, acc)
66 #define flutes_ALLD(d, xs, ys, s, acc) flutes_LMD(d, xs, ys, s, acc)
67 
68 #define flutes_wl_LMD(d, xs, ys, s, acc) \
69  (d<=FLUTE_D ? flutes_wl_LD(d, xs, ys, s) : flutes_wl_MD(d, xs, ys, s, acc))
70 #define flutes_LMD(d, xs, ys, s, acc) \
71  (d<=FLUTE_D ? flutes_LD(d, xs, ys, s) : flutes_MD(d, xs, ys, s, acc))
72 
73 #define ADIFF(x,y) ((x)>(y)?(x-y):(y-x)) // Absolute difference
74 
75  }
76 }
77 
78 
79 #endif //ophidian_FLUTE_H
Definition: flute.h:30