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

[Low] Unary operator ~ not working #88

Closed ShreyanJabade closed 3 years ago

ShreyanJabade commented 3 years ago

Hello, The unary ~ operator gives error is_signed unimplemented (<class 'vsc.model.expr_unary_model.ExprUnaryModel'>)

I request you to look into this aspect. Thank you

import vsc
import random
# random.seed(0)

@vsc.randobj
class Test:
    def __init__(self):
        self.a = vsc.rand_bit_t(8)
        self.b = vsc.rand_bit_t(8)

    @vsc.constraint
    def test_c(self):
        self.a == ~self.b 

inst = Test()
inst.randomize()
print("a =", inst.a, "b =", inst.b)
print("Binary representation of a:", f"{inst.a:b}")
print("Binary representation of b:", f"{inst.b:b}")

Output is:

Failed with expression: (a == !(b))
is_signed unimplemented (<class 'vsc.model.expr_unary_model.ExprUnaryModel'>)
mballance commented 3 years ago

Corrected in 0.4.4. This bug was a side-effect from the improved expression-width tracking implemented for #81.