I am trying to create a memory model class with memory and methods to allocate and deallocate memory dynamically.
I came across uvm_mem and thought I will be able to achieve the functionality I needed due to the memory manager instance present in uvm_mem.
I wrote a basic code :
*module test();
class mem_1_model extends uvm_mem;
`uvm_object_utils(mem_1_model)
function new(string name = “mem_1_model”);
super.new(name, 32’h2000, 32, “RW”, UVM_NO_COVERAGE);
endfunction
endclass: mem_1_model
initial
begin
mem_1_model DDR;
uvm_mem_region SQ_BA,RQ_BA,DATA_BA;
DDR = new();
$display(“RIGHTS %0s”,DDR.get_rights());
SQ_BA = DDR.mam.request_region(2);
if(SQ_BA == null)
$display("Region 1 NULL ");
end
endmodule*
KERNEL: RIGHTS RW
RUNTIME: Fatal Error: RUNTIME_0029 uvm_mem_mam.svh (759): Null pointer access.
This returns the property correctly but request_region() call returns a null pointer.
Is there anything I am missing here ?
Regards