Is there any way to declare bins name with dynamic integer value?

To cover different memory address ranges, we have three bins per range, start address, end address and mid address range. To identify the range address easily, is there any way to declare bins name with address details?

I tried to use a macro as below.

// Macro
`define MEM_CP(addr,first_addr,last_addr)\
  coverpoint ``addr`` {\
    bins start_addr_0x``first_addr`` = {``first_addr``};\
    bins end_addr_0x``last_addr``    = {``last_addr``};\
    bins mid_addr_range              = {[(``first_addr``+1):(``last_addr``-1)]};\

// Cover group having different memory ranges
covergroup mem_cg ();
  `MEM_CP(mem_addr, range1_start_addr, range1_end_addr)
  `MEM_CP(mem_addr, range2_start_addr, range2_end_addr)
  `MEM_CP(mem_addr, rangeN_start_addr, rangeN_end_addr)
endgroup // mem_cg

But this way declares bins name with variable name instead of address value stored in it.

In another words,

// Let's say
range1_start_addr = 0x1111
range1_end_addr   = 0xFFFF

// Expected bins name:
bins start_addr_0x1111 ... 
bins end_addr_0xFFFF   ...

// Unlike the above macro output:
bins start_addr_0xrange1_start_addr ...
bins end_addr_0xrange1_end_addr     ...

PS: I can’t give bins name with address directly because of multiple ranges and addresses per range may change as per the memory allocation.

In reply to bdreku:

You cannot create identifier names from the contents of a variable anywhere in SystemVerilog. Identifier names get created as part of the compilation process before a variable would even exist to have a value.

You can however associate a string comment with a covergroup/coverpoint that can be set at construction of the covergroup or anytime afterwards.

`define MEM_CP(addr,first_addr,last_addr)\
  coverpoint addr {\
    option.comment      = $sformatf("Range 0x%0h-0x%h",first_addr,last_addr);
    bins start_addr     = {first_addr};\
    bins end_addr.      = {last_addr};\
    bins mid_addr_range = {[(first_addr+1):(last_addr-1)]};\

BTW, there is no need to surround macro arguments with
unless they embedded as part of another identifier or string.

In reply to dave_59:

Makes sense. Thank you so much Dave.