-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct mis-indexed array in coverage model
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
- Loading branch information
Showing
3 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
''' | ||
Created on Jul 1, 2020 | ||
@author: ballance | ||
''' | ||
import vsc | ||
from vsc_test_case import VscTestCase | ||
|
||
class TestCoverpointBins(VscTestCase): | ||
|
||
def test_bin_array_partition(self): | ||
|
||
@vsc.covergroup | ||
class my_cg(object): | ||
|
||
def __init__(self): | ||
self.with_sample(dict( | ||
a=vsc.uint8_t())) | ||
self.a_cp = vsc.coverpoint( | ||
self.a, bins=dict( | ||
a1=vsc.bin_array([4], (0,16)) | ||
)) | ||
|
||
cg = my_cg() | ||
cg.sample(0) | ||
cg.sample(3) | ||
print("coverage: " + str(cg.a_cp.get_coverage())) | ||
self.assertEqual(cg.a_cp.get_coverage(), 25) | ||
cg.sample(4) | ||
cg.sample(7) | ||
print("coverage: " + str(cg.a_cp.get_coverage())) | ||
self.assertEqual(cg.a_cp.get_coverage(), 50) | ||
|
||
|