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

Go to the source code of this file.

Functions

void update_screen (int priority, char *msg, enum pic_type pic_on_screen_val, boolean crit_path_button_enabled)
 
void alloc_draw_structs (void)
 
void init_draw_coords (float clb_width)
 
void set_graphics_state (boolean show_graphics_val, int gr_automode_val, enum e_route_type route_type)
 
void free_draw_structs (void)
 

Function Documentation

void alloc_draw_structs ( void  )

Definition at line 376 of file draw.c.

376  {
377 
378  /* Allocate the structures needed to draw the placement and routing. Set *
379  * up the default colors for blocks and nets. */
380 
381  tile_x = (float *) my_malloc((nx + 2) * sizeof(float));
382  tile_y = (float *) my_malloc((ny + 2) * sizeof(float));
383 
384  net_color = (enum color_types *) my_malloc(
385  num_nets * sizeof(enum color_types));
386 
387  block_color = (enum color_types *) my_malloc(
388  num_blocks * sizeof(enum color_types));
389 
390  x_rr_node_left = (float *) my_malloc(num_rr_nodes * sizeof(float));
391  x_rr_node_right = (float *) my_malloc(num_rr_nodes * sizeof(float));
392  y_rr_node_top = (float *) my_malloc(num_rr_nodes * sizeof(float));
393  y_rr_node_bottom = (float *) my_malloc(num_rr_nodes * sizeof(float));
395  num_rr_nodes * sizeof(enum color_types));
396 
397  deselect_all(); /* Set initial colors */
398 }
static float * x_rr_node_right
Definition: draw.c:91
static float * y_rr_node_bottom
Definition: draw.c:93
color_types
int num_nets
Definition: globals.c:27
static float * tile_y
Definition: draw.c:68
int num_blocks
Definition: globals.c:30
static void deselect_all(void)
Definition: draw.c:1837
static void * my_malloc(int ibytes)
Definition: graphics.c:499
static enum color_types * net_color
Definition: draw.c:81
int num_rr_nodes
Definition: globals.c:69
int nx
Definition: globals.c:46
static enum color_types * rr_node_color
Definition: draw.c:94
static float * tile_x
Definition: draw.c:68
static float * x_rr_node_left
Definition: draw.c:90
int ny
Definition: globals.c:47
static enum color_types * block_color
Definition: draw.c:81
static float * y_rr_node_top
Definition: draw.c:92

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void free_draw_structs ( void  )

Definition at line 400 of file draw.c.

400  {
401 
402  /* Free everything allocated by alloc_draw_structs. Called after close_graphics() *
403  * in vpr_api.c.
404  *
405  * For safety, set all the array pointers to NULL in case any data
406  * structure gets freed twice. */
407 
408  free(tile_x);
409  tile_x = NULL;
410  free(tile_y);
411  tile_y = NULL;
412 
413  free(net_color);
414  net_color = NULL;
415  free(block_color);
416  block_color = NULL;
417 
418  free(x_rr_node_left);
419  x_rr_node_left = NULL;
420  free(x_rr_node_right);
421  x_rr_node_right = NULL;
422  free(y_rr_node_top);
423  y_rr_node_top = NULL;
424  free(y_rr_node_bottom);
425  y_rr_node_bottom = NULL;
426  free(rr_node_color);
427  rr_node_color = NULL;
428 }
static float * x_rr_node_right
Definition: draw.c:91
static float * y_rr_node_bottom
Definition: draw.c:93
static float * tile_y
Definition: draw.c:68
static enum color_types * net_color
Definition: draw.c:81
static enum color_types * rr_node_color
Definition: draw.c:94
static float * tile_x
Definition: draw.c:68
static float * x_rr_node_left
Definition: draw.c:90
static enum color_types * block_color
Definition: draw.c:81
static float * y_rr_node_top
Definition: draw.c:92

+ Here is the caller graph for this function:

