# Set\_inst\_override for same component with different parameter values in UVM. Isn't possible ? or Is there any issue in the code?

**URL:** <https://verificationacademy.com/forums/t/set-inst-override-for-same-component-with-different-parameter-values-in-uvm-isnt-possible-or-is-there-any-issue-in-the-code/39110>\
**Category:** UVM\
**Tags:** UVM, uvm-factory-override\
**Created:** [May 23, 2021, 5:22pm UTC](https://verificationacademy.com/forums/t/set-inst-override-for-same-component-with-different-parameter-values-in-uvm-isnt-possible-or-is-there-any-issue-in-the-code/39110 "2021-05-23T17:22:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![desperadorocks](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/ecc23a/32.png) [@desperadorocks](https://verificationacademy.com/forums/u/desperadorocks)\
**Post date:** [May 23, 2021, 5:22pm UTC](https://verificationacademy.com/forums/t/set-inst-override-for-same-component-with-different-parameter-values-in-uvm-isnt-possible-or-is-there-any-issue-in-the-code/39110/1 "2021-05-23T17:22:07Z")

</div>

Hello All,

1. I have a parameterized driver, with a type and struct as parameters. Say as given below.

```verilog

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.

```

1. In the base test, I try to override this driver as follows,

```verilog

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.

---

<div class="post-metadata">

**Author:** ![desperadorocks](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/ecc23a/32.png) [@desperadorocks](https://verificationacademy.com/forums/u/desperadorocks)\
**Post date:** [May 23, 2021, 11:00pm UTC](https://verificationacademy.com/forums/t/set-inst-override-for-same-component-with-different-parameter-values-in-uvm-isnt-possible-or-is-there-any-issue-in-the-code/39110/2 "2021-05-23T23:00:39Z")

</div>

_In reply to [desperadorocks](https://verificationacademy.com/forums/t/set-inst-override-for-same-component-with-different-parameter-values-in-uvm-isnt-possible-or-is-there-any-issue-in-the-code/39110):_

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](https://verificationacademy.com/forums/uvm/overriding-parameter)

All I tried was…

1. Created a common\_v\_driver as given below.

```verilog

class common_v_driver extends uvm_driver #(drv_seq_item)

```

1. Created the parameterized driver as shown below

```verilog

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

```

1. In the base test tried the following,

```verilog

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 !

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [May 24, 2021, 6:03pm UTC](https://verificationacademy.com/forums/t/set-inst-override-for-same-component-with-different-parameter-values-in-uvm-isnt-possible-or-is-there-any-issue-in-the-code/39110/3 "2021-05-24T18:03:35Z")

</div>

_In reply to [desperadorocks](https://verificationacademy.com/forums/t/set-inst-override-for-same-component-with-different-parameter-values-in-uvm-isnt-possible-or-is-there-any-issue-in-the-code/39110/2):_

You also need to change the agent so it constructs the common\_v\_driver.

---

<div class="post-metadata">

**Author:** ![desperadorocks](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/ecc23a/32.png) [@desperadorocks](https://verificationacademy.com/forums/u/desperadorocks)\
**Post date:** [May 24, 2021, 6:46pm UTC](https://verificationacademy.com/forums/t/set-inst-override-for-same-component-with-different-parameter-values-in-uvm-isnt-possible-or-is-there-any-issue-in-the-code/39110/4 "2021-05-24T18:46:07Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/set-inst-override-for-same-component-with-different-parameter-values-in-uvm-isnt-possible-or-is-there-any-issue-in-the-code/39110/3):_

Thanks a TON Dave for the hint. Got it working.

Note:

1. Inside the v\_agt, I had instanced the v\_driver instead of the common\_v\_driver.
2. 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 !
