Closed ShraddhaDevaiya closed 4 years ago
Hi @mballance , I was trying to use implies constraint. But sometimes, it is giving wrong values. Following is the code for it :
import vsc @vsc.randobj class my_s(object): def __init__(self): super().__init__() self.a = vsc.rand_bit_t(2) self.b = vsc.rand_bit_t(2) @vsc.constraint def ab_con(self): with vsc.implies(self.a == 1): self.b == 1 item = my_s() for i in range(10): item.randomize() print("A = ",item.a,", B = ",item.b)
And following is the output for this :
A = 2 , B = 3 A = 3 , B = 3 A = 2 , B = 0 A = 0 , B = 2 A = 3 , B = 2 A = 1 , B = 2 A = 0 , B = 2 A = 1 , B = 2 A = 1 , B = 3 A = 2 , B = 1
As we can see, for A=1 there are different values of B, which is not correct according to our example code. Can you please take a look at this?
Got the issue, Some syntax mistake is there.
Hi @mballance , I was trying to use implies constraint. But sometimes, it is giving wrong values. Following is the code for it :
And following is the output for this :
As we can see, for A=1 there are different values of B, which is not correct according to our example code. Can you please take a look at this?