Skip to content

Commit 9a5d35c

Browse files
author
djns1
committed
Enabled BLIF buffer elimination in preparation for InOuts
1 parent 0d731c1 commit 9a5d35c

File tree

1 file changed

+24
-26
lines changed

1 file changed

+24
-26
lines changed

ODIN_II/SRC/output_blif.cpp

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,24 @@ static bool warn_undriven(nnode_t* node, nnet_t* net) {
6565
return false;
6666
}
6767

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+
driver->node->name = vtr::strdup(node->name);
82+
}
83+
}
84+
}
85+
}
8786

8887
static void print_net_driver(FILE* out, nnode_t* node, nnet_t* net, long driver_idx) {
8988
oassert(driver_idx < net->num_driver_pins);
@@ -221,14 +220,13 @@ void output_blif(FILE* out, netlist_t* netlist) {
221220
fprintf(out, "\n.names gnd\n.names unconn\n.names vcc\n1\n");
222221
fprintf(out, "\n");
223222

224-
// TODO Uncomment this for In Outs
225223
// 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-
// }
224+
for (long i = 0; i < netlist->num_top_output_nodes; i++) {
225+
nnode_t* node = netlist->top_output_nodes[i];
226+
for (int j = 0; j < node->num_input_pins; j++) {
227+
merge_with_inputs(node, j);
228+
}
229+
}
232230

233231
/* traverse the internals of the flat net-list */
234232
if (strcmp(configuration.output_type.c_str(), "blif") == 0) {

0 commit comments

Comments
 (0)