Hello everyone,
I’m using the UVM cookbook code to set up memories for my environment. The code below is for setting up a memory, and my question is… What is the definition of the “mem_offset_reg” and the “mem_range_reg”? These do not seem to be base classes and I cannot seem to find where these classes are defined in the cookbook or through Google.
I’ve tried replacing these two identifiers with the “uvm_reg_addr_t” as well as “uvm_reg_data_t” datatypes, yet both are not working. What I get is an odd error like “Unexpected signal: 11”.
My question is where do I find these definitions, or even better… what datatype do I use for the range and offset. Even better, give me some direction on how to accurately set up these memories.
class mem_ss_reg_block extends uvm_reg_block;
`uvm_object_utils(mem_ss_reg_block)
function new(string name = "mem_ss_reg_block");
super.new(name, build_coverage(UVM_CVR_ADDR_MAP));
endfunction
// Mem array configuration registers
rand mem_offset_reg mem_1_offset;
rand mem_range_reg mem_1_range;
rand mem_offset_reg mem_2_offset;
rand mem_range_reg mem_2_range;
rand mem_offset_reg mem_3_offset;
rand mem_range_reg mem_3_range;
rand mem_status_reg mem_status;
Any input is appreciated. Thanks!
The example you’ve copied from the cookbook contains a package which defines a number of register classes (mem_ss_reg_pkg). These register classes are for the mem_offset_reg and mem_range_reg types and are specific to the example.
What is represented by the mem_ss_reg_block model is a mixture of registers and memory as defined in a simple memory controller DUT with three memory ranges defined.
Okay, well there is no where that I can find that actually defines the memory range and offset variables obviously since they are for the example. Therefore… what should I use? If I were to use this sample code methodology, then how can I get it to compile? Should I even use this method?
I’ve attached the package from the example.
In the example there are 3 memories defined - this is one of them:
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
The constructor defines the size of the memory, its width and its access policy:
function new ( string name,
longint unsigned size,
int unsigned n_bits,
string access = "RW",
int has_coverage = UVM_NO_COVERAGE )
When you add the memory to a reg_map, then you define its offset:
AHB_map.add_mem(mem_1, 32'hF000_0000, "RW");
In terms of setting up a memory, everything is available via the register API - see:
http://verificationacademy.com/uvm-ovm/Registers/ModelStructure
In reply to mperyer:
Thanks a lot mperyer, that is all very helpful. One more follow up question… what are the “mem_offset_reg” and “mem_range_reg” being used for in “mem_ss_reg_pkg.sv”, and are they necessary?
They are necessary for the example, since they model registers in the memory controller DUT. They are not of general use, so please ignore them.