summaryrefslogtreecommitdiff
path: root/part_2/ex9/timer.v
blob: 4974ca2383cebccaddab2022e8525fd11b4f6aa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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