-
Notifications
You must be signed in to change notification settings - Fork 0
/
full_adder.v_sliced
74 lines (63 loc) · 1.29 KB
/
full_adder.v_sliced
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Full Adder rtl
module full_adder (a0, b0, c0, a1, b1, c_out, s_out, s2, d_out, s3);
// Inputs
input a0;
input b0;
input c0;
input a1;
input b1;
// Outputs
output c_out;
output s_out;
output s2;
output d1;
output s3;
// Wires
wire c1;
wire c2;
wire s1;
wire d1;
wire c3;
// Some assignments
assign carry_out = c1 | c2;
assign s_out = s1;
assign d_out = d1;
// Instantiating two half-adders to make the circuit.
// Module instantiation
half_adder u1_half_adder (
// Inputs
.in_x(a0),
.in_y(b0),
// End of inputs
// Outputs
.out_sum(s0),
.out_carry(c1)
// End of outputs
);
// Module instantiation
half_adder u2_half_adder (
// Inputs
.in_x(s0),
.in_y(c0),
// End of inputs
// Outputs
.out_sum(s1),
.out_carry(c2)
// End of outputs
);
// Module instantiation
test1 test1 (
// Inputs
.in_1(s1),
.in_2(s0),
.in_3(a1),
.in_4(b1),
// End of inputs
// Outputs
.out_1(s2),
.out_2(d1),
.out_3(c3)
// End of outputs
);
// Module instantiation
endmodule