summaryrefslogtreecommitdiff
path: root/Increment.v
diff options
context:
space:
mode:
Diffstat (limited to 'Increment.v')
-rw-r--r--Increment.v10
1 files changed, 7 insertions, 3 deletions
diff --git a/Increment.v b/Increment.v
index b386d13..105a557 100644
--- a/Increment.v
+++ b/Increment.v
@@ -19,14 +19,18 @@
//
//////////////////////////////////////////////////////////////////////////////////
module Increment(
- input btn,
+ input btn,
+ input rst,
output [3:0] value
);
reg [3:0] value = 0;
-always @ ( posedge btn ) begin
- value = value == 9 ? 0 : value + 1;
+always @ ( posedge btn or posedge rst) begin
+ if (rst)
+ value <= 0;
+ else
+ value <= value == 4'd9 ? 4'd0 : value + 4'd1;
end
endmodule