@@ -318,7 +318,8 @@ void define_add_function(nnode_t* node, FILE* out) {
318318
319319 /* Write the input pins*/
320320 for (i = 0 ; i < node->num_input_pins ; i++) {
321- npin_t * driver_pin = node->input_pins [i]->net ->driver_pin ;
321+ oassert (node->input_pins [i]->net ->num_driver_pins == 1 );
322+ npin_t * driver_pin = node->input_pins [i]->net ->driver_pins [0 ];
322323
323324 if (i < node->input_port_sizes [0 ]) {
324325 if (!driver_pin->name )
@@ -1121,27 +1122,24 @@ void free_op_nodes(nnode_t* node) {
11211122 * (function: match_pins)
11221123 *-------------------------------------------------------------------------*/
11231124int match_pins (nnode_t * node, nnode_t * next_node) {
1124- int flag = 0 ;
1125- int i, j;
1126- long id;
1127- for (i = 0 ; i < node->num_input_pins ; i++) {
1128- flag = 0 ;
1129- id = node->input_pins [i]->net ->driver_pin ->unique_id ;
1130- for (j = 0 ; j < next_node->num_input_pins ; j++) {
1131- if (id == next_node->input_pins [j]->net ->driver_pin ->unique_id ) {
1132- flag = 1 ;
1133- break ;
1134- }
1135- if (j == next_node->num_input_pins - 1 ) {
1136- flag = -1 ;
1137- break ;
1125+ for (int i = 0 ; i < node->num_input_pins ; i++) {
1126+ for (int j = 0 ; j < node->input_pins [i]->net ->num_driver_pins ; j++) {
1127+ bool found = false ;
1128+ long id = node->input_pins [i]->net ->driver_pins [i]->unique_id ;
1129+ for (int k = 0 ; k < next_node->num_input_pins && !found; k++) {
1130+ for (int l = 0 ; l < next_node->input_pins [i]->net ->num_driver_pins ; l++) {
1131+ if (id == next_node->input_pins [k]->net ->driver_pins [l]->unique_id ) {
1132+ found = true ;
1133+ break ;
1134+ }
1135+ }
11381136 }
1137+ if (!found)
1138+ return -1 ;
11391139 }
1140- if (flag == -1 )
1141- break ;
11421140 }
11431141
1144- return flag ;
1142+ return 1 ;
11451143}
11461144
11471145/* ---------------------------------------------------------------------------------------------
@@ -1196,10 +1194,11 @@ static nnode_t* make_adder(operation_list funct, nnode_t* current_adder, nnode_t
11961194 // connect input a
11971195 if (current_pin < width[1 ]) {
11981196 npin_t * temp_pin = node->input_pins [current_pin];
1199- if (temp_pin->net ->driver_pin == NULL || temp_pin->net ->driver_pin ->node ->type == GND_NODE) {
1197+ oassert (temp_pin->net ->num_driver_pins <= 1 );
1198+ if (!temp_pin->net ->num_driver_pins || temp_pin->net ->driver_pins [0 ]->node ->type == GND_NODE) {
12001199 connect_nodes (netlist->gnd_node , 0 , new_funct, 0 + is_three_port_gate);
12011200 remove_fanout_pins_from_net (temp_pin->net , temp_pin, temp_pin->pin_net_idx );
1202- } else if (temp_pin->net ->driver_pin ->node ->type == VCC_NODE) {
1201+ } else if (temp_pin->net ->driver_pins [ 0 ] ->node ->type == VCC_NODE) {
12031202 connect_nodes (netlist->vcc_node , 0 , new_funct, 0 + is_three_port_gate);
12041203 remove_fanout_pins_from_net (temp_pin->net , temp_pin, temp_pin->pin_net_idx );
12051204 } else {
@@ -1213,11 +1212,12 @@ static nnode_t* make_adder(operation_list funct, nnode_t* current_adder, nnode_t
12131212 if (current_pin < width[2 ]) {
12141213 // pin a is neighbor to pin b
12151214 npin_t * temp_pin = node->input_pins [current_pin + width[1 ]];
1216- if (temp_pin->net ->driver_pin == NULL || temp_pin->net ->driver_pin ->node ->type == GND_NODE) {
1215+ oassert (temp_pin->net ->num_driver_pins <= 1 );
1216+ if (temp_pin->net ->num_driver_pins == 0 || temp_pin->net ->driver_pins [0 ]->node ->type == GND_NODE) {
12171217 nnode_t * attach_to = (subtraction) ? netlist->vcc_node : netlist->gnd_node ;
12181218 connect_nodes (attach_to, 0 , new_funct, 1 + is_three_port_gate);
12191219 remove_fanout_pins_from_net (temp_pin->net , temp_pin, temp_pin->pin_net_idx );
1220- } else if (temp_pin->net ->driver_pin ->node ->type == VCC_NODE) {
1220+ } else if (temp_pin->net ->driver_pins [ 0 ] ->node ->type == VCC_NODE) {
12211221 nnode_t * attach_to = (subtraction) ? netlist->gnd_node : netlist->vcc_node ;
12221222 connect_nodes (attach_to, 0 , new_funct, 1 + is_three_port_gate);
12231223 remove_fanout_pins_from_net (temp_pin->net , temp_pin, temp_pin->pin_net_idx );
0 commit comments