summaryrefslogtreecommitdiff
path: root/part_2/ex9/divider_50000.v
blob: 6ce09f991796c9c6a70cb5b15cb3ff9738be81e0 (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
27
28
29
30
31
`timescale 1ns / 100ps


module divider_50000 (
		clock,
		out
		);
		
		parameter BIT_SZ = 16;
		input clock;
		reg [BIT_SZ-1:0] count;
		
		initial count = 0;
		
		output reg out;
		
		
		always @ (posedge clock)
		begin
			if (count < 16'd50000)
				begin
				count <= count + 1'b1;
				out <= 1'b0;
				end
			else
				begin
				out <= 1'b1;
				count <= 1'b0;		
				end
		end
endmodule