Go to the source code of this file.
Functions | |
void | check_netlist (t_subblock_data *subblock_data_ptr) |
void check_netlist | ( | t_subblock_data * | subblock_data_ptr | ) |
Definition at line 52 of file check_netlist.c.
00053 { 00054 00055 /* This routine checks that the netlist makes sense, and sets the num_ff * 00056 * and num_const_gen members of subblock_data. */ 00057 00058 00059 int i, error, num_conn, max_subblocks, max_pins, max_sub_opins; 00060 int *num_uses_of_fb_pin, **num_uses_of_sblk_opin, 00061 *num_subblocks_per_block; 00062 struct s_hash **net_hash_table, *h_ptr; 00063 00064 net_hash_table = alloc_hash_table(); 00065 00066 num_subblocks_per_block = subblock_data_ptr->num_subblocks_per_block; 00067 subblock_data_ptr->num_ff = 0; 00068 subblock_data_ptr->num_const_gen = 0; 00069 00070 error = 0; 00071 max_pins = 0; 00072 max_sub_opins = 0; 00073 00074 /* Determine max number of subblocks for all types */ 00075 max_subblocks = 0; 00076 for(i = 0; i < num_types; i++) 00077 { 00078 max_subblocks = 00079 max(max_subblocks, type_descriptors[i].max_subblocks); 00080 max_pins = max(max_pins, type_descriptors[i].num_pins); 00081 max_sub_opins = 00082 max(max_sub_opins, type_descriptors[i].max_subblock_outputs); 00083 } 00084 00085 /* one mem alloc to save space */ 00086 num_uses_of_fb_pin = (int *)my_malloc(max_pins * sizeof(int)); 00087 num_uses_of_sblk_opin = 00088 (int **)alloc_matrix(0, max_subblocks - 1, 0, max_sub_opins - 1, 00089 sizeof(int)); 00090 00091 00092 /* Check that nets fanout and have a driver. */ 00093 for(i = 0; i < num_nets; i++) 00094 { 00095 h_ptr = insert_in_hash_table(net_hash_table, net[i].name, i); 00096 if(h_ptr->count != 1) { 00097 printf("Error: net %s has multiple drivers.\n", net[i].name); 00098 error++; 00099 } 00100 00101 if(net[i].num_sinks == 0) 00102 { 00103 printf("Error: net %s has no fanout.\n", net[i].name); 00104 error++; 00105 } 00106 00107 error += check_connections_to_global_fb_pins(i); 00108 } 00109 free_hash_table(net_hash_table); 00110 00111 /* Check that each block makes sense. */ 00112 for(i = 0; i < num_blocks; i++) 00113 { 00114 num_conn = get_num_conn(i); 00115 error += check_fb_conn(i, num_conn); 00116 error += check_subblocks(i, subblock_data_ptr, num_uses_of_fb_pin, 00117 num_uses_of_sblk_opin); 00118 } 00119 00120 check_for_multiple_sink_connections(); 00121 00122 error += check_for_duplicate_block_names(); 00123 00124 free(num_uses_of_fb_pin); 00125 free_matrix(num_uses_of_sblk_opin, 0, max_subblocks - 1, 0, sizeof(int)); 00126 00127 if(error != 0) 00128 { 00129 printf("Found %d fatal Errors in the input netlist.\n", error); 00130 exit(1); 00131 } 00132 }