Bitwise toggle coverage for a bitvector

In reply to albert:

Hi Dave, Can we have a function inside the coverpoint like below?

covergroup memory_access(string name) with function sample(bit[47:0] sb_addr);
mrom_erom_mmio_range : coverpoint sb_addr {

                          function bit[47:0] QUEUE[$] mem_region();

                            bit [47:0]   max_addr;
                            bit [47:0]   base_addr;
                            bit [3:0]    size;
                            bit[47:0] queue [$];
                            bit [47:0] i;
                                   
                            
                                max_addr = 48'h1000000;
                                for(i=base_addr; i<=(base_addr+max_addr); i++) begin
                                queue.push(i);
                                end
                                return queue;
                              

                          endfunction

                        bins addr = mem_region();
                        }

endgroup

function void memory_space();

        new_addr = {item.addr[5], item.addr[4], item.addr[3], item.addr[2], item.addr[1], item.addr[0]};
        memory_access.sample(new_addr);
    end

endfunction: memory_space

function new (string name, ovm_component parent);
super.new(name, parent);
memory_access = new({“memory_access_”, name()});
endfunction : new

task run();
forever begin
memory_space();
end
endtask : run

Currently on compiling this code, i see syntax error

92: token is ‘function’
function bit[47:0] QUEUE[$] mem_region();

Could you provide your input?