Verilog: module vl_4_bit_adder(C0, A0, A1, A2, A3, B0, B1, B2, B3, C1, S3, S2, S1, S0); input C0, A0, A1, A2, A3, B0, B1, B2, B3; output C1, S3, S2, S1, S0; wire e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e12, e13, e14, e16, e17, e18, e20, e21, e23, e24, e25; nand u0(e0, A3, B3); xor u1(e1, A3, B3); xor u2(e2, A2, B2); xor u3(e3, A1, B1); nand u4(e4, C0, A0); nand u5(e5, B0, C0); nand u6(e6, A0, B0); xnor u7(e7, C0, A0); nand u8(e8, A2, e1, B2); nand u9(e9, A1, e2, e1, B1); nand u10(e10, e4, e5, e6); xnor u11(S0, B0, e7); not u12(e2, e12); not u13(e1, e13); nand u14(e14, e10, e3, e1, e2); xor u15(S1, e3, e10); xor u16(e16, B1, e12); nand u17(e17, e3, e10, e12); nand u18(e18, e13, A2, B2); nand u19(C1, e0, e8, e9, e14); or u20(e20, e16, e3); nand u21(e21, S1, e2, e3); nand u22(S2, e20, e17, e21); or u23(e23, C1, e13); or u24(e24, C1, S2, e12); or u25(e25, e0, S2, e12); nand u26(S3, e23, e18, e24, e25); endmodule VHDL: library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; -- =========================================== ENTITY 4_bit_adder IS PORT ( C0 : IN BIT; A0 : IN BIT; A1 : IN BIT; A2 : IN BIT; A3 : IN BIT; B0 : IN BIT; B1 : IN BIT; B2 : IN BIT; B3 : IN BIT; C1 : OUT BIT; S3 : OUT BIT; S2 : OUT BIT; S1 : OUT BIT; S0 : OUT BIT ); END 4_bit_adder; -- =========================================== ARCHITECTURE gate_level OF 4_bit_adder IS COMPONENT not1 PORT (a1: IN BIT; z: OUT BIT); END COMPONENT; -- Intermediate nets SIGNAL e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e12, e13, e14, e16, e17, e18, e20, e21, e23, e24, e25 : BIT; BEGIN U0 : nand2 PORT MAP (A3, B3, e0); U1 : xor2 PORT MAP (A3, B3, e1); U2 : xor2 PORT MAP (A2, B2, e2); U3 : xor2 PORT MAP (A1, B1, e3); U4 : nand2 PORT MAP (C0, A0, e4); U5 : nand2 PORT MAP (B0, C0, e5); U6 : nand2 PORT MAP (A0, B0, e6); U7 : xnor2 PORT MAP (C0, A0, e7); U8 : nand3 PORT MAP (A2, e1, B2, e8); U9 : nand4 PORT MAP (A1, e2, e1, B1, e9); U10 : nand3 PORT MAP (e4, e5, e6, e10); U11 : xnor2 PORT MAP (B0, e7, S0); U12 : not1 PORT MAP (e2, e12); U13 : not1 PORT MAP (e1, e13); U14 : nand4 PORT MAP (e10, e3, e1, e2, e14); U15 : xor2 PORT MAP (e3, e10, S1); U16 : xor2 PORT MAP (B1, e12, e16); U17 : nand3 PORT MAP (e3, e10, e12, e17); U18 : nand3 PORT MAP (e13, A2, B2, e18); U19 : nand4 PORT MAP (e0, e8, e9, e14, C1); U20 : or2 PORT MAP (e16, e3, e20); U21 : nand3 PORT MAP (S1, e2, e3, e21); U22 : nand3 PORT MAP (e20, e17, e21, S2); U23 : or2 PORT MAP (C1, e13, e23); U24 : or3 PORT MAP (C1, S2, e12, e24); U25 : or3 PORT MAP (e0, S2, e12, e25); U26 : nand4 PORT MAP (e23, e18, e24, e25, S3); END gate_level;