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
| module sixteen_adder(
output co,
output [15:0] s,
input [15:0] a,b,
input cin);
wire [1:0] carry, p, g;
wire pa, ge;
wire c1,c2;
adder8 add1 (.co(c1),.s(s[7:0]),.pa(p[0]),.ge(g[0]),.a(a[7:0]),.b(b[7:0]),.cin(cin));
adder8 add2 (.co(c2),.s(s[15:8]),.pa(p[1]),.ge(g[1]),.a(a[15:8]),.b(b[15:8]),.cin(carry[0]));
code(.pa(pa),.ge(ge),.cout(carry),.p(p),.g(g),.cin(cin));
assign co = carry[1];
endmodule
TEST BENCH
module sixteenbit;
reg[15:0]a;
reg[15:0]b;
reg cin;
wire[15:0]s;
wire co;
endmodule |