Hello All,
- I have a parameterized driver, with a type and struct as parameters. Say as given below.
typedef struct {
int hello;
} drv_struct_s;
parameter drv_struct_s drv_struct_default = '{hello=2};
class v_driver #(
parameter type ABC = logic,
parameter drv_struct_s vd = drv_struct_default
) extends uvm_driver #(drv_seq_itm);
// Note: In the agent I just instance the driver as, v_driver v_drv - i.e. allowing it to pick the default parameters values.
- In the base test, I try to override this driver as follows,
parameter drv_struct_s drv_struct_d0 = '{hello=5};
parameter drv_struct_s drv_struct_d1 = '{hello=8};
v_driver#(logic, drv_struct_default)::type_id::set_inst_override(v_driver#(integer, drv_struct_d0)::get_type(), "dummy_env.v_agt[0].v_drv", this);
v_driver#(logic, drv_struct_default)::type_id::set_inst_override(v_driver#(int, drv_struct_d1)::get_type(), "dummy_env.v_agt[1].v_drv", this);
While trying the above override, I am ending up with below error
UVM_FATAL @ 0: reporter [FCTTYP] Factory did not return a component of type ‘unknown’. A component of type ‘uvm_driver #(REQ,RSP)’ was returned instead. Name=v_drv Parent=v_agent contxt=uvm_test_top.dummy_env.v_agt[0]
Is there any issue in overriding the same component but with different parameter values ? Please do share in your views.
In reply to desperadorocks:
Hello !
I tried the option provided by @Dave from the below link, it doesn’t give any overriding error, but I don’t see the values being overridden.
Overriding Parameters
All I tried was…
- Created a common_v_driver as given below.
class common_v_driver extends uvm_driver #(drv_seq_item)
- Created the parameterized driver as shown below
typedef struct {
int hello;
} drv_struct_s;
parameter drv_struct_s drv_struct_default = '{hello=2};
class v_driver #(
parameter type ABC = logic,
parameter drv_struct_s vd = drv_struct_default
) extends common_v_driver;
...
`uvm_component_param_utils_begin(v_driver#(ABC, vd))
...
endclass: v_driver
- In the base test tried the following,
parameter drv_struct_s drv_struct_d0 = '{hello=5};
parameter drv_struct_s drv_struct_d1 = '{hello=8};
uvm_object_wrapper v_driver_proxy[int] = '{
0:v_driver#(integer, drv_struct_d0)::get_type(),
1:v_driver#(int, drv_struct_d1)::get_type()
};
set_inst_override_by_type("dummy_env.v_agt[0].v_drv", common_v_driver::get_type(), v_driver_proxy[0]);
Am I missing any of the glue logic here ? Share in your thoughts/ideas ! THanks in adv !
In reply to desperadorocks:
You also need to change the agent so it constructs the common_v_driver.
In reply to dave_59:
Thanks a TON Dave for the hint. Got it working.
Note:
- Inside the v_agt, I had instanced the v_driver instead of the common_v_driver.
- Once I changed the driver instance inside the v_agt to common_v_driver, I was able to override the parameters from the test with different types of parameterized driver configs.
Appreciate your help !