Passing HDL parameters through models

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

Respuestas (1)

Kiran Kintali
Kiran Kintali el 10 de Feb. de 2021

0 votos

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 comentario

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.

Iniciar sesión para comentar.

Preguntada:

el 9 de Feb. de 2021

Comentada:

el 10 de Feb. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by