Coverage is 0% always

I am trying to execute this code and i see the coverage is always 0% even though x changes. Can any one tell me why is it 0% always?

code

In reply to rag123:

The issue is with the iff expression

Based on the code the expression is True ONLY when (bit_idx == aidx) is 1’b1

Bins are hit only when the iff expression is True which occurs during your 2nd iteration of for loop when i == 1

For all other iterations the expression is False and no bins are hit

If you comment the iff expression you observe 100% coverage

In reply to hisingh:

That is only part of the problem. To get the 2 transition bins covered you need at least 3 samples. You are only sampling each covergroup once.