Coverage bins expressions

Hi
I want to write coverage for 32 bit address.
I can write a single bin which will cover all values from minimum to maximum to get maximum coverage.
But this is not a good way I guess. Is there any industry standard specifications to write bins?
I came across some methods like walking zero,walking one, power of two etc…,
Can anyone list out all such methods using in industry?
We will get 100% coverage if we write a single bin which include minimum to maximum values. Even though why we are going for number of bins having different ranges?

You’re absolutely right, while defining a single bin that covers the entire 32-bit address range might give you 100% coverage, it doesn’t provide meaningful insights into whether all important cases have been exercised.

Here are some methods:

1. Walking Ones

  • Used to check if each individual bit can independently transition from 0 to 1.
  • Example Bins for 8-bit address (extendable to 32-bit):
covergroup cg_walking_ones;
  coverpoint addr {
    bins walking_ones[] = { 8'h01, 8'h02, 8'h04, 8'h08, 8'h10, 8'h20, 8'h40, 8'h80 };
  }
endgroup
  • For 32-bit: { 32'h00000001, 32'h00000002, ..., 32'h80000000 }

2. Walking Zeros

  • Used to check if each bit can independently transition from 1 to 0.
  • Example Bins: { 32'hFFFFFFFE, 32'hFFFFFFFD, ..., 32'h7FFFFFFF }

3. Power of Two

  • Covers cases where the address is a power of two, commonly used in memory addressing.
  • Example Bins: { 32'h00000001, 32'h00000002, 32'h00000004, ..., 32'h80000000 }

4. Boundary Testing (Min/Max/Edges of Address Ranges)

  • Tests key edge cases in the address range:
covergroup cg_boundary;
  coverpoint addr {
    bins min_value = { 32'h00000000 };
    bins near_min  = { 32'h00000001, 32'h00000002, 32'h00000003 };
    bins near_max  = { 32'hFFFFFFFD, 32'hFFFFFFFE };
    bins max_value = { 32'hFFFFFFFF };
  }
endgroup

Purpose: Ensures that logic handling minimum and maximum values behaves correctly.

#5. Stride or Linear Increment

  • Covers addresses that increase by a step (useful for cache/memory testing).
  • Example Bins: { 32'h00000000, 32'h00000100, 32'h00000200, ..., 32'hFFFFFF00 }

#6. Random Sampling

  • Defines bins based on a pseudo-random selection of addresses to catch unpredictable failures.
  • Example: bins random_bins[] = { $urandom(), $urandom() & 32'hFFFF0000 };

#7. Page Boundaries

  • Covers transitions across memory page boundaries (important for paging systems).
  • Example Bins: { 32'h0000FFFF, 32'h00010000, 32'h0001FFFF, 32'h00020000 }

#8. Aliasing Addresses

  • Checks if addresses that map to the same physical memory region are handled correctly.
  • Example Bins: { 32'h00000000, 32'h00001000, 32'h00002000, ..., 32'hFFFFF000 }

ok. Thank you. I got it.
Do we need to write some bins which are out of the maximum value also ?
Those should not hit and thus declare them as illegal bin?

Yeah. You can declare it as illegal bins because of the belowed reasons :

  • Some addresses may be reserved or unused.
  • Ensures that unwanted or undefined behavior is caught during verification.