-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfas.sv
70 lines (60 loc) · 953 Bytes
/
fas.sv
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
// Full Adder/Subtractor template
module fas (
input logic a, // Input bit a
input logic b, // Input bit b
input logic cin, // Carry in
input logic a_ns, // A_nS (add/not subtract) control
output logic s, // Output S
output logic cout // Carry out
);
logic t1, t2, t3, t4, t6;
XNOR2 #(
.Tpdhl(8), .Tpdlh(8)
) xnor_1 (
.A(a),
.B(a_ns),
.Z(t1)
);
OR2 #(
.Tpdhl(2), .Tpdlh(2)
) or_2 (
.A(b),
.B(cin),
.Z(t2)
);
NAND2 #(
.Tpdhl(10), .Tpdlh(10)
) nand_3 (
.A(t1),
.B(t2),
.Z(t3)
);
NAND2 #(
.Tpdhl(10), .Tpdlh(10)
) nand_4 (
.A(b),
.B(cin),
.Z(t4)
);
NAND2 #(
.Tpdlh(10), .Tpdhl(10)
) nand_5(
.A(t3),
.B(t4),
.Z(cout)
);
XNOR2 #(
.Tpdlh(8), .Tpdhl(8)
) xnor_6(
.A(a),
.B(b),
.Z(t6)
);
XNOR2 #(
.Tpdlh(8), .Tpdhl(8)
) xnor_7(
.A(t6),
.B(cin),
.Z(s)
);
endmodule