-
Notifications
You must be signed in to change notification settings - Fork 99
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
Added an optimized popcount TDM generator to bsg_misc #653
base: master
Are you sure you want to change the base?
Added an optimized popcount TDM generator to bsg_misc #653
Conversation
Hi can you commit the .v as well? |
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.
Let's rename the script bsg_popcount_tdm.py
and make the generated module name also bsg_popcount_tdm
.
The round robin arb does something similar, we can take some inspiration from:
https://github.com/bespoke-silicon-group/basejump_stl/blob/master/bsg_misc/bsg_round_robin_arb.py
https://github.com/bespoke-silicon-group/basejump_stl/blob/master/bsg_misc/bsg_round_robin_arb.v
The arb script takes the max size as an argument and then from 1 to the max size it generates a single module that uses generate-if statements to select the generated module. Rather than sweeping all widths from 1 to max size, maybe we just take all of the widths on the command line and generate those -- so the usage would be something like python3 ./bsg_popcount_tdm.py 32 64 1000 > bsg_popcount_tdm.v
and it would generate a single modules with 3 generate-if statements.
bsg_misc/bsg_generate_popcount.py
Outdated
print_end_module( 'popcount_tdm', s_o, c_o) # calculate sum in verilog file | ||
|
||
if __name__ == '__main__': | ||
popcount_gen(8) # generates a "popcount_tdm.v" file for width of 8 |
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.
Let's expose the width as a command line argument
bsg_misc/bsg_generate_popcount.py
Outdated
@@ -0,0 +1,259 @@ | |||
#!/usr/bin/env python3 |
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.
Add a header comment with what the script does and how to use it.
Let's try to get to the bottom of why we are not winning on frequency, especially for popcount <= 32. |
You can compare the two netlists and also the STA reports. |
…ed .v file from running python .\bsg_popcount_tdm.py 1 2 4 8 bsg_popcount_tdm.v
This is a python script that generates a popcount .v file. It attempts to do a more optimized adder tree using the Three Dimensional Method (TDM). The following PPA analysis compares the original bsg_popcount.v to the generated popcount_tdm.v for widths 8, 32, 64, 128, and 1024.
The full PPA spreadsheet can be found here: https://docs.google.com/spreadsheets/d/1FjDbuVNZ45XHxjTXhP-kz8AH1CuP96d7sxJkHXT-KGA/edit?usp=sharing