VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
place_and_route.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  s_fmap_cell
 

Macros

#define INFINITE   -1
 
#define NOT_FOUND   0
 
#define WNEED   1
 
#define WL   2
 
#define PROC_TIME   3
 

Typedefs

typedef struct s_fmap_cell t_fmap_cell
 

Functions

void place_and_route (enum e_operation operation, struct s_placer_opts placer_opts, char *place_file, char *net_file, char *arch_file, char *route_file, struct s_annealing_sched annealing_sched, struct s_router_opts router_opts, struct s_det_routing_arch det_routing_arch, t_segment_inf *segment_inf, t_timing_inf timing_inf, t_chan_width_dist chan_width_dist, struct s_model *models, t_direct_inf *directs, int num_directs)
 
void init_chan (int cfactor, t_chan_width_dist chan_width_dist)
 

Macro Definition Documentation

#define INFINITE   -1

Definition at line 1 of file place_and_route.h.

#define NOT_FOUND   0

Definition at line 2 of file place_and_route.h.

#define PROC_TIME   3

Definition at line 6 of file place_and_route.h.

#define WL   2

Definition at line 5 of file place_and_route.h.

#define WNEED   1

Definition at line 4 of file place_and_route.h.

Typedef Documentation

typedef struct s_fmap_cell t_fmap_cell

Function Documentation

void init_chan ( int  cfactor,
t_chan_width_dist  chan_width_dist 
)

Definition at line 564 of file place_and_route.c.

564  {
565 
566  /* Assigns widths to channels (in tracks). Minimum one track *
567  * per channel. io channels are io_rat * maximum in interior *
568  * tracks wide. The channel distributions read from the architecture *
569  * file are scaled by cfactor. */
570 
571  float x, separation, chan_width_io;
572  int nio, i;
573  t_chan chan_x_dist, chan_y_dist;
574 
575  chan_width_io = chan_width_dist.chan_width_io;
576  chan_x_dist = chan_width_dist.chan_x_dist;
577  chan_y_dist = chan_width_dist.chan_y_dist;
578 
579  /* io channel widths */
580 
581  nio = (int) floor(cfactor * chan_width_io + 0.5);
582  if (nio == 0)
583  nio = 1; /* No zero width channels */
584 
585  chan_width_x[0] = chan_width_x[ny] = nio;
586  chan_width_y[0] = chan_width_y[nx] = nio;
587 
588  if (ny > 1) {
589  separation = 1. / (ny - 2.); /* Norm. distance between two channels. */
590  x = 0.; /* This avoids div by zero if ny = 2. */
591  chan_width_x[1] = (int) floor(
592  cfactor * comp_width(&chan_x_dist, x, separation) + 0.5);
593 
594  /* No zero width channels */
595  chan_width_x[1] = std::max(chan_width_x[1], 1);
596 
597  for (i = 1; i < ny - 1; i++) {
598  x = (float) i / ((float) (ny - 2.));
599  chan_width_x[i + 1] = (int) floor(
600  cfactor * comp_width(&chan_x_dist, x, separation) + 0.5);
601  chan_width_x[i + 1] = std::max(chan_width_x[i + 1], 1);
602  }
603  }
604 
605  if (nx > 1) {
606  separation = 1. / (nx - 2.); /* Norm. distance between two channels. */
607  x = 0.; /* Avoids div by zero if nx = 2. */
608  chan_width_y[1] = (int) floor(
609  cfactor * comp_width(&chan_y_dist, x, separation) + 0.5);
610 
611  chan_width_y[1] = std::max(chan_width_y[1], 1);
612 
613  for (i = 1; i < nx - 1; i++) {
614  x = (float) i / ((float) (nx - 2.));
615  chan_width_y[i + 1] = (int) floor(
616  cfactor * comp_width(&chan_y_dist, x, separation) + 0.5);
617  chan_width_y[i + 1] = std::max(chan_width_y[i + 1], 1);
618  }
619  }
620 #ifdef VERBOSE
621  vpr_printf(TIO_MESSAGE_INFO, "\n");
622  vpr_printf(TIO_MESSAGE_INFO, "chan_width_x:\n");
623  for (i = 0; i <= ny; i++)
624  vpr_printf(TIO_MESSAGE_INFO, "%d ", chan_width_x[i]);
625  vpr_printf(TIO_MESSAGE_INFO, "\n");
626  vpr_printf(TIO_MESSAGE_INFO, "chan_width_y:\n");
627  for (i = 0; i <= nx; i++)
628  vpr_printf(TIO_MESSAGE_INFO, "%d ", chan_width_y[i]);
629  vpr_printf(TIO_MESSAGE_INFO, "\n");
630 #endif
631 
632 }
int * chan_width_x
Definition: globals.c:56
int * chan_width_y
Definition: globals.c:57
static float comp_width(t_chan *chan, float x, float separation)
#define max(a, b)
Definition: graphics.c:171
int nx
Definition: globals.c:46
int ny
Definition: globals.c:47
messagelogger vpr_printf
Definition: util.c:17

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void place_and_route ( enum e_operation  operation,
struct s_placer_opts  placer_opts,
char *  place_file,
char *  net_file,
char *  arch_file,
char *  route_file,
struct s_annealing_sched  annealing_sched,
struct s_router_opts  router_opts,
struct s_det_routing_arch  det_routing_arch,
t_segment_inf segment_inf,
t_timing_inf  timing_inf,
t_chan_width_dist  chan_width_dist,
struct s_model models,
t_direct_inf directs,
int  num_directs 
)

