0
\$\begingroup\$

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?

Shashank V M
2,36918 silver badges56 bronze badges
asked Jun 29, 2017 at 10:35
\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

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.

answered Jun 29, 2017 at 10:37
\$\endgroup\$
1
  • 1
    \$\begingroup\$ FYI, In SystemVerilog, you can remove default = 33, and you are then required to provide an override in the instance. \$\endgroup\$ Commented Jun 29, 2017 at 16:01

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.