Skip to content
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

Parallel assignment asserts do not work with icarus verilog #859

Open
rachitnigam opened this issue Jan 7, 2022 · 2 comments
Open

Parallel assignment asserts do not work with icarus verilog #859

rachitnigam opened this issue Jan 7, 2022 · 2 comments
Labels
Status: Needs Triage Issue needs some thinking

Comments

@rachitnigam
Copy link
Contributor

#847 attempted to enable parallel assignment checking with the icarus backend but inadvertently made all tests fail (another argument for #755). The problem is that the onehot primitive returns false for constants with 000x where x is generated from unassigned ports causing the program to fail.

Additionally, because the assertions are always active, even during cycles responsible for resetting undriven ports, the program will immediately fail. The likely fix is to add an additional guard in front that ensure that checking only occurs when reset if false.

Sadly, this is not as simple as ~reset & ~onehot(...) because 0 & x = x in Verilog which is really really unfortunate.

@rachitnigam rachitnigam added Type: Bug Bug in the implementation Status: Available Can be worked upon labels Jan 7, 2022
@sampsyo
Copy link
Contributor

sampsyo commented Jan 7, 2022

Very very tricky. I wonder if there's any way to configure Icarus to just throw errors the first time "x" appears instead of propagating "x"… seems unlikely, but just thought it might be worth poking around to see.

@rachitnigam rachitnigam added Status: Needs Triage Issue needs some thinking and removed Type: Bug Bug in the implementation Status: Available Can be worked upon labels Apr 29, 2023
@rachitnigam
Copy link
Contributor Author

One possible fix to this is using === which allows checking whether a value is 'x or not. We can generate the following conditional:

if (g1 !== 'x & g2 !== 'x ... ) begin
  if (~onehot(...)) { ... }

I'm hoping that the effect of this is that we only execute the onehot check when the guards have defined values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue needs some thinking
Projects
None yet
Development

No branches or pull requests

2 participants