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

vsc.int_t initial negative values #70

Closed edcote closed 3 years ago

edcote commented 3 years ago

Tested with 0.3.4.20210424.1

Does not seem related to https://github.com/fvutils/pyvsc/issues/69 because the solver is not called.

import random
from vsc import *

@randobj
class cl:
  def __init__(self):
    self.x = list_t(int_t(16), init=[random.randint(-2, -1) for _ in range(1)])

c = cl()
c.randomize()
if c.x[0] > 0:
  raise RuntimeError('Value greater than zero')
mballance commented 3 years ago

Hi @edcote, Okay, I believe this is now working properly. Fixing this issue on its own was pretty simple, but I wanted to expand the testing a bit since coverage was a bit light for width-masking on signed and unsigned types.

Fixes are present in v0.3.5 and on GitHub.

-Matthew