Skip to content

Commit 30c45d1

Browse files
authored
Merge pull request #899 from CAS-Atlantic/hard_block_bug
ODIN II: fix hard block instantiation bug
2 parents 200c052 + 1e4ed54 commit 30c45d1

File tree

11 files changed

+529
-75
lines changed

11 files changed

+529
-75
lines changed

ODIN_II/SRC/adders.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,3 +1500,34 @@ void instantiate_add_w_carry_block(int *width, nnode_t *node, short mark, netlis
15001500
connect_output_pin_to_node(width, i, 0, node, current_adder, subtraction);
15011501
}
15021502
}
1503+
1504+
bool is_ast_adder(ast_node_t *node)
1505+
{
1506+
bool is_adder;
1507+
ast_node_t *instance = node->children[1];
1508+
is_adder = (!strcmp(node->children[0]->types.identifier, "adder"))
1509+
&& (instance->children[1]->num_children == 5);
1510+
1511+
ast_node_t *connect_list = instance->children[1];
1512+
if (is_adder && connect_list->children[0]->children[0])
1513+
{
1514+
/* port connections were passed by name; verify port names */
1515+
for (int i = 0; i < connect_list->num_children && is_adder; i++)
1516+
{
1517+
char *id = connect_list->children[i]->children[0]->types.identifier;
1518+
1519+
if ((strcmp(id, "a") != 0) &&
1520+
(strcmp(id, "b") != 0) &&
1521+
(strcmp(id, "cin") != 0) &&
1522+
(strcmp(id, "cout") != 0) &&
1523+
(strcmp(id, "sumout") != 0)
1524+
)
1525+
{
1526+
is_adder = false;
1527+
break;
1528+
}
1529+
}
1530+
}
1531+
1532+
return is_adder;
1533+
}

0 commit comments

Comments
 (0)