forked from Srivathsa2304/full_adder_in_7_segment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FULLADDER
42 lines (34 loc) · 780 Bytes
/
FULLADDER
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
41
42
module one_bit_adder (
input a, b, c,
output sum
);
assign sum = a ^ b ^ c;
endmodule
module seven_segment_display (
input [3:0] data,
output reg [6:0] seg
);
always @(*) begin
case (data)
4'h0: seg = 7'b1000000;
4'h1: seg = 7'b1111001;
4'h2: seg = 7'b0100100;
4'h3: seg = 7'b0110000;
4'h4: seg = 7'b0011001;
4'h5: seg = 7'b0010010;
4'h6: seg = 7'b0000010;
4'h7: seg = 7'b1111000;
4'h8: seg = 7'b0000000;
4'h9: seg = 7'b0010000;
default: seg = 7'b0111111;
endcase
end
endmodule
module top_module (
input a, b, c,
output reg sum,
output reg [3:0] display
);
one_bit_adder OBA (.a(a), .b(b), .c(c), .sum(sum));
seven_segment_display SSD (.data(sum), .seg(display));
endmodule