@@ -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,25 @@ 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;
11261125 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 ;
1126+ for (int i = 0 ; i < node->num_input_pins ; i++) {
1127+ for ( int j = 0 ; j < node-> input_pins [i]-> net -> num_driver_pins ; j++) {
1128+ bool found = false ;
1129+ id = node-> input_pins [i]-> net -> driver_pins [i]-> unique_id ;
1130+ for ( int k = 0 ; k < next_node->num_input_pins && !found; k++ ) {
1131+ for ( int l = 0 ; l < next_node-> input_pins [i]-> net -> num_driver_pins ; l++) {
1132+ if (id == next_node-> input_pins [k]-> net -> driver_pins [l]-> unique_id ) {
1133+ found = true ;
1134+ break ;
1135+ }
1136+ }
11381137 }
1138+ if (!found)
1139+ return -1 ;
11391140 }
1140- if (flag == -1 )
1141- break ;
11421141 }
11431142
1144- return flag ;
1143+ return 1 ;
11451144}
11461145
11471146/* ---------------------------------------------------------------------------------------------
@@ -1196,10 +1195,11 @@ static nnode_t* make_adder(operation_list funct, nnode_t* current_adder, nnode_t
11961195 // connect input a
11971196 if (current_pin < width[1 ]) {
11981197 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) {
1198+ oassert (temp_pin->net ->num_driver_pins <= 1 );
1199+ if (!temp_pin->net ->num_driver_pins || temp_pin->net ->driver_pins [0 ]->node ->type == GND_NODE) {
12001200 connect_nodes (netlist->gnd_node , 0 , new_funct, 0 + is_three_port_gate);
12011201 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) {
1202+ } else if (temp_pin->net ->driver_pins [ 0 ] ->node ->type == VCC_NODE) {
12031203 connect_nodes (netlist->vcc_node , 0 , new_funct, 0 + is_three_port_gate);
12041204 remove_fanout_pins_from_net (temp_pin->net , temp_pin, temp_pin->pin_net_idx );
12051205 } else {
@@ -1213,11 +1213,12 @@ static nnode_t* make_adder(operation_list funct, nnode_t* current_adder, nnode_t
12131213 if (current_pin < width[2 ]) {
12141214 // pin a is neighbor to pin b
12151215 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) {
1216+ oassert (temp_pin->net ->num_driver_pins <= 1 );
1217+ if (temp_pin->net ->num_driver_pins == 0 || temp_pin->net ->driver_pins [0 ]->node ->type == GND_NODE) {
12171218 nnode_t * attach_to = (subtraction) ? netlist->vcc_node : netlist->gnd_node ;
12181219 connect_nodes (attach_to, 0 , new_funct, 1 + is_three_port_gate);
12191220 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) {
1221+ } else if (temp_pin->net ->driver_pins [ 0 ] ->node ->type == VCC_NODE) {
12211222 nnode_t * attach_to = (subtraction) ? netlist->gnd_node : netlist->vcc_node ;
12221223 connect_nodes (attach_to, 0 , new_funct, 1 + is_three_port_gate);
12231224 remove_fanout_pins_from_net (temp_pin->net , temp_pin, temp_pin->pin_net_idx );
0 commit comments