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
|
module ex12_top (
SW,
CLOCK_50,
HEX0,
HEX1,
HEX2,
HEX3
);
input [9:0] SW;
input CLOCK_50;
output [6:0] HEX0,HEX1,HEX2,HEX3;
wire [9:0] DATA;
wire [3:0] BCD0,BCD1,BCD2,BCD3;
ROM ROM0 (
.address(SW[9:0]),
.clock(CLOCK_50),
.q(DATA)
);
bin2bcd_16 BIN0 (
.B(DATA),
.BCD_0(BCD0),
.BCD_1(BCD1),
.BCD_2(BCD2),
.BCD_3(BCD3)
);
hex_to_7seg SEG0 (.out(HEX0),.in(BCD0));
hex_to_7seg SEG1 (.out(HEX1),.in(BCD1));
hex_to_7seg SEG2 (.out(HEX2),.in(BCD2));
hex_to_7seg SEG3 (.out(HEX3),.in(BCD3));
endmodule
|