sv-tests icon indicating copy to clipboard operation
sv-tests copied to clipboard

Yosys SV Support Misrepresented Due to $display

Open sifferman opened this issue 9 months ago • 7 comments

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:

Many more tests correctly fail because the feature is unsupported, but will eventually incorrectly fail because they use $display. To list a few:

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)

sifferman avatar Oct 01 '23 03:10 sifferman