A
Amr
Guest
Hello all,
I wrote the following counter module in Verilog as a learning
exercise:
module pixel_counter(
input clock,
output reg [6:0] count,
output reg rollover);
always @ (posedge clock)
begin
count=count+1;
if (count==0)
rollover=1;
else
rollover=0;
end
endmodule
Now, when I came to simulate it using Quartus II, I found that the
counter worked fine but there was some strange glitches occurring
quite frequently that caused the output of the counter to change even
when the clock was stable. Screenshots of the glitches can be found at
http://i50.photobucket.com/albums/f337/TheHoplite/FPGAGlitch.png and
http://i50.photobucket.com/albums/f337/TheHoplite/FPGAGlitchclose.png.
The interesting thing is that I downloaded a few examples of Verilog
counters online, including one from Altera (http://www.altera.com/
support/examples/verilog/ver-counter.html) and even those examples had
the same glitch.
I was wondering whether this glitch is caused by the Verilog code or
whether this is something inherent in the FPGA hardware (a Cyclone III
EP3C25F324 FPGA)? How can I fix it?
Thanks
--Amr
I wrote the following counter module in Verilog as a learning
exercise:
module pixel_counter(
input clock,
output reg [6:0] count,
output reg rollover);
always @ (posedge clock)
begin
count=count+1;
if (count==0)
rollover=1;
else
rollover=0;
end
endmodule
Now, when I came to simulate it using Quartus II, I found that the
counter worked fine but there was some strange glitches occurring
quite frequently that caused the output of the counter to change even
when the clock was stable. Screenshots of the glitches can be found at
http://i50.photobucket.com/albums/f337/TheHoplite/FPGAGlitch.png and
http://i50.photobucket.com/albums/f337/TheHoplite/FPGAGlitchclose.png.
The interesting thing is that I downloaded a few examples of Verilog
counters online, including one from Altera (http://www.altera.com/
support/examples/verilog/ver-counter.html) and even those examples had
the same glitch.
I was wondering whether this glitch is caused by the Verilog code or
whether this is something inherent in the FPGA hardware (a Cyclone III
EP3C25F324 FPGA)? How can I fix it?
Thanks
--Amr