summaryrefslogtreecommitdiff
path: root/part_2/ex6/ex6_top.v
blob: 341a2fba108c741039c982292c8c4616cacd5836 (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
32
33
34
35
36
37
38
39
40
module ex6_top (
	KEY,
	CLOCK_50,
	HEX0,
	HEX1,
	HEX2,
	HEX3,
	HEX4
);

	input [1:0] KEY;
	input CLOCK_50;
	output [6:0] HEX0;
	output [6:0] HEX1;
	output [6:0] HEX2;
	output [6:0] HEX3;
	output [6:0] HEX4;
	
	
	wire CLOCK_DIVIDED;
	wire [15:0] B;
	wire [3:0] BCD_0;
	wire [3:0] BCD_1;
	wire [3:0] BCD_2;
	wire [3:0] BCD_3;
	wire [3:0] BCD_4;

		
	
		divider_50000 COUNT0 (CLOCK_50, CLOCK_DIVIDED);

		counter_16 COUNT1 (CLOCK_DIVIDED, KEY[0], B, KEY[1]);
		bin2bcd_16 BIN1 (B, BCD_0, BCD_1, BCD_2, BCD_3, BCD_4);
	
		hex_to_7seg SEG0 (HEX0,BCD_0);
		hex_to_7seg SEG1 (HEX1,BCD_1);
		hex_to_7seg SEG2 (HEX2,BCD_2);
		hex_to_7seg SEG3 (HEX3,BCD_3);
		hex_to_7seg SEG4 (HEX4,BCD_4);
endmodule