-
Notifications
You must be signed in to change notification settings - Fork 78
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
Localparam not working properly #312
Comments
Thanks for reporting, we will investigate this. |
After further investigation it appears the problem is not that it defaults to one bit, but that in a case statement the parameter is not handled correctly if it is multiple bits wide. |
I have done further testing with this simplified design: test.sv, test.xdc It looks like this bug is caused by the way that Yosys handles the UHDM model of the design. Parsing the design directly in yosys (using the versions that are installed in the conda environment) and printing the AST dump resulted in:
It processes the localparams as two's compliment so when even when sw = 2'b10 it does not match the value of -2 that is expected. I manually installed Yosys and the UHDM plugin on my machine using the yosys-systemverilog repo as a reference. When I parsed it again using this version, the AST dump was different.
I then replaced yosys from my f4pga install with this new version of Yosys. I replaced it in opt/f4pga/xc7/conda/envs/xc7/share and opt/f4pga/xc7/conda/envs/xc7/bin. When I ran the tool-chain with these changes the design worked correctly. |
As Zach227 has observed, this can be fixed by upgrading the tools. |
When the code was compiled using Surelog-yosys plugin, the bitstream was generated, but would not work properly. The State Machine would not cycle through, which caused each button on the counter to only work once until it was reset using the center button. This was caused by the use of
localparam
This is probably caused by the parameters defaulting to one bit. Similar to this bug
The default Yosys parser has no problems with this.
Problem Code:
Solution: Either changing each occurrences of
ZERO
,INC
, andONE
with their respective values or usingtypedef enum
to create a state type.The bug appeared in
OneShot.zip written by Professor Mike Wirthlin
The text was updated successfully, but these errors were encountered: