'Illegal Bin' in cross coverage for unaligned address

cr_haddr_X_hsize : cross cp_haddr, cp_hsize {
illegal_bins illegal_bin = cr_haddr_X_hsize with ( cp_haddr % (2
cp_hsize) != 0 );

    }

in above cross coverage I am checking for haddr and hsize are aligned to each other than cross coverage should hit if not then illegal bin should hit. I am getting this error even if the address is aligned to size.

Error-[FCIBH] Illegal bin hit
/home/harsh.suthar/Downloads/AHB_project/Version2/ei_AHB/Development/SRC/subscriber/ei_ahb_subscriber.sv, 125
ei_ahb_package, “ei_ahb_package::ei_ahb_subscriber_c::cg”
VERIFICATION ERROR (FUNCTIONAL COVERAGE) : At time 250000000 ps, Illegal bin
illegal_bin of cross cr_haddr_X_hsize in covergroup
ei_ahb_package::ei_ahb_subscriber_c::cg got hit with sample values
cp_haddr=860 cp_hsize=0x2
Covergroup Instance: ei_ahb_top.me.obj.cg
Design hierarchy: ei_ahb_package**

In reply to harsh7112001:

It looks like there might be an issue with the way you’re trying to check for alignment in the illegal bin condition. It seems like you’re using the modulus operator (%) to check if cp_haddr is aligned to 2**cp_hsize, but the error message indicates that the condition is not being met.

Here’s a possible correction to the illegal bin condition:

cr_haddr_X_hsize : cross cp_haddr, cp_hsize {
    illegal_bins illegal_bin = cr_haddr_X_hsize with ((cp_haddr & ((1 << cp_hsize) - 1)) != 0);
}

This condition checks if the cp_haddr is not aligned to 2**cp_hsize by using the bitwise AND operation (&). The expression (1 << cp_hsize) - 1 creates a bitmask with cp_hsize number of 1’s. The & operation checks if there are any non-zero bits in the lower bits of cp_haddr, which would indicate misalignment.

Make sure to adjust this based on your specific requirements, but this should give you an idea of how to check for alignment in the illegal bin condition.


rahulvala@gmail.com
Freelancer/verification engineer
https://www.linkedin.com/in/rahulvala/