void init_draw_coords ( float  clb_width)

Definition at line 430 of file draw.c.

430  {
431 
432  /* Load the arrays containing the left and bottom coordinates of the clbs *
433  * forming the FPGA. tile_width_val sets the width and height of a drawn *
434  * clb. */
435 
436  int i;
437  int j;
438 
439  if (!show_graphics)
440  return; /* -nodisp was selected. */
441 
444  (num_rr_nodes) * sizeof(float));
446  (num_rr_nodes) * sizeof(float));
448  (num_rr_nodes) * sizeof(float));
450  (num_rr_nodes) * sizeof(float));
452  (num_rr_nodes) * sizeof(enum color_types));
453  for (i = 0; i < num_rr_nodes; i++) {
454  x_rr_node_left[i] = -1;
455  x_rr_node_right[i] = -1;
456  y_rr_node_top[i] = -1;
457  y_rr_node_bottom[i] = -1;
458  rr_node_color[i] = BLACK;
459  }
460  }
461 
462  tile_width = width_val;
463  pin_size = 0.3;
464  for (i = 0; i < num_types; ++i) {
466  (tile_width / (4.0F * type_descriptors[i].num_pins)));
467  }
468 
469  j = 0;
470  for (i = 0; i < (nx + 1); i++) {
471  tile_x[i] = (i * tile_width) + j;
472  j += chan_width_y[i] + 1; /* N wires need N+1 units of space */
473  }
474  tile_x[nx + 1] = ((nx + 1) * tile_width) + j;
475 
476  j = 0;
477  for (i = 0; i < (ny + 1); ++i) {
478  tile_y[i] = (i * tile_width) + j;
479  j += chan_width_x[i] + 1;
480  }
481  tile_y[ny + 1] = ((ny + 1) * tile_width) + j;
482 
483  init_world(0.0, tile_y[ny + 1] + tile_width, tile_x[nx + 1] + tile_width,
484  0.0);
485 }
static float * x_rr_node_right
Definition: draw.c:91
void init_world(float x1, float y1, float x2, float y2)
Definition: graphics.c:2038
static float * y_rr_node_bottom
Definition: draw.c:93
color_types
int * chan_width_x
Definition: globals.c:56
int * chan_width_y
Definition: globals.c:57
static float * tile_y
Definition: draw.c:68
static float pin_size
Definition: draw.c:76
#define min(a, b)
Definition: graphics.c:174
static float tile_width
Definition: draw.c:76
int num_rr_nodes
Definition: globals.c:69
int nx
Definition: globals.c:46
static enum color_types * rr_node_color
Definition: draw.c:94
int num_types
Definition: globals.c:37
static void * my_realloc(void *memblk, int ibytes)
Definition: graphics.c:512
static float * tile_x
Definition: draw.c:68
static float * x_rr_node_left
Definition: draw.c:90
struct s_type_descriptor * type_descriptors
Definition: globals.c:38
static int old_num_rr_nodes
Definition: draw.c:95
int ny
Definition: globals.c:47
static float * y_rr_node_top
Definition: draw.c:92
static boolean show_graphics
Definition: draw.c:59

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void set_graphics_state ( boolean  show_graphics_val,
int  gr_automode_val,
enum e_route_type  route_type 
)

Definition at line 144 of file draw.c.

145  {
146 
147  /* Sets the static show_graphics and gr_automode variables to the *
148  * desired values. They control if graphics are enabled and, if so, *
149  * how often the user is prompted for input. */
150 
151  show_graphics = show_graphics_val;
152  gr_automode = gr_automode_val;
153  draw_route_type = route_type;
154 }
static int gr_automode
Definition: draw.c:63
static enum e_route_type draw_route_type
Definition: draw.c:51
static boolean show_graphics
Definition: draw.c:59

+ Here is the caller graph for this function:

void update_screen ( int  priority,
char *  msg,
enum pic_type  pic_on_screen_val,
boolean  crit_path_button_enabled 
)

