as02d1.v
2.37 KB
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
module as02d1 (s0, s1, co, b0, add0, b1, add1, a0, a1, ci);
input b0, add0, b1, add1, a0, a1, ci;
output s0, s1, co;
`ifdef SYNTH
reg is0, is1, ico;
buf (s0,is0);
buf (s1,is1);
buf (co,ico);
always @(a0 or a1 or b0 or b1 or add1 or add0 or ci)
case ({add1,add0})
2'b00: {ico,is1,is0} = {a1,a0} - {b1,b0} - ~{1'b1,ci};
2'b11: {ico,is1,is0} = {a1,a0} + {b1,b0} + ci;
2'b01: {ico,is1,is0} = {a1,1'b0} - {b1,1'b0} + {1'b1,ci} + a0 +
b0;
2'b10: {ico,is1,is0} = {a1,1'b0} + {b1,1'b0} + a0 - b0 - ~ci;
endcase
`else
nand G2(N2, N32, N33);
and G5(N5, a0, ci);
nand G8(N8, b0, add0),
G9(N9, N40, N41);
or G12(co, N15, N23),
G13(N13, a0, ci);
nand G14(N14, N49, N50);
and G15(N15, a1, N17),
G16(N16, N13, N2);
nand G17(N17, N51, N52);
or G21(N21, N16, N5);
nand G22(N22, N53, N54);
and G23(N23, N27, N21);
or G24(N24, N25, N29);
and G25(N25, N26, N28);
or G26(N26, a0, ci),
G27(N27, a1, N22);
nand G28(N28, N55, N8);
and G29(N29, a0, ci);
or G32(N32, b0, add0);
nand G33(N33, b0, add0);
or G34(N34, N39, ci);
nand G35(N35, N39, ci);
and G36(s0, N34, N35);
or G37(N37, a0, N9);
nand G38(N38, a0, N9);
and G39(N39, N37, N38);
or G40(N40, b0, add0);
nand G41(N41, b0, add0);
or G42(N42, N48, N24);
nand G43(N43, N48, N24);
and G44(s1, N42, N43);
or G46(N46, a1, N14);
nand G47(N47, a1, N14);
and G48(N48, N46, N47);
or G49(N49, b1, add1);
nand G50(N50, b1, add1);
or G51(N51, b1, add1);
nand G52(N52, b1, add1);
or G53(N53, b1, add1);
nand G54(N54, b1, add1);
or G55(N55, b0, add0);
`endif
endmodule