Simulink HDL Coder D-FF With Trigger that isn't clock
Mostrar comentarios más antiguos
Hello, im trying to build a D-FF using HDL Coder in Simulink without a clock trigger signal. The trigger signal I desire is generated outside the subsystem and fed as an input to the subsystem. Whenever I convert the model into HDL, inputs that are not included in the subsystem are added (such as clk, clk_enable). Is there a way to model a DFF with a trigger signal that is not a system clock and translate it into HDL using HDL Coder?
The generated HDL code should be something like this:
------------------------------------------------------------------------------------------------
always @(posedge trigger_signal or negedge rst)
begin
if (!rst)
v_sampled_latched <= pi_ref;
else
v_sampled_latched<=v_sampled_masked;
end
------------------------------------------------------------------------------------------------
I have tried using delay block and triggered subsystem, both add undesired inputs to the system, and use those inputs as trigger to the DFF instead of the signal i desire.
Any help would be greatly appreciated!
Respuesta aceptada
Más respuestas (3)
Kiran Kintali
el 3 de Mayo de 2021
1 voto
The requirement is relaxed in the newer releases.
makehdl('Simulink_PI_Triggered/Discrete Compensator', 'TriggerAsClock', 'on', 'TriggerAsClockWithoutSyncRegisters', 'on')
Kiran Kintali
el 4 de Mayo de 2021
you can generate negative edge reset using ResetAssertedLevel option
makehdl(gcb, 'triggerasclock', 'on' , 'ResetAssertedLevel', 'Active-low')
always @(posedge Trigger or negedge reset)
begin : vsampled_latch_hold_process
if (reset == 1'b0) begin
In1_hold <= 6'b000000;
end
else begin
In1_hold <= In1;
end
end
you can remove resets in the generated code using the MinimizeGlobalReset option
makehdl(gcb, 'triggerasclock', 'on', 'minimizeglobalreset', 'on')
always @(posedge Trigger)
begin : vsampled_latch_hold_process
In1_hold <= In1;
end
1 comentario
Itay Israeli
el 4 de Mayo de 2021
Kiran Kintali
el 30 de Abr. de 2021
0 votos
Can you share a sample model?
Categorías
Más información sobre Clocking and Multirate Design en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

