Parametrized Interface and Parameterized Component issue

Hi,

I face a problem when using a parameterized OVC.
I have a component declared this way:

class vc_param_driver #(int RAM_DATA_WIDTH=32, int RAM_ADDR_WIDTH=17) extends ovm_driver #(vc_param_seq_item);
    
  vc_param_seq_item        s_item;
  vc_param_configuration   cfg;
  virtual vc_param_interface   #(.RAM_DATA_WIDTH_g(RAM_DATA_WIDTH), .RAM_ADDR_WIDTH_g(RAM_ADDR_WIDTH)) vif;

  `ovm_component_param_utils_begin(vc_param_driver#(RAM_DATA_WIDTH,RAM_ADDR_WIDTH))
    `ovm_field_object(cfg,            OVM_ALL_ON)
  `ovm_component_utils_end

From the toplevel, I create the env (which creates agent and then this driver), like this:
vc_param_agt = vc_param_agent #(32,24)::type_id::create(“vc_param_agt”,this);
And in the agent:
driver=vc_param_driver #(RAM_DATA_WIDTH,RAM_ADDR_WIDTH)::type_id::create(“driver”,this);
The toplevel interface is also instantiated with the parameters 32 and 24.

But the test bench can’t load. I get the following error:

** Fatal: (vsim-8451) …/vcparam_driver.svh(88): Virtual interface resolution cannot find a matching instance for ‘virtual vc_param_interface #(.RAM_ADDR_WIDTH_g(17), .RAM_DATA_WIDTH_g(32))’.

Candidates are:

…/vc_param_interface.svh(152): vc_param_interface #(.RAM_ADDR_WIDTH_g(24), .RAM_DATA_WIDTH_g(32)) mif()

…/vc_param_interface.svh(213): vc_param_interface #(.RAM_ADDR_WIDTH_g(24), .RAM_DATA_WIDTH_g(32)) mif()

It seems that when elaborating the bench, the tool uses the static default values given to the driver’s parameters to create the virtual interface instance, instead of using the values set from top-level… This I don’t understand. Is it really the case, or did I do something wrong somewhere?

Thanks in advance!

Please make sure that everywhere you specify the overrides for the interface instance or virtual interface variable, you use the form with explicit parameter names: #(.RAM_ADDR_WIDTH_g(24), .RAM_DATA_WIDTH_g(32))

In reply to dave_59:

Hi Dave,
thanks for the suggestion. I’ll try this out.
But, do I udnerstand correctly that we can’t bind parameters by position, only by name?

Hi Dave,

I solved my problem. First I did as you recommended and put everyhwere a binding by name for all parameters. Then I discovered that somewhere in the hierarchy, I created a component without its parameters. This is why in the end, parameters were not properly propagated and I ended up with this strange loading error.

Thanks again for the help!