Simulink HDL Coder D-FF With Trigger that isn't clock
이전 댓글 표시
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!
채택된 답변
추가 답변 (3개)
Kiran Kintali
2021년 5월 3일
1 개 추천
The requirement is relaxed in the newer releases.
makehdl('Simulink_PI_Triggered/Discrete Compensator', 'TriggerAsClock', 'on', 'TriggerAsClockWithoutSyncRegisters', 'on')
Kiran Kintali
2021년 5월 4일
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
카테고리
도움말 센터 및 File Exchange에서 Sources에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