Definition at line 47 of file place_and_route.c.

55  {
56 
57  /* This routine controls the overall placement and routing of a circuit. */
58  char msg[BUFSIZE];
59  int width_fac, i;
60  boolean success, Fc_clipped;
61  float **net_delay = NULL;
62  t_slack * slacks = NULL;
63  t_chunk net_delay_ch = {NULL, 0, NULL};
64 
65  /*struct s_linked_vptr *net_delay_chunk_list_head;*/
66  t_ivec **clb_opins_used_locally = NULL; /* [0..num_blocks-1][0..num_class-1] */
67  int max_pins_per_clb;
68  clock_t begin, end;
69 
70  Fc_clipped = FALSE;
71 
72  max_pins_per_clb = 0;
73  for (i = 0; i < num_types; i++) {
74  if (type_descriptors[i].num_pins > max_pins_per_clb) {
75  max_pins_per_clb = type_descriptors[i].num_pins;
76  }
77  }
78 
79  if (placer_opts.place_freq == PLACE_NEVER) {
80  /* Read the placement from a file */
81  read_place(place_file, net_file, arch_file, nx, ny, num_blocks, block);
83  } else {
84  assert(
85  (PLACE_ONCE == placer_opts.place_freq) || (PLACE_ALWAYS == placer_opts.place_freq));
86  begin = clock();
87  try_place(placer_opts, annealing_sched, chan_width_dist, router_opts,
88  det_routing_arch, segment_inf, timing_inf, directs, num_directs);
89  print_place(place_file, net_file, arch_file);
90  end = clock();
91 #ifdef CLOCKS_PER_SEC
92  vpr_printf(TIO_MESSAGE_INFO, "Placement took %g seconds.\n", (float)(end - begin) / CLOCKS_PER_SEC);
93 #else
94  vpr_printf(TIO_MESSAGE_INFO, "Placement took %g seconds.\n", (float)(end - begin) / CLK_PER_SEC);
95 #endif
96  }
97  begin = clock();
99 
100  fflush(stdout);
101 
102  if (!router_opts.doRouting)
103  return;
104 
105  width_fac = router_opts.fixed_channel_width;
106 
107  /* If channel width not fixed, use binary search to find min W */
108  if (NO_FIXED_CHANNEL_WIDTH == width_fac) {
109  g_solution_inf.channel_width = binary_search_place_and_route(placer_opts, place_file, net_file,
110  arch_file, route_file, router_opts.full_stats,
111  router_opts.verify_binary_search, annealing_sched, router_opts,
112  det_routing_arch, segment_inf, timing_inf, chan_width_dist,
113  models, directs, num_directs);
114  } else {
115  g_solution_inf.channel_width = width_fac;
116  if (det_routing_arch.directionality == UNI_DIRECTIONAL) {
117  if (width_fac % 2 != 0) {
118  vpr_printf(TIO_MESSAGE_ERROR, "in pack_place_and_route.c: Given odd chan width (%d) for udsd architecture.\n",
119  width_fac);
120  exit(1);
121  }
122  }
123  /* Other constraints can be left to rr_graph to check since this is one pass routing */
124 
125  /* Allocate the major routing structures. */
126 
127  clb_opins_used_locally = alloc_route_structs();
128 
129  slacks = alloc_and_load_timing_graph(timing_inf);
130  net_delay = alloc_net_delay(&net_delay_ch, clb_net,
131  num_nets);
132 
133  success = try_route(width_fac, router_opts, det_routing_arch,
134  segment_inf, timing_inf, net_delay, slacks, chan_width_dist,
135  clb_opins_used_locally, &Fc_clipped, directs, num_directs);
136 
137  if (Fc_clipped) {
138  vpr_printf(TIO_MESSAGE_WARNING, "Fc_output was too high and was clipped to full (maximum) connectivity.\n");
139  }
140 
141  if (success == FALSE) {
142  vpr_printf(TIO_MESSAGE_INFO, "Circuit is unrouteable with a channel width factor of %d.\n", width_fac);
143  vpr_printf(TIO_MESSAGE_INFO, "\n");
144  sprintf(msg, "Routing failed with a channel width factor of %d. ILLEGAL routing shown.", width_fac);
145  }
146 
147  else {
148  check_route(router_opts.route_type, det_routing_arch.num_switch, clb_opins_used_locally);
149  get_serial_num();
150 
151  vpr_printf(TIO_MESSAGE_INFO, "Circuit successfully routed with a channel width factor of %d.\n", width_fac);
152  vpr_printf(TIO_MESSAGE_INFO, "\n");
153 
154  routing_stats(router_opts.full_stats, router_opts.route_type,
155  det_routing_arch.num_switch, segment_inf,
156  det_routing_arch.num_segment, det_routing_arch.R_minW_nmos,
157  det_routing_arch.R_minW_pmos,
158  det_routing_arch.directionality,
159  timing_inf.timing_analysis_enabled, net_delay, slacks);
160 
161  print_route(route_file);
162 
165  }
166 
167  sprintf(msg, "Routing succeeded with a channel width factor of %d.\n\n",
168  width_fac);
169 
170 
171  }
172 
173  init_draw_coords(max_pins_per_clb);
175 
176 
177  if (timing_inf.timing_analysis_enabled) {
178  assert(slacks->slack);
179 
182  models);
183  }
184 
186  {
187  verilog_writer();
188  }
189 
190  free_timing_graph(slacks);
191 
192  assert(net_delay);
193  free_net_delay(net_delay, &net_delay_ch);
194  }
195 
196  fflush(stdout);
197  }
198 
199  if (clb_opins_used_locally != NULL) {
200  for (i = 0; i < num_blocks; i++) {
201  free_ivec_vector(clb_opins_used_locally[i], 0,
202  block[i].type->num_class - 1);
203  }
204  free(clb_opins_used_locally);
205  clb_opins_used_locally = NULL;
206  }
207 
208  /* Frees up all the data structure used in vpr_utils. */
211 
212  end = clock();
213 #ifdef CLOCKS_PER_SEC
214  vpr_printf(TIO_MESSAGE_INFO, "Routing took %g seconds.\n", (float) (end - begin) / CLOCKS_PER_SEC);
215 #else
216  vpr_printf(TIO_MESSAGE_INFO, "Routing took %g seconds.\n", (float)(end - begin) / CLK_PER_SEC);
217 #endif
218 
219  /*WMF: cleaning up memory usage */
220 
221  /* if (g_heap_free_head)
222  free(g_heap_free_head);
223  if (g_trace_free_head)
224  free(g_trace_free_head);
225  if (g_linked_f_pointer_free_head)
226  free(g_linked_f_pointer_free_head);*/
227 }
Definition: util.h:57
void update_screen(int priority, char *msg, enum pic_type pic_on_screen_val, boolean crit_path_button_enabled)
Definition: draw.c:156
boolean doRouting
Definition: vpr_types.h:712
void print_timing_graph_as_blif(const char *fname, t_model *models)
Definition: path_delay.c:3360
boolean full_stats
Definition: vpr_types.h:711
void free_port_pin_from_blk_pin(void)
Definition: vpr_utils.c:736
void read_place(INP const char *place_file, INP const char *arch_file, INP const char *net_file, INP int L_nx, INP int L_ny, INP int L_num_blocks, INOUTP struct s_block block_list[])
Definition: read_place.c:15
int fixed_channel_width
Definition: vpr_types.h:704
#define MAJOR
Definition: vpr_types.h:73
static float ** net_delay
boolean try_route(int width_fac, struct s_router_opts router_opts, struct s_det_routing_arch det_routing_arch, t_segment_inf *segment_inf, t_timing_inf timing_inf, float **net_delay, t_slack *slacks, t_chan_width_dist chan_width_dist, t_ivec **clb_opins_used_locally, boolean *Fc_clipped, t_direct_inf *directs, int num_directs)
Definition: route_common.c:220
boolean timing_analysis_enabled
void sync_grid_to_blocks(INP int L_num_blocks, INP const struct s_block block_list[], INP int L_nx, INP int L_ny, INOUTP struct s_grid_tile **L_grid)
Definition: vpr_utils.c:84
void get_serial_num(void)
Definition: route_common.c:188
int num_nets
Definition: globals.c:27
static int binary_search_place_and_route(struct s_placer_opts placer_opts, char *place_file, char *net_file, char *arch_file, char *route_file, boolean full_stats, boolean verify_binary_search, struct s_annealing_sched annealing_sched, struct s_router_opts router_opts, struct s_det_routing_arch det_routing_arch, t_segment_inf *segment_inf, t_timing_inf timing_inf, t_chan_width_dist chan_width_dist, t_model *models, t_direct_inf *directs, int num_directs)
float ** slack
Definition: vpr_types.h:405
#define BUFSIZE
Definition: graphics.c:184
void check_route(enum e_route_type route_type, int num_switch, t_ivec **clb_opins_used_locally)
Definition: check_route.c:27
int num_blocks
Definition: globals.c:30
boolean getEchoEnabled(void)
Definition: ReadOptions.c:67
Definition: util.h:12
int channel_width
Definition: power.h:84
t_solution_inf g_solution_inf
Definition: power.c:64
static t_ivec ** clb_opins_used_locally
void init_draw_coords(float width_val)
Definition: draw.c:430
enum pfreq place_freq
Definition: vpr_types.h:644
void verilog_writer(void)
enum e_directionality directionality
Definition: vpr_types.h:758
struct s_block * block
Definition: globals.c:31
struct s_net * clb_net
Definition: globals.c:28
int nx
Definition: globals.c:46
void free_ivec_vector(struct s_ivec *ivec_vector, int nrmin, int nrmax)
Definition: util.c:498
static t_chunk net_delay_ch
Definition: timing_place.c:15
t_ivec ** alloc_route_structs(void)
Definition: route_common.c:611
void print_route(char *route_file)
boolean isEchoFileEnabled(enum e_echo_files echo_option)
Definition: ReadOptions.c:115
void print_sink_delays(const char *fname)
Definition: timing_place.c:58
void free_blk_pin_from_port_pin(void)
Definition: vpr_utils.c:840
void print_place(char *place_file, char *net_file, char *arch_file)
Definition: read_place.c:262
enum e_route_type route_type
Definition: vpr_types.h:703
struct s_grid_tile ** grid
Definition: globals.c:59
void free_net_delay(float **net_delay, t_chunk *chunk_list_ptr)
Definition: net_delay.c:127
void post_place_sync(INP int L_num_blocks, INOUTP const struct s_block block_list[])
Definition: util.h:47
boolean GetPostSynthesisOption(void)
Definition: ReadOptions.c:80
float ** alloc_net_delay(t_chunk *chunk_list_ptr, struct s_net *nets, int n_nets)
Definition: net_delay.c:103
t_slack * alloc_and_load_timing_graph(t_timing_inf timing_inf)
Definition: path_delay.c:239
int num_types
Definition: globals.c:37
#define NO_FIXED_CHANNEL_WIDTH
Definition: vpr_types.h:692
struct s_type_descriptor * type_descriptors
Definition: globals.c:38
char * getEchoFileName(enum e_echo_files echo_option)
Definition: ReadOptions.c:122
int ny
Definition: globals.c:47
messagelogger vpr_printf
Definition: util.c:17
void free_timing_graph(t_slack *slacks)
Definition: path_delay.c:390
void routing_stats(boolean full_stats, enum e_route_type route_type, int num_switch, t_segment_inf *segment_inf, int num_segment, float R_minW_nmos, float R_minW_pmos, enum e_directionality directionality, boolean timing_analysis_enabled, float **net_delay, t_slack *slacks)
Definition: stats.c:27
void try_place(struct s_placer_opts placer_opts, struct s_annealing_sched annealing_sched, t_chan_width_dist chan_width_dist, struct s_router_opts router_opts, struct s_det_routing_arch det_routing_arch, t_segment_inf *segment_inf, t_timing_inf timing_inf, t_direct_inf *directs, int num_directs)
Definition: place.c:310
boolean verify_binary_search
Definition: vpr_types.h:710

+ Here is the call graph for this function:

+ Here is the caller graph for this function: