Electrical – Passing and overwriting parameters to Verilog modules

verilog

I'm studying the way of passing parameters from one module to another and I have one question.

I have this instance in the top level module.

parameter a= 100;
parameter b = 200 ;

test#(b/(a*2)) test(
    .clk(clk), 
    .reset(reset), 
    .out(out)
    ); 

In test module, I have this header:

module test#(parameter max = 33 )(
  input clk,
  input reset,
  output out
);

So, my question is:

Which value will the module take as input parameter? 33 or 1 ?
I mean, Is max=33 overwritten by the one I'm passing from the top level module?

Best Answer

Yes, the value will be overwritten by the one passed from the top module. The value 33 will only be used when there is nothing passed. You can think of it as a default value.