In reply to Panchalk:
I had given a try instantiating and created a parameterized class of uvm_mem. I see an elaboration error from the simulator as below:
xmelab: *E,TYCMPAT (./my_mem.sv,92|28): assignment operator type check failed (expecting datatype compatible with ‘class memory_pkg::my_mem#(.depth(16),.width(8),.rw_access_policy(1))’ but found ‘class memory_pkg::my_mem#(.depth(16),.width(8),.rw_access_policy(0))’ instead).
Below is the code I wrote:
my_mem.sv file:
class my_mem#(int depth =16, int width =8, int rw_access_policy = 0) extends uvm_mem;
string access_policy;
function void access ();
case(rw_access_policy)
0: access_policy = “RW”;
1: access_policy = “RO”;
2: access_policy = “WO”;
default: `uvm_error(“UVM_MEM CLASS”,“Access policy not valid”)
endcase
`uvm_info(get_type_name(),$sformatf(“ACCESS POLICY PICKED is %s”,access_policy),UVM_LOW)
endfunction
//uvm_object_utils(my_mem) //or ??
uvm_object_param_utils(my_mem#(depth,width,rw_access_policy))
function new(string name = “my_mem”);
super.new(name, depth, width, access_policy, UVM_NO_COVERAGE);
endfunction
endclass
my_reg_block.sv file: (Here is where I am instantiating the my_mem class and creating the model using create method.
…
…
my_mem#(.depth(16),.width(8),.rw_access_policy(1)) RAM;
…
…
virtual function void build();
RAM = my_mem::type_id::create(“RAM”);
…
endfunction
…
endclass
Also, when I try to create the my_mem class with normal new() method than it works and I dont see the error stated above.
Could someone please suggest me the resolution to this?
Thank You,
Karma Panchal