Parametrized interfaces

Hi, I have a serval questions about using parametrized interface.
consider the next interface:

interface my_interface #(parameter DATA_WIDTH, PORT_NUM_WIDTH);
    
    logic                        clk           ;
    logic                        rst           ;
    
    logic                        mready;
    
    logic                        tvalid;
    logic [DATA_WIDTH      -1:0] tdata ;
    logic [PORT_NUM_WIDTH  -1:0] tdest ;    
endinterface: my_interface

now consider I want to instantiate this interface twice in my top file with different widths in each interface, for example:

my_interface #(12,2) interface_1;
my_interface #(10,4) interface_2;

(if it’s not the right way to instantiate please let me know).
my first question is as follow:
if I want to add this interface to the config_db, should I specify the parameters like:

uvm_config_db#(virtual interface my_interface#(12,2))::set(uvm_root::get(), * ,"intf1" , my_inteface_1)
uvm_config_db#(virtual interface my_interface#(10,4))::set(uvm_root::get(), * ,"intf2" , my_inteface_2)

Or should I write it without the paramters like:

uvm_config_db#(virtual interface my_interface)::set(uvm_root::get(), * ,"intf1" , my_inteface_1)
uvm_config_db#(virtual interface my_interface)::set(uvm_root::get(), * ,"intf2" , my_inteface_2)

my next question is:
if I want to have pointers in some agent to these two interfaces how should I declare them?

virtual my_interface #(12,2) agent_if_1;
virtual my_interface #(10,4) agent_if_2;

Or

virtual my_interface  agent_if_1;
virtual my_interface  agent_if_2;

I guess that the get from the config_db is done in the same way as the set to the config_db in manners of specify the interface with/without its parameters(if not tell me :slight_smile: )

Thanks,
Moshiko

Parameterized (virtual) interfaces work analogous to parameterized classes—each unique set of parameters is a unique type.
If you instantiate an actual interface with a set of parameters, the virtual interfaces that your want to reference with a virtual interface need to have matching set of parameter values.
Since you did not provide default parameter values (which is a good practice) in your my_interface definition, you must provide parameter overrides everywhere you reference it. You get compiler errors otherwise.