Forum Discussion
Altera_Forum
Honored Contributor
16 years agoDebouncer verilog code
Hi you I wrote a simple code for a debouncer circuit, and I appreciate if you can have a look and correct what's wrong.
module debouncer (noisy,clk_1KHz,debounced);
input wire clk_1KHz...
Altera_Forum
Honored Contributor
11 years agoCouple of suggestions:
(1) Instead of doing:(reg == (2**M)*0) you could do: (~|reg) And similarly for: (reg == (2**M)-1) do: (®) Personally I think it looks cleaner. (2) It is really not a good idea to call a register 'reg'. 'reg' is a reserved keyword and should be used as the name. Perhaps a better name would be: reg shift; Or something similar.