Get uvm_config_db from uvm_sequence_item

Hi All,

I have to pass a variable from the ENV via uvm_config_db to an agent’s item(uvm_sequence_item).
Since the item is a uvm_object, when i am using the uvm_config_db get_method i got the following error:
“Illegal assignment to class mtiUvm.uvm_pkg::uvm_component”

can you please advise, how can I properly get the variable.

Regards,
David.

In reply to D_S:

It looks like one of the variables involved is extended from a uvm_component. Please post the relevant code so someone can provide further guidance.

Difficult to say without looking at the code… but you may want to check if you are trying to use a variable derived from uvm_component to retrieve a uvm_sequence_item. from the config db.

Actually, I am trying to get the agent config class. which is set by the environment.

uvm_config_db #(axi4_agt_config#(DATA_WIDTH, USER_WIDTH, ID_WIDTH, DEST_WIDTH))::get(this, “”, “AXI4_AGNT_CONFIG”, m_cfg))

Thanks,

In reply to D_S:

And how does your set command look like?

Set from env class: (for multi agent instances)

uvm_config_db #(axi4_agent_config#(.DATA_WIDTH(DATA_WIDTH), .USER_WIDTH(2), .ID_WIDTH(0), .DEST_WIDTH(0)) )::set(this, “axi_agent_num_1*”, “AXI4_STREAM_CONFIG”, m_config.m_axi4_stream_data_in_1_config);

in the agent item (using typdef)

typedef axi4_agent_config;

class axi4_agent_item#(uint DATA_WIDTH = 32, uint USER_WIDTH = 32, uint ID_WIDTH = 4, uint DEST_WIDTH = 32) extends uvm_sequence_item;
.
.
.
axi4_agent_config#(DATA_WIDTH, USER_WIDTH, ID_WIDTH, DEST_WIDTH) m_cfg;
.
.
.
uvm_config_db #(axi4_agent_config#(DATA_WIDTH, USER_WIDTH, ID_WIDTH, DEST_WIDTH))::get(this, “”, “AXI4_AGENT_CONFIG”, m_cfg))

And the error from the simulator:
** Error: (vsim-7065) Illegal assignment to class mtiUvm.uvm_pkg::uvm_component from class tb_lib.axi4_agent_uvc_pkg::axi4_agent_item #(32, 2, 0, 0)

** Error: (vsim-8754) Actual input arg. of type ‘class tb_lib.axi4_stream_uvc_pkg::axi4_agent_item #(32, 2, 0, 0)’ for formal ‘cntxt’ of ‘get’ is not compatible with the formal’s type ‘class mtiUvm.uvm_pkg::uvm_component’.

I used typedef since in compilation the simulator doesn’t recognize the env config class.
and some issue since it’s a parametrized anent

thank you for the help

In reply to D_S:

In the set command you are restricting the usage of your config to your agent (axi_agent_num_1*).
But the seqauence is not the agent. Please try to use a wildcard instead.
And something is wrong with your forward typedef.
It should be

typedef class axi4_agent_config;

In reply to D_S:

Hi David,

I see few error in you code:

  1. In the get method you cannot use ::get(this,…). Since the config_db get method expects a component instance here. You are using get method in object_class so you can mention null here.

You can first try sending a value and then try with class. Following is an example:



//env class
int count;
uvm_config_db #(int)::set(this, "*", "count", 4);


// seq class

int repeat_count;

//inside body task

uvm_config_db #(int)::get(get_sequencer(), "", "count", repeat_count);