Permalink
Browse files

simple non-debounced counter circuit

  • Loading branch information...
kmod committed Jul 17, 2013
1 parent 9c627b8 commit b3b238c3dfeccceb835ab8ec889e3fa2b326d04d
Showing with 5 additions and 1 deletion.
  1. +5 −1 fpga.v
View
6 fpga.v
@@ -34,8 +34,12 @@ module fpga(
assign led = sw;
reg [15:0] ctr;
reg [4:0] btn_prev;
always @(posedge clk) begin
if (btn[0]) ctr <= ctr + 1'b1;
if (btn[0] && !btn_prev[0]) ctr <= ctr + 1'b1;
else if (btn[2] && !btn_prev[2]) ctr <= 0;
btn_prev <= btn;
end
sseg #(.N(16)) sseg(.clk(clk), .in(ctr), .c(seg), .an(an));

0 comments on commit b3b238c

Please sign in to comment.