diff options
Diffstat (limited to 'part_2/ex9/timer.v')
-rw-r--r-- | part_2/ex9/timer.v | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/part_2/ex9/timer.v b/part_2/ex9/timer.v new file mode 100644 index 0000000..4974ca2 --- /dev/null +++ b/part_2/ex9/timer.v @@ -0,0 +1,18 @@ +`timescale 1ns / 100ps
+
+
+module timer (
+ input clock,
+ input count,
+ input count_clear,
+ output reg [15:0] tim
+ );
+
+ always @ (posedge clock)
+ begin
+ if (count_clear)
+ tim <= 0;
+ else if (count)
+ tim <= tim + 16'b1;
+ end
+endmodule
|