Binding two parameterized modules

Hi,

I am having trouble in getting the binding working when I tried to bind two parameterized modules, one is RTL the other is a coverage module binding to it.

Here is the code:


module my_rtl  #(paarameter my_type_t CFG = '0) (signal list);

module my_cov  #(paarameter my_type_t CFG = '0) (signal list)

In my top tb, I am trying to bind them as below:

bind my_rtl my_cov #(.CFG(TB_CONFIG)) u_my_cov_inst(.*);

Note that TB_CONFIG is a parameter defined in a package and imported in the top tb.


The compile seems to be okay. However, during the analyze step, I get the following error:

The expression for a parameter actual associated with the parameter name (‘CFG’) for the module instance (‘u_my_cov_inst’) must be constant.

Not sure what the issue is as the TB_CONFIG is a constant.

Any help to fix this properly would be highly appreciated.

Thanks,
Madhu

In reply to mseyunni:

Bind expects identifiers to be relative to the target of the bind, not where the bind statement is located. Try:

bind my_rtl my_cov #(.CFG(my_package::TB_CONFIG)) u_my_cov_inst(.*);

In reply to dave_59:

Thanks Dave this works. However, I didn’t understand what you “relative to the target of the bind”. Why the bind won’t get the identifier from the package import?

In reply to mseyunni:

Bind works as if you had written the code as

module my_rtl (...);
  ... // all my stuff


  my_cov #(.CFG(TB_CONFIG)) u_my_cov_inst(.*);
endmodule

Since TB_CONFIG is not defined in my_rtl, you get an error.

In reply to dave_59:

Thank you Dave. I get it now.