HDL Coder Generic parameters
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ander Albizu
el 11 de Mzo. de 2021
Comentada: Shomit Dutta
el 19 de Mzo. de 2021
Good morning, I have a single doubt about generics. I continue the next steps to achieve that the HDL Coder generates generic parameter.
- Set "Generate parameterized HDL code from masked subsystem" active in the configuration
- Set the subsystem like atomic
- Create a mask
- Generate a Simulink Parameter in the base workspace
myParam = Simulink.Parameter;
myParam.CoderInfo.StorageClass = 'ExportedGlobal';
myParam.Value = 2;
myParam.Min = 1;
myParam.Max = 3;
myParam.DataType = 'uint32';
myParam.CoderInfo.Identifier = 'D_SENSING_DSP_MIDDLE_TS';
Finally I set the myParam in the Mask value.
With this 5 steps I get the generic parameter (Ander) like you can see in the file:
ARCHITECTURE rtl OF invInverterModulations IS
340
341 -- Component Declarations
342 COMPONENT invSubsystem
343 GENERIC( Ander : integer
344 );
345 PORT( clk : IN std_logic;
346 Clk_resetx : IN std_logic;
347 enb : IN std_logic;
348 dsp_control : IN std_logic_vector(31 DOWNTO 0); --
But the problem is that then the HDL Coder set the value of myParam.Value to the Generic Parameter:
BEGIN
427 u_Subsystem : invSubsystem
428 GENERIC MAP( Ander => 2
429 )
430 PORT MAP( clk => clk,
431 Clk_resetx => Clk_resetx,
432 enb => clk_enable,
433 dsp_control => DspControl, -- uint32
434 dsp_half_period => DspHalf_Period, -- uint32
435 dsp_dx => DspDx, -- uint32
436 dsp_dy => DspDy, -- uint32
My idea is to set the Value of Ander outside of this code, because this is a component that we want to use with different Ander values and we want to avoid the code generation for each Ander values. Is this possible? Or it is imposible to generate code depending in the identifier? I know that this is possible in embedded coder but in HDL coder?
I atach the Top Level file.
Thank you
0 comentarios
Respuesta aceptada
Shomit Dutta
el 16 de Mzo. de 2021
If you want to adjust model behavior using tunable parameters during HDL simulation, please check the usage described in the following page:
Hope, the above meet your requirements. Generics are useful for resuability when you have multiple instantitations of an atomic subystem inside a DUT and HDL Coder generates single resuable HDL module or entity.
2 comentarios
Shomit Dutta
el 19 de Mzo. de 2021
If you are using "Generate parameterized HDL code from masked subsystem" option, please note that the HDL code has to be bit true to the original Simulink model for verification usecases. As per design, the generic parameter can be supported only for subsystems inside DUT and not at the top DUT subsystem.
You can manually modify the generic values if it is verifying the functionality different than the original Simulink model.
Más respuestas (0)
Ver también
Categorías
Más información sobre Speed Optimization 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!