Forum Discussion
Altera_Forum
Honored Contributor
16 years agoDivide 50 MHz by 50000 and get a signal that's '1' for one clock period and '0' for 49999. Use it as clock enable in a synchronous process, that's clocked by the 50 MHz as well.
Clock enable means e.g.always @(posedge clk50)
begin
if (cnt_1kHz)
begin
cnt_1kHz--;
ce_1kHz <= 1'b0;
end
else
begin
cnt_1kHz <= 16'd49999;
ce_1kHz <= 1'b1;
end;
if (ce_1kHz)
begin
// This code executes at 1 kHz speed
end
end