Forum Discussion
Altera_Forum
Honored Contributor
15 years agoYou should use a synchronization chain as described in the Quartus Software Handbook and logic design text books.
always @(posedge clk)
begin
pwm_trig_s0 <= pwm_trig;
pwm_trig_s1 <= pwm_trig_s0;
if (pwm_trig_s1==1) //control the slope of the triangle wave.
b=-1;
else
b=1;
//....
end