summaryrefslogtreecommitdiff
path: root/part_2/ex9/delay.v
blob: 71bee218b9e1d40677cebdc2f65f417aba060222 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module delay(
	input CLOCK,
	input [13:0] DELAY,
	input START_DELAY,
	output reg TIME_OUT
);
	reg [13:0] COUNT;

	always @ (posedge CLOCK)
	begin
		if (START_DELAY == 1'b1)
		begin
			if (COUNT < DELAY+14'd24)
				begin
				COUNT <= COUNT + 1'b1;
				TIME_OUT <= 1'b0;
				end
			else
				begin
				COUNT <= 0;
				TIME_OUT <= 1'b1;
				end
		end 
		
	end
endmodule