@@ -65,25 +65,25 @@ static bool warn_undriven(nnode_t* node, nnet_t* net) {
65
65
return false ;
66
66
}
67
67
68
- // TODO Uncomment this for In Outs
69
- // static void merge_with_inputs(nnode_t* node, long pin_idx) {
70
- // oassert(pin_idx < node->num_input_pins) ;
71
- // nnet_t* net = node->input_pins[pin_idx]->net ;
72
- // warn_undriven(node, net);
73
- // // Merge node with all inputs with fanout of 1
74
- // if ( net->num_fanout_pins <= 1 ) {
75
- // for (int i = 0; i < net->num_driver_pins; i++) {
76
- // npin_t* driver = net->driver_pins[i];
77
- // if (driver->name != NULL && (( driver->node->type == MULTIPLY) || (driver->node->type == HARD_IP) || (driver->node->type == MEMORY) || (driver->node->type == ADD) || (driver->node->type == MINUS))) {
78
- // vtr::free(driver ->name);
79
- // driver->name = vtr::strdup(node->name);
80
- // } else {
81
- // vtr::free (driver->node->name );
82
- // driver->node->name = vtr::strdup(node->name);
83
- // }
84
- // }
85
- // }
86
- // }
68
+ static void merge_with_inputs ( nnode_t * node, long pin_idx) {
69
+ oassert ( pin_idx < node-> num_input_pins );
70
+ nnet_t * net = node->input_pins [pin_idx]-> net ;
71
+ warn_undriven (node, net) ;
72
+ // Merge node with all inputs with fanout of 1
73
+ if (net-> num_fanout_pins <= 1 ) {
74
+ for ( int i = 0 ; i < net->num_driver_pins ; i++ ) {
75
+ npin_t * driver = net->driver_pins [i];
76
+ if ( driver-> name != NULL && ((driver-> node -> type == MULTIPLY) || (driver-> node -> type == HARD_IP) || (driver-> node -> type == MEMORY) || (driver-> node -> type == ADD) || (driver-> node -> type == MINUS))) {
77
+ vtr::free ( driver->name );
78
+ driver-> name = vtr::strdup (node ->name );
79
+ } else {
80
+ vtr::free (driver-> node -> name );
81
+ oassert (driver->node ->num_output_pins == 1 );
82
+ driver->node ->name = vtr::strdup (node->name );
83
+ }
84
+ }
85
+ }
86
+ }
87
87
88
88
static void print_net_driver (FILE* out, nnode_t * node, nnet_t * net, long driver_idx) {
89
89
oassert (driver_idx < net->num_driver_pins );
@@ -105,6 +105,7 @@ static void print_net_driver(FILE* out, nnode_t* node, nnet_t* net, long driver_
105
105
if (driver->name != NULL && ((driver->node ->type == MULTIPLY) || (driver->node ->type == HARD_IP) || (driver->node ->type == MEMORY) || (driver->node ->type == ADD) || (driver->node ->type == MINUS))) {
106
106
fprintf (out, " %s" , driver->name );
107
107
} else {
108
+ oassert (driver->node ->num_output_pins == 1 );
108
109
fprintf (out, " %s" , driver->node ->name );
109
110
}
110
111
}
@@ -221,14 +222,13 @@ void output_blif(FILE* out, netlist_t* netlist) {
221
222
fprintf (out, " \n .names gnd\n .names unconn\n .names vcc\n 1\n " );
222
223
fprintf (out, " \n " );
223
224
224
- // TODO Uncomment this for In Outs
225
225
// connect all the outputs up to the last gate
226
- // for (long i = 0; i < netlist->num_top_output_nodes; i++) {
227
- // nnode_t* node = netlist->top_output_nodes[i];
228
- // for (int j = 0; j < node->num_input_pins; j++) {
229
- // merge_with_inputs(node, j);
230
- // }
231
- // }
226
+ for (long i = 0 ; i < netlist->num_top_output_nodes ; i++) {
227
+ nnode_t * node = netlist->top_output_nodes [i];
228
+ for (int j = 0 ; j < node->num_input_pins ; j++) {
229
+ merge_with_inputs (node, j);
230
+ }
231
+ }
232
232
233
233
/* traverse the internals of the flat net-list */
234
234
if (strcmp (configuration.output_type .c_str (), " blif" ) == 0 ) {
@@ -240,9 +240,7 @@ void output_blif(FILE* out, netlist_t* netlist) {
240
240
/* connect all the outputs up to the last gate */
241
241
for (long i = 0 ; i < netlist->num_top_output_nodes ; i++) {
242
242
nnode_t * node = netlist->top_output_nodes [i];
243
-
244
- // TODO Change this to > 1 for In Outs
245
- if (node->input_pins [0 ]->net ->num_fanout_pins > 0 ) {
243
+ if (node->input_pins [0 ]->net ->num_fanout_pins > 1 ) {
246
244
nnet_t * net = node->input_pins [0 ]->net ;
247
245
warn_undriven (node, net);
248
246
for (int j = 0 ; j < net->num_driver_pins ; j++) {
0 commit comments