Is there a way to share an array of enumerated variable in UVM resource db?

Hello Folks,

I tried passing an array of enumerated variable and I am getting the below error.

a. Enum declaration

typedef enum {RD=0, NO_RD=1} a_status_read_e;
   rand a_status_read_e a_status_read[32];

b. Setting the Variable

uvm_resource_db#(a_status_read_e)::set("*", "a_status_read_r", a_status_read);

c. Tried receiving from the resource db

if(!(uvm_resource_db#(a_status_read_e)::read_by_type(get_full_name(), a_status_read, this)))

d. Getting the below error:
ncelab: *E,TYCMPAT: formal and actual do not have assignment compatible data types (expecting datatype compatible with ‘unpacked array [0:31] of enumeration a_pkg::a_status_read_e’ but found ‘enumeration’ instead).

I see some recommendation like putting them inside uvm_object and sharing the same. But is there any other way to share the enum variables ?

Kindly drop in you comments !
Desperado

In reply to desperadorocks:

I believe your declaration is wrong. You are defing a vector b like this:
logic [7:0] b; this is a packed array.
You are defining an unpacked array with your declartion. This what the compiler is saying to you.

In reply to desperadorocks:

You are specifying the set / read_by_type type as a_status_read_e, but a_status_read is of type a_status_read_e [32]. Change your typedef to

typedef enum {RD=0, NO_RD=1} a_status_read_e [32];
rand a_status_read_e a_status_read;

and it should work.

In reply to chr_sue:

Your problem is you are parameterizing uvm_resource_db with the type a_status_read_e but you are setting/getting with a variable that is an array of a_status_read_e. So you either need to change the uvm_resource_db type to an array of a_status_read_e, or do 32 set/gets for each element of the array.

That will take care of your compiler error; sharing any variable is another issue. The UVM resource/config DB only copies values. If by sharing, you mean you want to share the values and keep them in sync as they are modified, then you need to wrap the variables in a class object and then copy the object handle using the uvm_resource db.

Thanks a lot for all your feedbacks !

Desperado !