جمع کننده دو بیتی:
module full_adder1b(a,b,cin,sum,cout); input a,b,cin; output sum,cout; wire w1,w2,w3; xor (sum,a,b,cin); and (w1,a,b),(w2,a,cin),(w3,b,cin); or (cout,w1,w2,w3); endmodule
جمع کننده چهار بیتی:
module fulladder(sum, cout, a, b, cin); output sum, cout; input a, b, cin; wire s1, c1, s2; xor (s1, a, b); and (c1, a, b); xor(sum, s1, cin); and(s2, s1, cin); or(cout, s2, c1); endmodule module fulladder4(sum,cout,a,b,cin); output [3:0] sum; output cout; input [3:0] a,b; input cin; wire c1, c2, c3; fulladder fa0(sum[0], c1, a[0], b[0], cin); fulladder fa1(sum[1], c2, a[1], b[1], c1); fulladder fa2(sum[2], c3, a[2], b[2], c2); fulladder fa3(sum[3], cout, a[3], b[3], c3); endmodule