Coverpoint bins for 64bits wide value

Hello,

I hope I am posting in the correct forum section.
I searched previous forum entries but could not find anything similar to my issue.

I am implementing a UVM Testbench, with a SCB receiving data, checking it and sending it to coverage model.
My issue involves a 64 bits logic value and its related coverpoint.

When defining the coverpoint, I would like to use 10 bins for the range.
This is a code example of my implementation:


covergroup cg_val (string name, int min, int max) with function sample (int value);
  cp_value: coverpoint value
  { 
    bins min = {min};
    bins val[10] = {[min+1 : max-1]};
    bins max = {max};
  }
endgroup: cg_val

While this code generates 10 bins for smaller ranges, it seems to not work when “max” is (2**64)-1.
Is this related to datatypes sizes, as int should be only 32 bits?
I tried by declaring the argument “value” as a longint, but with no effect.

So this did not work :


covergroup cg_val (string name, int min, int max) with function sample (longint value);
  cp_value: coverpoint value
  { 
    bins min = {0};
    bins val[10] = {[1 : (2**64-2)]};
    bins max = {(2**64-1)};
  }
endgroup: cg_val

Please let me know if something is not clear or missing.
I am running on Questa Sim-64 2019.3
Thanks in advance for help.

Luca

In reply to Luca Iovinella:

This is because unsized numeric literals are implicitly 32-bit integer types. The result of 2**64 is 32 bit number 32’b0. And you should not be using int or longint if your values are unsigned.

typedef bit [63:0] uint64_t;

covergroup cg_val (string name, uint64_t min, max) with function sample (uint64_5 value);
  cp_value: coverpoint value
  { 
    bins min = {min};
    bins val[10] = {[min+1 : max-1]};
    bins max = {max};
  }
endgroup: cg_val

In reply to dave_59:

Thanks,
this was the issue.

Is there a reason to avoid using “longint unsigned” instead of a user defined typedef?

Thanks,
Luca

In reply to Luca Iovinella:
Using user defined typedefs makes your code easier to read and maintain. For example, you could have a 64-bit address bus and a 64-bit data bus. If you need to change just the address bus width, there’s only one place to make the change if you declared these with different typedefs.