Passing HDL parameters through models

3 visualizaciones (últimos 30 días)
Roman Safronov
Roman Safronov el 9 de Feb. de 2021
Comentada: Roman Safronov el 10 de Feb. de 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

Respuestas (1)

Kiran Kintali
Kiran Kintali el 10 de Feb. de 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 comentario
Roman Safronov
Roman Safronov el 10 de Feb. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre HDL Coder en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by