rand_int8_t with negative maximum can not be randomized
XunChangqing opened this issue · 1 comments
XunChangqing commented
import vsc
@vsc.randobj
class my_cls(object):
def __init__(self):
self.a = vsc.rand_int8_t()
@vsc.constraint
def a_c(self):
self.a <= -100
myi = my_cls()
for i in range(10):
myi.randomize()
print(myi.a)
myi.a will always be -100.
master e85daca.
I think it is because of the code as below at 183 line in solvegroup_swizzler_partsel,py
d_width = 0
maxval = t_range[1]
while maxval > 0:
d_width += 1
maxval >>= 1
No random constraint is added due to incorrect d_width.
BTW:
Thanks a lot for you to open source this project.
I can only find scv(using BDD), and CRAVE other than your project.
mballance commented
@XunChangqing, many thanks for highlighting this behavior! The testcase, and your analysis on the source of the problem, was very helpful in getting it resolved quickly.
The 0.7.1 release contains a change that results in a reasonably-flat distribution of solutions across the reachable domain in this example.
Happy to know that you are finding the project useful!
-Matthew