sv-tests
sv-tests copied to clipboard
Yosys SV Support Misrepresented Due to $display
Hello, and thank you for assembling this very useful record of SV support in tools! It has been super interesting to follow.
Problem
There are several tests that Yosys is incorrectly failing due to using $display. Yosys does not support the $display
statement for non-constant values:
ERROR: Failed to evaluate system task `$display' with non-constant argument.
Many more tests would pass if their values were verified by other means than $display
. To list a few:
- tests/chapter-5/5.6.4--compiler-directives-preprocessor-macro_1.sv
- tests/chapter-7/arrays/packed/equality.sv
- tests/chapter-7/arrays/packed/onebit.sv
- tests/chapter-7/memories/read-write.sv
- tests/chapter-7/structures/packed/basic.sv
- tests/chapter-7/structures/packed/signed.sv
- tests/chapter-7/structures/packed/unsigned.sv
- tests/chapter-7/unions/packed/basic.sv
- tests/chapter-10/10.4.1--blocking-assignment.sv
Many more tests correctly fail because the feature is unsupported, but will eventually incorrectly fail because they use $display
. To list a few:
- tests/chapter-7/arrays/multidimensional/copy.sv
- tests/chapter-7/arrays/multidimensional/subarrays.sv
Possible Solutions
To fix this, a custom assert macro/function should be added that would operate differently depending on the tool choice. Here are a couple possibilities for what the custom assert macro/function should do:
output ERROR
Port
Possibly all the tests mentioned could have an output ERROR
port added to the module definition, and the assert function/macro could just run ERROR |= !(<assertion>);
for Yosys runs. Then, eval
could be run to check the value of ERROR
.
External Script
Another possibility is that the custom assert macro/function does nothing when run by Yosys. Instead, an external script will parse all the asserts and run eval
on each one.
(Note that this will not work for the tests onebit.sv and read-write.sv because there are modifications to values after they have an assertion)