Closed AIAFammy closed 4 years ago
@AIAFammy
"top.filt_addr"
coverpoint has 32 bins because it was defined that way. I agree in total there is 256 possibilities, but why coverpoint should cover all of them? The designer decides what should be covered, instead of sampling everything what is possible. This is just an example, it can be implemented different way. I will update comment in the code to make it more clear.random.randint
ranges are not consistent with range
keyword. I will change to np.random.randint
as it is safer and more readable. Hi, @mciepluc Thanks for your answer. It's pretty clear, and I still have questions: Q1: How addr & mask 8 bits map to 32 bins? (I guess that just naive use 8 bits integer value 0 - 31?)
Q2: Why low_limit can't has value 31?
(sorry for closing the issue, I am typing by phone)
Many thanks!
@AIAFammy I have updated the example that should address all the issues you had. Let me know if anything remains unclear.
@mciepluc Awesome!
I have browsed all the diff parts, and it's super clear! Many thanks!
Hi, I have run this example successfully and almost understand every part of the codes. But there is two points that I can't figure out.
First: Why coverpoint
top.filt_addr
only have 32 possible options? Sinceaddr & mask
has 8 binary bits, it should be 256 possible options. Also, I found that was't every packet operation output thetop.filt_addr
bin. There must be some point I missed. I guess this coverpoint bin only activate under some condition and so there is only 32 possible options, but I can't figure out.https://github.com/mciepluc/cocotb-coverage/blob/master/examples/pkt_switch/tests/test_pkt_switch.py#L187
Second: I was wondering why we limited
low_limit
value in 3 ~ 30. Does it mean anything wrong whenlow_limit = 31
? On the other hand,range(3, 31)
has values from 3 ~ 30, butrandom.randint(3,31)
has values from 3 ~ 31. Am I correct?https://github.com/mciepluc/cocotb-coverage/blob/master/examples/pkt_switch/tests/test_pkt_switch.py#L197
https://github.com/mciepluc/cocotb-coverage/blob/master/examples/pkt_switch/tests/test_pkt_switch.py#L243
Many thanks for your contributions and helps!