Passing HDL parameters through models

1 view (last 30 days)
Roman Safronov
Roman Safronov on 9 Feb 2021
Commented: Roman Safronov on 10 Feb 2021
Is it possible to pass HDL parameters through parent model to child model / subsystem?
I want to see inserting the parent parameter instead of inserting the value itself

Answers (1)

Kiran Kintali
Kiran Kintali on 10 Feb 2021
This may not yet be supported in HDL block dialogs. Please reach out to support@mathworks.com with your request and usecase models.
Can you consider hdlset_param commands with the paths to blocks?
  1 Comment
Roman Safronov
Roman Safronov on 10 Feb 2021
Sorry for misleading, by HDL parameters, I mean generic / parameter constructs in the resulting HDL code.
Suppose we have a model with a nested masked subsystem. The model workspace contains two parameters PARAM_A, PARAM_B both of which are labeled as "Argument", which means they are masked and can be tuned. Subsystem's mask has two parameters too: S_PARAM_A and S_PARAM_B.
I am using model parameters as values for subsystem parameters: PARAM_A -> S_PARAM_A, PARAM_B -> S_PARAM_B.
After HDL generation I am guessing to get something like this:
module model
(clk,
rst,
enb,
in,
out);
...
parameter [15:0] PARAM_A = 65535;
parameter [15:0] PARAM_B = 32;
...
nested_subsystem #(.S_PARAM_A(PARAM_A),
.S_PARAM_B(PARAM_B))
u_nested_subsystem (.clk(clk),
.rst(rst),
.enb(enb),
.in(in),
.out(out)
);
...
endmodule
But instead I get something like this:
module model
(clk,
rst,
enb,
in,
out);
...
parameter [15:0] PARAM_A = 65535;
parameter [15:0] PARAM_B = 32;
...
nested_subsystem #(.S_PARAM_A(65535), // inlined value instead PARAM_A
.S_PARAM_B(32)) // inlined value instead PARAM_B
u_nested_subsystem (.clk(clk),
.rst(rst),
.enb(enb),
.in(in),
.out(out)
);
...
endmodule
As you can see, the model parameters were replaced with actual values.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!