fvutils / pyvsc

Python packages providing a library for Verification Stimulus and Coverage
https://fvutils.github.io/pyvsc
Apache License 2.0
113 stars 26 forks source link

Inline Randomization Issue in 0.2.4 release #43

Closed aneels3 closed 3 years ago

aneels3 commented 3 years ago

Hi @mballance Thanks for the new release which is working well for randcase and std::randomization().

I am facing some issue with inline randomization in the new release. Previously I have implemented inline randomization like this and it was working well with the previous release i.e 0.2.3.20201006.1.

image The above particular code is working in a random fashion in the new release. Here is the console message for the failure case. image

I tried to debug with the pyvsc source files and provided the positional argument level value as 0. image but this doesn't solve the issue, Instead of a level issue, there was a multiple constraint failure. I am assuming this is not the expected solution to this problem.

I am in a confusion whether the new release alters the behaviour of inline randomization or there is some issue with my implemented code. Can you give me some pointer on this?

Regards, Anil

mballance commented 3 years ago

Hi @aneels3, After a bit of digging, I was able to reproduce the problem (I wanted to ensure I had a test that would trigger this). The most immediate cause of the problem is some diagnostic code that made an incorrect assumption about the API implemented by all fields. I've corrected this issue, and will update the release version later today. So, you're correct with your fix to add a default to the 'level' parameter. As you note, this does result in a solve failure. It's possible this results from the changes to support solve ordering. I do see that your inline constraint uses regular Python procedural if/then statements. It's possible that using these instead of constraint if/then statements (eg vsc.if_then) could cause the problem. Do try catching the SolveFail exception and displaying it. Solve-fail diagnostics are still being developed, but sometimes they can help. Have a look at this test: https://github.com/fvutils/pyvsc/blob/ac2728ac183bae7c2de80d26b77d27f155197833/ve/unit/test_solve_failure.py#L36-L41

Best Regards, Matthew

aneels3 commented 3 years ago

Hi @mballance Thanks for the quick support on this issue. It's working as expected now. closing the issue for now. If I find any issue related to this in the future, I will reopen it.

Regards, Anil