-
Notifications
You must be signed in to change notification settings - Fork 415
Reorganizing vqm2blif source code #1850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…any type of nodes
…lso updated prototypes to match existing convention
… replaced a string literal with its variable representation.
There was a merge conflict in test.yml that was stopping kokoro from running; resolved it by adding both new lines (Seyed's and Srivatsan's). |
utils/vqm2blif/src/base/cleanup.cpp
Outdated
} | ||
} | ||
if (module_node_list[curr_node_index] == NULL) { | ||
VTR_ASSERT(curr_node_index == new_array_size); //check array size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// check array size
is too low level a comment (doesn't really tell me what you're doing except that it is a check, which I can already tell from the assert.
Instead, comment the whole if statement to explain what you're checking, and why you need two cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire block has now been removed. Originally, this assert block was used to verify whether the node list had the correct number of nodes after we had filled in all the gaps. The user originally supplied a parameter of the number of nodes within the array that were removed, using this a new array size was determined and this was compared to size of the node array after filling in all the gaps. But now, since we do not pass in the number of nodes removed, there is no need to perform this check as we now internally determine the node array size as we fix it.
utils/vqm2blif/src/base/cleanup.cpp
Outdated
/* | ||
The purpose of this function is to regorganize the nodes array by filling in gaps with the last available elements in the array to save CPU time. | ||
|
||
The node array provided to this function is expected to have elements deleted within. THis essentially creates gaps in the array. So we fill in the gaps of this array and ensure it is a continuous list of nodes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explain that the node array is module_node_list, and that deleted elements within it are NULL.
Do you need original_number_of_nodes, or would that be equal to module->number_of_nodes?
number_of_nodes_eliminated seems dangerous to pass in. It should be redundant with the number of NULL entries in the module_node_list, so it doesn't have to be passed. It isn't asserted to match the number of NULLs eliminated, so it is also a bit dangerous -- if it doesn't match then the module_node_list could be corrupted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been updated now. number_of_nodes and nodes have been removed. Additionally, the number_of_nodes_eliminated has also been removed as a parameter and we are now determining this within the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the function "remove_one_lut_nodes" also had unnecessary parameters that could have been found through "module", so the function was also changed as well.
utils/vqm2blif/src/base/cleanup.h
Outdated
@@ -19,6 +19,10 @@ extern int buffers_elim, inverts_elim, oneluts_elim; | |||
|
|||
void netlist_cleanup (t_module* module); | |||
|
|||
void remove_node ( t_node* node, t_node** nodes, int original_num_nodes ); | |||
|
|||
void reorganize_module_node_list(int original_number_of_nodes, int number_of_nodes_eliminated, t_node** module_node_list, t_module* module); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment what these functions do here (in the header) so people calling them just have to read the header. The comment should explain what each input to the function is, and what the function does (but doesn't have to explain how the function does it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional comments have been added now.
@@ -0,0 +1,157 @@ | |||
#!/bin/bash | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to add an argument to this script to allow it to update the golden results, and document when to use that here. Some changes to vqm2blif will change the output, so being able to quickly update the golden results and check the new ones in will be important.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match vtr_flow.py (script used for lots of flows), this argument would be named:
-create_golden
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also useful to take a -help argument that prints out the usage of the script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use argparse in most (all) of our python scripts, so copying its naming convention is probably best. https://docs.python.org/3/library/argparse.html
--help or -h should print something like:
usage: testvqm2blif.sh ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…unction and updated commenting to improve clarity of the function.
…ge information. The script now also supports creating a new set of golden netlists (instead of testing).
Looks good -- thanks @Srivat97 ! |
Re-factored the original vqm2blif program source code for improved modularity. To verify the modifications, a test script was also added to the codebase.
Description
Major Change 1:
Major Change 2:
Major Change 3:
Related Issue
Motivation and Context
How Has This Been Tested?
Types of changes
Checklist: