From 07cc3c5c788eff68b8d68713204613b07824fae2 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sat, 28 Mar 2026 16:35:19 -0700 Subject: Initial Commit --- counter.v | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 counter.v (limited to 'counter.v') diff --git a/counter.v b/counter.v new file mode 100644 index 0000000..f41311f --- /dev/null +++ b/counter.v @@ -0,0 +1,18 @@ +// This module is used to count things such as the number of rounds +// that have been won or the current position in the sequence +// If reset is high the counter will reset to 0 +// If increment is high the counter will be incremented by 1 +// NOTE: this module updates on the positive edge of the clock +module counter ( + input clk, + input increment, + input reset, + output reg [4:0] count +); + always @(posedge clk) begin + if (reset) + count <= 5'b00000; + else if (increment) + count <= count + 5'b00001; + end +endmodule -- cgit v1.2.1