Skip to content

Commit 58d57ce

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

28 files changed

+2175
-2245
lines changed

ODIN_II/SRC/output_blif.cpp

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,25 @@ 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+
oassert(driver->node->num_output_pins == 1);
82+
driver->node->name = vtr::strdup(node->name);
83+
}
84+
}
85+
}
86+
}
8787

8888
static void print_net_driver(FILE* out, nnode_t* node, nnet_t* net, long driver_idx) {
8989
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_
105105
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))) {
106106
fprintf(out, " %s", driver->name);
107107
} else {
108+
oassert(driver->node->num_output_pins == 1);
108109
fprintf(out, " %s", driver->node->name);
109110
}
110111
}
@@ -221,14 +222,13 @@ void output_blif(FILE* out, netlist_t* netlist) {
221222
fprintf(out, "\n.names gnd\n.names unconn\n.names vcc\n1\n");
222223
fprintf(out, "\n");
223224

224-
// TODO Uncomment this for In Outs
225225
// 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+
}
232232

233233
/* traverse the internals of the flat net-list */
234234
if (strcmp(configuration.output_type.c_str(), "blif") == 0) {
@@ -240,9 +240,7 @@ void output_blif(FILE* out, netlist_t* netlist) {
240240
/* connect all the outputs up to the last gate */
241241
for (long i = 0; i < netlist->num_top_output_nodes; i++) {
242242
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) {
246244
nnet_t* net = node->input_pins[0]->net;
247245
warn_undriven(node, net);
248246
for (int j = 0; j < net->num_driver_pins; j++) {

0 commit comments

Comments
 (0)