-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I haven't played much with the coverage, but copying your covergroup snippet I'm able to get negative numbers to hit those bins. Maybe your constraints or rand variable are aren't correct? Or perhaps how you're sampling isn't right? Linking to more source code could help. I think the 2nd covergroup might be b/c you created my_covergroup again somewhere. You can also reference the unit tests on coverage and various uses of covergroups: import vsc
@vsc.randobj
class my_item(object):
def __init__(self):
self.a = vsc.rand_int32_t()
self.b = vsc.rand_int32_t()
self.op = vsc.rand_bit_t(3)
@vsc.covergroup
class my_covergroup(object):
def __init__(self, per_instance=True):
self.with_sample(
a=vsc.int32_t(),
b=vsc.int32_t(),
op=vsc.bit_t(3)
)
self.options.per_instance = per_instance
self.cp1 = vsc.coverpoint(self.a, bins={
"bin_0" : vsc.bin([-2147483648, -1300000000]),
"bin_1" : vsc.bin([-1299999999, 2147483647])
})
self.cp2 = vsc.coverpoint(self.b, bins={
"bin_0" : vsc.bin([-2147483648, -1300000000]),
"bin_1" : vsc.bin([-1299999999, 2147483647])
})
self.cp3 = vsc.coverpoint(self.op, bins={
"bin_0" : vsc.bin([0, 2]),
"bin_1" : vsc.bin([3, 7])
})
my_cg = my_covergroup()
it = my_item()
for _ in range(100):
it.randomize()
my_cg.sample(it.a, it.b, it.op)
vsc.report_coverage(details=True) Output showing all bins hit: $ ./cvg.py
TYPE my_covergroup : 100.00%
CVP cp1 : 100.00%
Bins:
bin_0 : 21
bin_1 : 79
CVP cp2 : 100.00%
Bins:
bin_0 : 21
bin_1 : 79
CVP cp3 : 100.00%
Bins:
bin_0 : 37
bin_1 : 63
INST my_covergroup : 100.00%
CVP cp1 : 100.00%
Bins:
bin_0 : 21
bin_1 : 79
CVP cp2 : 100.00%
Bins:
bin_0 : 21
bin_1 : 79
CVP cp3 : 100.00%
Bins:
bin_0 : 37
bin_1 : 63 |
Beta Was this translation helpful? Give feedback.
I fixed the issue. So bascially the DUT was sending 2's complement, which was always out of range for negative numbers and hence no bins were hit.