You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yeah, I think the @vsc_constraint decorator tries to override as many operators as possible to give you SV-like constraints, but just b/c you can put things in that function doesn't mean the decorator will handle it or execute as a normal function.
There aren't any examples in the docs for rand_list_t or randsz_list_t, but there is a sum property you can use to get the desired effect. Edit: My bad, there are examples. I was misreading the docs search bar results. https://fvutils.github.io/pyvsc/reference.html#vsc.types.list_t
To give each element in rand_list_t a name like a,b,c,... I just assigned it in post_randomize. Maybe there's a clearer way to do it in the init, but I don't think the rand_list_t elements exist before calling randomize. The unit tests have more examples than the docs, so it can be a good to peruse. https://github.com/fvutils/pyvsc/tree/master/ve/unit
Here's my take on your example. I left debug=True on the randomize since it can be helpful knowing what constraints were actually generated.
I have a class with variables
a,b,c,d,e,f
and want to set a constraint that anyone can be 1 at a given time.I tried
This did not work and multiple bits were set.
test.zip
is there a pythonic way of achieving the required constraint?
MWE attached.
The text was updated successfully, but these errors were encountered: