Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions ODIN_II/SRC/netlist_create_from_ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,32 @@ void create_netlist(ast_t* ast) {
}
}

/*---------------------------------------------------------------------------------------------
/**
*---------------------------------------------------------------------------------------------
* (function: look_for_clocks)
*
* @brief going through all FF nodes looking for the clock signals.
* If they are not clock type, they should alter to one. Since BUF
* nodes be removed in the partial mapping, the driver of the BUF
* nodes should be considered as a clock node.
*
* @param netlist pointer to the current netlist file
*-------------------------------------------------------------------------------------------*/
void look_for_clocks(netlist_t* netlist) {
int i;

for (i = 0; i < netlist->num_ff_nodes; i++) {
/* at this step, clock nodes must have been driving by one driver */
oassert(netlist->ff_nodes[i]->input_pins[1]->net->num_driver_pins == 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs some commenting. What is this trying to do and why is it needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (netlist->ff_nodes[i]->input_pins[1]->net->driver_pins[0]->node->type != CLOCK_NODE) {
netlist->ff_nodes[i]->input_pins[1]->net->driver_pins[0]->node->type = CLOCK_NODE;
/* node: clock driver node */
nnode_t* node = netlist->ff_nodes[i]->input_pins[1]->net->driver_pins[0]->node;

/* as far as a clock driver node is a BUF node, going through its drivers till finding a non-BUF node */
while (node->type == BUF_NODE)
node = node->input_pins[0]->net->driver_pins[0]->node;

if (node->type != CLOCK_NODE) {
node->type = CLOCK_NODE;
}
}
}
Expand Down