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

PyVSC should make better use of inexact domain bounds #94

Closed mballance closed 2 years ago

mballance commented 3 years ago

PyVSC evaluates the constraints to arrive at a domain bounding for each variable. In cases where the domain is subdivided into several small disjoint regions by branching constraints (eg if/else), the distribution of results is far from ideal.

@vsc.rand_obj
class disjoint_c(object):
    def __init__(self):
        self.a = vsc.rand_uint8_t()
        self.c = vsc.rand_bit_t()

    @vsc.constraint
    def disjoint_c(self):
        with vsc.if_then(self.c):
            self.a <= 10
        with vsc.else_then:
            self.a >= 250

Ideally, solutions would be evenly distributed across 0..10 and 250..255. Instead, they will cluster according to solver bias.

Collecting richer bounding information would enable the distribution to be more uniform.

mballance commented 3 years ago

PyVSC should also incorporate information about stuck-at bits, as seen in #110.

mballance commented 2 years ago

This has been addressed by randomizing the bit-swizzling order