00001 #ifndef __FLP_H_
00002 #define __FLP_H_
00003
00004 #include "util.h"
00005
00006 #define MAX_UNITS 8192
00007 #define MAX_MOVES 16
00008
00009
00010 #define CUT_NONE -1
00011 #define CUT_VERTICAL -2
00012 #define CUT_HORIZONTAL -3
00013
00014
00015 #define L2_LEFT 0
00016 #define L2_RIGHT 1
00017 #define L2_ARMS 2
00018 #define L2_LEFT_STR "_left"
00019 #define L2_RIGHT_STR "_right"
00020
00021 #define WRAP_L2_RATIO 5
00022
00023
00024
00025
00026
00027 #define RIM_LEFT 1
00028 #define RIM_RIGHT 2
00029 #define RIM_TOP 4
00030 #define RIM_BOTTOM 8
00031 #define RIM_PREFIX "RIM"
00032 #define RIM_LEFT_STR RIM_PREFIX"_left"
00033 #define RIM_RIGHT_STR RIM_PREFIX"_right"
00034 #define RIM_TOP_STR RIM_PREFIX"_top"
00035 #define RIM_BOTTOM_STR RIM_PREFIX"_bottom"
00036
00037
00038 #define DEAD_PREFIX "_"
00039
00040
00041
00042 #define ROT_0 0x01
00043 #define ROT_90 0x02
00044 #define ROT_180 0x04
00045 #define ROT_270 0x08
00046
00047 #define FLIP_0 0x10
00048 #define FLIP_90 0x20
00049 #define FLIP_180 0x40
00050 #define FLIP_270 0x80
00051 #define ORIENTS_N 8
00052 #define ORIENT_NDEF 0xDF
00053
00054
00055 typedef unsigned char orient_t;
00056
00057
00058 struct RC_model_t_st;
00059 struct shape_t_st;
00060
00061
00062 typedef struct flp_config_t_st
00063 {
00064
00065 int wrap_l2;
00066
00067 char l2_label[STR_SIZE];
00068
00069
00070 int model_rim;
00071 double rim_thickness;
00072
00073
00074 double compact_ratio;
00075
00076
00077
00078
00079
00080 int n_orients;
00081
00082
00083 double P0;
00084 double Davg;
00085 double Kmoves;
00086 double Rcool;
00087 double Rreject;
00088 int Nmax;
00089
00090
00091 double lambdaA;
00092 double lambdaT;
00093 double lambdaW;
00094 } flp_config_t;
00095
00096
00097 typedef struct unplaced_t_st
00098 {
00099 char name[STR_SIZE];
00100
00101 int rotable;
00102 double area;
00103
00104 double min_aspect;
00105 double max_aspect;
00106
00107 struct shape_t_st *shape;
00108 }unplaced_t;
00109
00110
00111 typedef struct flp_desc_t_st
00112 {
00113 unplaced_t *units;
00114
00115 double **wire_density;
00116
00117 flp_config_t config;
00118 int n_units;
00119 }flp_desc_t;
00120
00121
00122 typedef struct unit_t_st
00123 {
00124 char name[STR_SIZE];
00125 double width;
00126 double height;
00127 double leftx;
00128 double bottomy;
00129
00130 int id;
00131
00132 }unit_t;
00133
00134
00135 typedef struct flp_t_st
00136 {
00137 unit_t *units;
00138 int n_units;
00139
00140 double **wire_density;
00141 } flp_t;
00142
00143
00144
00145
00146 flp_config_t default_flp_config(void);
00147
00148
00149
00150
00151 void flp_config_add_from_strs(flp_config_t *config, str_pair *table, int size);
00152
00153
00154
00155
00156 int flp_config_to_strs(flp_config_t *config, str_pair *table, int max_entries);
00157
00158
00159
00160
00161 flp_desc_t *read_flp_desc(char *file, flp_config_t *config);
00162 void free_flp_desc(flp_desc_t *flp_desc);
00163
00164 void print_unplaced(unplaced_t *unit);
00165 void print_flp_desc(flp_desc_t *flp_desc);
00166
00167
00168
00169
00170 flp_t *flp_placeholder(flp_desc_t *flp_desc);
00171
00172 flp_t *read_flp(char *file, int read_connects);
00173
00174
00175
00176
00177
00178 int floorplan(flp_t *flp, flp_desc_t *flp_desc,
00179 struct RC_model_t_st *model, double *power);
00180
00181
00182
00183
00184
00185 flp_t *flp_alloc_init_mem(int count);
00186
00187 void print_flp_fig2();
00188 void print_flp_fig (flp_t *flp);
00189
00190 void print_flp (flp_t *flp);
00191
00192 void print_flp_stats(flp_t *flp, struct RC_model_t_st *model,
00193 char *l2_label, char *power_file,
00194 char *connects_file);
00195
00196 void flp_wrap_l2(flp_t *flp, flp_desc_t *flp_desc);
00197
00198 int flp_wrap_rim(flp_t *flp, double rim_thickness);
00199
00200 void flp_translate(flp_t *flp, double x, double y);
00201
00202 void flp_scale(flp_t *flp, double factor);
00203
00204
00205
00206
00207
00208
00209 void flp_change_orient(flp_t *flp, double xorig, double yorig,
00210 double width, double height, orient_t target);
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226 flp_t *flp_create_grid(flp_t *flp, int ***map);
00227
00228 void free_blkgrid_map(flp_t *flp, int **map);
00229
00230 void xlate_power_blkgrid(flp_t *flp, flp_t *grid, \
00231 double *bpower, double *gpower, int **map);
00232
00233 double flp_evaluate_metric(flp_t *flp, struct RC_model_t_st *model, double *power,
00234 double lambdaA, double lambdaT, double lambdaW);
00235
00236 void dump_flp(flp_t *flp, char *file, int dump_connects);
00237
00238 void free_flp(flp_t *flp, int compacted);
00239
00240
00241
00242
00243
00244 int get_blk_index(flp_t *flp, char *name);
00245
00246 int is_horiz_adj(flp_t *flp, int i, int j);
00247
00248 int is_vert_adj (flp_t *flp, int i, int j);
00249
00250 double get_shared_len(flp_t *flp, int i, int j);
00251
00252 double get_total_width(flp_t *flp);
00253
00254 double get_total_height(flp_t *flp);
00255
00256 double get_minx(flp_t *flp);
00257 double get_miny(flp_t *flp);
00258
00259 double get_core_width(flp_t *flp, char *l2_label);
00260
00261 double get_core_height(flp_t *flp, char *l2_label);
00262
00263 double get_manhattan_dist(flp_t *flp, int i, int j);
00264 double get_total_area(flp_t *flp);
00265 double get_core_area(flp_t *flp, char *l2_label);
00266 double get_core_occupied_area(flp_t *flp, char *l2_label);
00267 double get_wire_metric(flp_t *flp);
00268
00269 #endif