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.
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.
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
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
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);