Definition at line 156 of file draw.c.

157  {
158 
159  /* Updates the screen if the user has requested graphics. The priority *
160  * value controls whether or not the Proceed button must be clicked to *
161  * continue. Saves the pic_on_screen_val to allow pan and zoom redraws. */
162 
163  if (!show_graphics) /* Graphics turned off */
164  return;
165 
166  /* If it's the type of picture displayed has changed, set up the proper *
167  * buttons. */
168  if (pic_on_screen != pic_on_screen_val) {
169  if (pic_on_screen_val == PLACEMENT && pic_on_screen == NO_PICTURE) {
170  create_button("Window", "Toggle Nets", toggle_nets);
171  } else if (pic_on_screen_val == ROUTING && pic_on_screen == PLACEMENT) {
172  create_button("Toggle Nets", "Toggle RR", toggle_rr);
173  create_button("Toggle RR", "Tog Defects", toggle_defects);
174  create_button("Toggle RR", "Congestion", toggle_congestion);
175 
176  if (crit_path_button_enabled) {
177  create_button("Congestion", "Crit. Path", highlight_crit_path);
178  }
179  } else if (pic_on_screen_val == PLACEMENT && pic_on_screen == ROUTING) {
180  destroy_button("Toggle RR");
181  destroy_button("Congestion");
182 
183  if (crit_path_button_enabled) {
184  destroy_button("Crit. Path");
185  }
186  } else if (pic_on_screen_val == ROUTING
187  && pic_on_screen == NO_PICTURE) {
188  create_button("Window", "Toggle Nets", toggle_nets);
189  create_button("Toggle Nets", "Toggle RR", toggle_rr);
190  create_button("Toggle RR", "Tog Defects", toggle_defects);
191  create_button("Tog Defects", "Congestion", toggle_congestion);
192 
193  if (crit_path_button_enabled) {
194  create_button("Congestion", "Crit. Path", highlight_crit_path);
195  }
196  }
197  }
198  /* Save the main message. */
199 
201 
202  pic_on_screen = pic_on_screen_val;
203  update_message(msg);
204  drawscreen();
205  if (priority >= gr_automode) {
206  event_loop(highlight_blocks, NULL, NULL, drawscreen);
207  } else {
208  flushinput();
209  }
210 }
static void toggle_nets(void(*drawscreen)(void))
Definition: draw.c:250
static int gr_automode
Definition: draw.c:63
char * my_strncpy(char *dest, const char *src, size_t size)
Definition: util.c:35
void destroy_button(const char *button_text)
Definition: graphics.c:954
#define BUFSIZE
Definition: graphics.c:184
static void toggle_rr(void(*drawscreen)(void))
Definition: draw.c:264
static void drawscreen(void)
Definition: draw.c:212
static void highlight_crit_path(void(*drawscreen_ptr)(void))
Definition: draw.c:314
static char default_message[BUFSIZE]
Definition: draw.c:61
void create_button(const char *prev_button_text, const char *button_text, void(*button_func)(void(*drawscreen)(void)))
Definition: graphics.c:881
static void toggle_congestion(void(*drawscreen)(void))
Definition: draw.c:287
static void toggle_defects(void(*drawscreen)(void))
Definition: draw.c:281
static enum pic_type pic_on_screen
Definition: draw.c:66
void event_loop(void(*act_on_mousebutton)(float x, float y), void(*act_on_mousemove)(float x, float y), void(*act_on_keypress)(char key_pressed), void(*drawscreen)(void))
Definition: graphics.c:1352
void flushinput(void)
Definition: graphics.c:2027
void update_message(const char *msg)
Definition: graphics.c:2113
static void highlight_blocks(float x, float y)
Definition: draw.c:1735
static boolean show_graphics
Definition: draw.c:59

+ Here is the call graph for this function:

+ Here is the caller graph for this function: