Passing HDL parameters through models

1 回表示 (過去 30 日間)
Roman Safronov
Roman Safronov 2021 年 2 月 9 日
コメント済み: Roman Safronov 2021 年 2 月 10 日
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

回答 (1 件)

Kiran Kintali
Kiran Kintali 2021 年 2 月 10 日
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 件のコメント
Roman Safronov
Roman Safronov 2021 年 2 月 10 日
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.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by