⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timing_place_lookup.c

📁 用c++写的用于FPGA设计中布图布线的工具源码
💻 C
📖 第 1 页 / 共 3 页
字号:
      delta_clb_to_clb[delta_x][delta_y] =	assign_blocks_and_route_net (source_type, source_x, source_y, sink_type, 				     sink_x, sink_y, router_opts, det_routing_arch,				     segment_inf,timing_inf);    }  }  /*now move sink into the top right corner*/  sink_x = end_x;  sink_y = end_y;  source_x = 1;  for (source_y =1; source_y <= end_y; source_y ++) {    delta_x = abs(sink_x - source_x);    delta_y = abs(sink_y - source_y);    delta_clb_to_clb[delta_x][delta_y] =      assign_blocks_and_route_net (source_type, source_x, source_y, sink_type, 				   sink_x, sink_y, router_opts, det_routing_arch,				   segment_inf,timing_inf);  }    sink_x = end_x;  sink_y = end_y;  source_y = 1;  for (source_x=1; source_x <= end_x; source_x ++) {    delta_x = abs(sink_x - source_x);    delta_y = abs(sink_y - source_y);    delta_clb_to_clb[delta_x][delta_y] =      assign_blocks_and_route_net (source_type, source_x, source_y, sink_type, 				   sink_x, sink_y, router_opts, det_routing_arch,				   segment_inf,timing_inf);  }}/**************************************/static void compute_delta_inpad_to_clb (struct s_router_opts router_opts,				   struct s_det_routing_arch det_routing_arch, 				   t_segment_inf *segment_inf, 				   t_timing_inf timing_inf) {  int source_x, source_y;  int start_x, start_y, end_x, end_y;  enum e_block_types source_type, sink_type;  source_type = INPAD;    sink_type = CLB;  delta_inpad_to_clb[0][0] = IMPOSSIBLE;  delta_inpad_to_clb[nx][ny] = IMPOSSIBLE;  source_x = 0; source_y = 1;  start_x = 1; end_x = nx; start_y = 1; end_y = ny;  generic_compute_matrix(&delta_inpad_to_clb, source_type, sink_type, 			 source_x, source_y, start_x, end_x, start_y, end_y, 			 router_opts, det_routing_arch, segment_inf,timing_inf);     source_x = 1; source_y =0;    start_x = 1; end_x = 1; start_y = 1; end_y = ny;  generic_compute_matrix(&delta_inpad_to_clb, source_type, sink_type, 			 source_x, source_y, start_x, end_x, start_y, end_y,			 router_opts, det_routing_arch, segment_inf,timing_inf);  start_x = 1; end_x = nx; start_y = ny; end_y = ny;  generic_compute_matrix(&delta_inpad_to_clb, source_type, sink_type, 			 source_x, source_y, start_x, end_x, start_y, end_y,			 router_opts, det_routing_arch, segment_inf,timing_inf); }/**************************************/static void compute_delta_clb_to_outpad(struct s_router_opts router_opts,				   struct s_det_routing_arch det_routing_arch, 				   t_segment_inf *segment_inf, 				   t_timing_inf timing_inf) {  int source_x, source_y, sink_x, sink_y;  int delta_x, delta_y;  enum e_block_types source_type, sink_type;  source_type = CLB;  sink_type = OUTPAD;    delta_clb_to_outpad[0][0] = IMPOSSIBLE;  delta_clb_to_outpad[nx][ny] = IMPOSSIBLE;    sink_x = 0; sink_y = 1;  for (source_x = 1; source_x <= nx; source_x ++) {    for (source_y =1; source_y <= ny; source_y ++) {      delta_x = abs(source_x - sink_x);       delta_y = abs(source_y - sink_y);      delta_clb_to_outpad[delta_x][delta_y] =	assign_blocks_and_route_net (source_type, source_x, source_y, sink_type, 				     sink_x, sink_y,router_opts, det_routing_arch, 				     segment_inf,timing_inf);    }  }    sink_x = 1; sink_y = 0;  source_x = 1;  delta_x = abs(source_x - sink_x);  for (source_y = 1; source_y <= ny; source_y ++) {    delta_y = abs(source_y - sink_y);    delta_clb_to_outpad[delta_x][delta_y] =      assign_blocks_and_route_net (source_type, source_x, source_y, sink_type, 				   sink_x, sink_y, router_opts, det_routing_arch,				   segment_inf,timing_inf);  }  sink_x = 1; sink_y = 0;  source_y = ny;  delta_y = abs(source_y - sink_y);  for (source_x = 2; source_x <= nx; source_x ++) {    delta_x = abs(source_x - sink_x);    delta_clb_to_outpad[delta_x][delta_y] =      assign_blocks_and_route_net (source_type, source_x, source_y, sink_type, 				   sink_x, sink_y, router_opts, det_routing_arch, 				   segment_inf,timing_inf);  }}/**************************************/static void compute_delta_inpad_to_outpad(struct s_router_opts router_opts,				   struct s_det_routing_arch det_routing_arch, 				   t_segment_inf *segment_inf, 				   t_timing_inf timing_inf) {  int source_x, source_y, sink_x, sink_y;  int delta_x, delta_y;  enum e_block_types source_type, sink_type;  source_type = INPAD;  sink_type = OUTPAD;  delta_inpad_to_outpad[0][0] = 0; /*delay to itself is 0 (this can happen)*/  delta_inpad_to_outpad[nx+1][ny+1] = IMPOSSIBLE;  delta_inpad_to_outpad[0][ny]= IMPOSSIBLE;  delta_inpad_to_outpad[nx][0]= IMPOSSIBLE;  delta_inpad_to_outpad[nx][ny+1]= IMPOSSIBLE;  delta_inpad_to_outpad[nx+1][ny]= IMPOSSIBLE;  source_x = 0;  source_y = 1;  sink_x = 0;  delta_x = abs (sink_x - source_x);  for (sink_y = 2; sink_y <= ny; sink_y ++) {    delta_y = abs (sink_y - source_y);    delta_inpad_to_outpad[delta_x][delta_y] =	assign_blocks_and_route_net (source_type, source_x, source_y, sink_type, 				     sink_x, sink_y, router_opts, det_routing_arch, 				     segment_inf,timing_inf);  }   source_x = 0;  source_y = 1;  sink_x = nx+1;  delta_x = abs (sink_x - source_x);  for (sink_y = 1; sink_y <= ny; sink_y ++) {    delta_y = abs (sink_y - source_y);    delta_inpad_to_outpad[delta_x][delta_y] =	assign_blocks_and_route_net (source_type, source_x, source_y, sink_type, 				     sink_x, sink_y, router_opts, det_routing_arch, 				     segment_inf,timing_inf);  }  source_x = 1;  source_y = 0;  sink_y = 0;  delta_y = abs (sink_y - source_y);    for (sink_x = 2; sink_x <= nx; sink_x ++) {    delta_x = abs(sink_x - source_x);    delta_inpad_to_outpad[delta_x][delta_y] =	assign_blocks_and_route_net (source_type, source_x, source_y, sink_type, 				     sink_x, sink_y, router_opts, det_routing_arch, 				     segment_inf,timing_inf);  }    source_x = 1;  source_y = 0;  sink_y = ny+1;  delta_y = abs (sink_y - source_y);    for (sink_x = 1; sink_x <= nx; sink_x ++) {    delta_x = abs(sink_x - source_x);    delta_inpad_to_outpad[delta_x][delta_y] =	assign_blocks_and_route_net (source_type, source_x, source_y, sink_type, 				     sink_x, sink_y, router_opts, det_routing_arch, 				     segment_inf,timing_inf);  }  source_x = 0;  sink_y = ny+1;  for (source_y = 1; source_y <= ny; source_y ++) {    for (sink_x = 1; sink_x <= nx; sink_x ++) {      delta_y = abs(source_y - sink_y);      delta_x = abs(source_x - sink_x);      delta_inpad_to_outpad[delta_x][delta_y] =	assign_blocks_and_route_net (source_type, source_x, source_y, sink_type, 				     sink_x, sink_y, router_opts, det_routing_arch,				     segment_inf,timing_inf);    }  }  }/**************************************/#ifdef PRINT_ARRAYSstatic void  print_array(float **array_to_print, int x1, int x2, int y1, int y2) {  int idx_x, idx_y;  fprintf(lookup_dump, "\nPrinting Array \n\n");  for (idx_y = y2; idx_y >= y1; idx_y --) {    for (idx_x=x1; idx_x <= x2; idx_x ++) {      fprintf(lookup_dump, " %9.2e",array_to_print[idx_x][idx_y]);    }    fprintf(lookup_dump, "\n");  }  fprintf(lookup_dump,"\n\n");}#endif/**************************************/static void compute_delta_arrays (struct s_router_opts router_opts,				   struct s_det_routing_arch det_routing_arch, 				   t_segment_inf *segment_inf, 				   t_timing_inf timing_inf, int longest_length) {  printf("Computing delta_clb_to_clb lookup matrix, may take a few seconds, please wait...\n");  compute_delta_clb_to_clb(router_opts, det_routing_arch, segment_inf,timing_inf,			   longest_length);  printf("Computing delta_inpad_to_clb lookup matrix, may take a few seconds, please wait...\n");  compute_delta_inpad_to_clb(router_opts, det_routing_arch, segment_inf,timing_inf);  printf("Computing delta_clb_to_outpad lookup matrix, may take a few seconds, please wait...\n");  compute_delta_clb_to_outpad(router_opts, det_routing_arch, segment_inf,timing_inf);  printf("Computing delta_inpad_to_outpad lookup matrix, may take a few seconds, please wait...\n");  compute_delta_inpad_to_outpad(router_opts, det_routing_arch, segment_inf,timing_inf);#ifdef PRINT_ARRAYS  lookup_dump = my_fopen(DUMPFILE,"w",0);  fprintf(lookup_dump,"\n\nprinting delta_clb_to_clb\n");  print_array(delta_clb_to_clb, 0 , nx-1, 0, ny-1);   fprintf(lookup_dump,"\n\nprinting delta_inpad_to_clb\n");  print_array(delta_inpad_to_clb, 0, nx, 0, ny);  fprintf(lookup_dump,"\n\nprinting delta_clb_to_outpad\n");  print_array(delta_clb_to_outpad, 0, nx, 0, ny);  fprintf(lookup_dump,"\n\nprinting delta_inpad_to_outpad\n");  print_array(delta_inpad_to_outpad, 0, nx+1, 0, ny+ 1);  fclose(lookup_dump);#endif}/******* Globally Accessable Functions **********//**************************************/void compute_delay_lookup_tables(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_subblock_data subblock_data) {  static struct s_net *original_net;/*this will be used as a pointer to remember what*/  /*the "real" nets in the circuit are. This is    */  /*required because we are using the net structure*/  /*in these routines to find delays between blocks*/  static struct s_block *original_block; /*same def as original_nets, but for block  */  static int original_num_nets;  static int original_num_blocks;  static int longest_length;  alloc_and_assign_internal_structures(&original_net, 				       &original_block, &original_num_nets, 				       &original_num_blocks);			  setup_chan_width(router_opts, chan_width_dist);  alloc_routing_structs(router_opts, det_routing_arch, segment_inf, timing_inf, subblock_data);  longest_length = get_longest_segment_length( det_routing_arch, segment_inf);  /*now setup and compute the actual arrays */  alloc_delta_arrays();  compute_delta_arrays(router_opts, det_routing_arch, segment_inf,timing_inf, 		       longest_length);  /*free all data structures that are no longer needed*/  free_routing_structs(router_opts, det_routing_arch, segment_inf, timing_inf);  free_and_reset_internal_structures(original_net, original_block, 				     original_num_nets, original_num_blocks);}/**************************************/void free_place_lookup_structs(void) {  free_delta_arrays();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -