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
issues handling unsized literals with x/z extending #484
Comments
Original Redmine Comment Verilator is correct. It correctly does not warn on 'x, which expands to an arbitrary width. It does warn on 'hx, 'hx is 32 bits according to the spec, it is NOT arbitrary width like 'x. As for the failure, Verilator is not a 4 state simulator, therefore you cannot store an X and compare to an X and expect it to match. Ditto Z's. Commenting out all lines with 'x and 'z makes it pass. If you want to `ifdef out the appropriate non-verilator supported lines I'll still be glad to merge in the test. |
Original Redmine Comment Hi Wilson, My expectation was that all x/z bits from variables and literals would be converted to zeros. This would mean that although x and z values are not supported in Verilator, the comparison should be true. Below are the offending operations from the example 1. assignment (seems to work as expected placing all 0 into the variable), 2. comparison (here the literal should be converted to a 2-state 16'b0000_0000_0000_0000 before the comparison).
But this is just my reasoning. If on the other hand I make an assumption: "Verilator just converts all 4-state variables into 2-state variables", this example should behave like a reference simulator with bit variables instead of logic. I tried to run a similar example (intended for Icarus) in ModelSim and I get failures. So if the assumption is correct, then Verilator behaves as expected.
I am not sure haw useful are x/z literals in RTL, the priority of the bug can at least be reduced to low. X is sometimes used in RTL as do-not-care in case statements, Z is sometimes used for bidirectional buses. A somehow more practical example should be found to see if this could be an issue. I will check the Verilator documentation again to see which of my assumptions is correct. Regards, |
Original Redmine Comment The comparison inv !== 1'bx will always be true, because people do x comparisons to check for uninitialized state in RTL. So logic doesn't just become bit. I this last new sentence to the docs:
Tristates are another matter, and there are several bugs open related to enhancing them. |
Original Redmine Comment If you want to update the test to match behavior as described above let me know. |
Original Redmine Comment Inactive. |
Author Name: Iztok Jeras (@jeras)
Original Redmine Issue: 484 from https://www.veripool.org
Original Date: 2012-04-15
Hi,
One of the issues is Verilator handles 'x as a 32bit value, so WIDTH errors had to be silenced.
The other issue is not clear to me, but could have the same cause.
The next example can be used to test the issue, it was verified using ncsim:
test_regress/t/t_literals.pl
the test can be found at (branch test_sv) https://github.com/jeras/verilator
The testcase is not yet finished, so there might be more related issues, for example signed literals. I will probably update the test toward the end of the week.
Regards,
Iztok Jeras
The text was updated successfully, but these errors were encountered: