Passing HDL parameters through models

조회 수: 3 (최근 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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 HDL Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by