Skip to content

Commit f9044d5

Browse files
author
djns1
committed
Implemented InOuts
1 parent 9108b17 commit f9044d5

19 files changed

+303
-183
lines changed

ODIN_II/SRC/ast_elaborate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2656,11 +2656,11 @@ void create_param_table_for_scope(ast_node_t* module_items, sc_hierarchy* local_
26562656
/* symbols are already dealt with */
26572657
if (var_declare->types.variable.is_input
26582658
|| var_declare->types.variable.is_output
2659+
|| var_declare->types.variable.is_inout
26592660
|| var_declare->types.variable.is_reg
26602661
|| var_declare->types.variable.is_genvar
26612662
|| var_declare->types.variable.is_wire
26622663
|| var_declare->types.variable.is_defparam)
2663-
26642664
continue;
26652665

26662666
oassert(module_items->children[i]->children[j]->type == VAR_DECLARE);

ODIN_II/SRC/netlist_create_from_ast.cpp

Lines changed: 71 additions & 61 deletions
Large diffs are not rendered by default.

ODIN_II/SRC/netlist_utils.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ nnet_t* allocate_nnet() {
296296
*-------------------------------------------------------------------------------------------*/
297297
nnet_t* free_nnet(nnet_t* to_free) {
298298
if (to_free) {
299-
to_free->fanout_pins = (npin_t**)vtr::free(to_free->fanout_pins);
299+
if (to_free->num_fanout_pins)
300+
to_free->fanout_pins = (npin_t**)vtr::free(to_free->fanout_pins);
300301

301302
if (to_free->name)
302303
vtr::free(to_free->name);

ODIN_II/SRC/output_blif.cpp

Lines changed: 25 additions & 28 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) {
@@ -241,8 +239,7 @@ void output_blif(FILE* out, netlist_t* netlist) {
241239
for (long i = 0; i < netlist->num_top_output_nodes; i++) {
242240
nnode_t* node = netlist->top_output_nodes[i];
243241

244-
// TODO Change this to > 1 for In Outs
245-
if (node->input_pins[0]->net->num_fanout_pins > 0) {
242+
if (node->input_pins[0]->net->num_fanout_pins > 1) {
246243
nnet_t* net = node->input_pins[0]->net;
247244
warn_undriven(node, net);
248245
for (int j = 0; j < net->num_driver_pins; j++) {

0 commit comments

Comments
 (0)