Verilog: module vl_4_bit_adder(C0, A0, A1, A2, A3, B0, B1, B2, B3, C4, S3, S2, S1, S0); input C0, A0, A1, A2, A3, B0, B1, B2, B3; output C4, S3, S2, S1, S0; wire e0, e1, e2, e3, e4, e5, e6, e7, e8, e10, e11, e13, e14, e16, e17; nand u0(e0, A3, B3); xor u1(e1, A3, B3); nand u2(e2, A2, B2); xor u3(e3, A2, B2); nand u4(e4, A1, B1); xor u5(e5, A1, B1); nand u6(e6, C0, A0); xor u7(e7, C0, A0); nand u8(e8, B0, e7); xor u9(S0, B0, e7); nand u10(e10, e6, e8); nand u11(e11, e5, e10); xor u12(S1, e5, e10); nand u13(e13, e4, e11); nand u14(e14, e3, e13); xor u15(S2, e3, e13); nand u16(e16, e2, e14); nand u17(e17, e1, e16); xor u18(S3, e1, e16); nand u19(C4, e0, e17); 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; C4 : 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; COMPONENT nand2 PORT (a1, a2: IN BIT; z: OUT BIT); END COMPONENT; COMPONENT nor2 PORT (a1, a2: IN BIT; z: OUT BIT); END COMPONENT; COMPONENT and2 PORT (a1, a2: IN BIT; z: OUT BIT); END COMPONENT; COMPONENT or2 PORT (a1, a2: IN BIT; z: OUT BIT); END COMPONENT; COMPONENT xor2 PORT (a1, a2: IN BIT; z: OUT BIT); END COMPONENT; COMPONENT nxor2 PORT (a1, a2: IN BIT; z: OUT BIT); END COMPONENT; COMPONENT nxor3 PORT (a1, a2, a3: IN BIT; z: OUT BIT); END COMPONENT; COMPONENT nxor4 PORT (a1, a2, a3, a4: IN BIT; z: OUT BIT); END COMPONENT; -- Intermediate nets SIGNAL e0, e1, e2, e3, e4, e5, e6, e7, e8, e10, e11, e13, e14, e16, e17 : BIT; BEGIN U0 : nand2 PORT MAP (A3, B3, e0); U1 : xor2 PORT MAP (A3, B3, e1); U2 : nand2 PORT MAP (A2, B2, e2); U3 : xor2 PORT MAP (A2, B2, e3); U4 : nand2 PORT MAP (A1, B1, e4); U5 : xor2 PORT MAP (A1, B1, e5); U6 : nand2 PORT MAP (C0, A0, e6); U7 : xor2 PORT MAP (C0, A0, e7); U8 : nand2 PORT MAP (B0, e7, e8); U9 : xor2 PORT MAP (B0, e7, S0); U10 : nand2 PORT MAP (e6, e8, e10); U11 : nand2 PORT MAP (e5, e10, e11); U12 : xor2 PORT MAP (e5, e10, S1); U13 : nand2 PORT MAP (e4, e11, e13); U14 : nand2 PORT MAP (e3, e13, e14); U15 : xor2 PORT MAP (e3, e13, S2); U16 : nand2 PORT MAP (e2, e14, e16); U17 : nand2 PORT MAP (e1, e16, e17); U18 : xor2 PORT MAP (e1, e16, S3); U19 : nand2 PORT MAP (e0, e17, C4); END gate_level;