Skip to content

Methods to get bins name with hit counts #196

Answered by mballance
suchi2108 asked this question in Q&A
Discussion options

You must be logged in to vote

I created a simple utility class that can be used as the base class for a covergroup. You can register a callback function with this class and be notified whenever a bin is hit. Have a look at the test here:

def test_object_sample_cb_1(self):
import vsc
@vsc.randobj
class BranchInstr:
def __init__(self):
self.type = vsc.rand_bit_t(1)
self.disp = vsc.rand_bit_t(19)
@vsc.constraint
def short_offset_cnstr(self):
self.disp <= 4096
def __str__(self):
return(f"type = {self.type}, displacement = {self.disp}")
# Note: Covergroup must inh…

Replies: 4 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@suchi2108
Comment options

Comment options

You must be logged in to vote
2 replies
@suchi2108
Comment options

@mballance
Comment options

Comment options

You must be logged in to vote
1 reply
@suchi2108
Comment options

Answer selected by suchi2108
Comment options

You must be logged in to vote
3 replies
@suchi2108
Comment options

@mballance
Comment options

@suchi2108
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants