library ieee;
use ieee.std_logic_1164.all;
entity add4 is
port(a,b:in bit_vector(3 downto 0);
s:out bit_vector(3 downto 0);
c : out bit);
end add4;
architecture structural of add4 is
component add1
port(a1,b1:in BIT;c1,s1:out BIT);
end component;
component add11
port (c1,a2,b2:in BIT; c2,s2:out BIT);
end component;
signal c_in: bit_vector(2 downto 0);
begin
p0: add1
port map(a1=>a(0),b1=>b(0),c1=>c_in(0),s1=>s(0));
p1: add11
port map(c1=>c_in(0),a2=>a(1),b2=>b(1),c2=>c_in(1),s2=>s(1));
p2: add11
port map(c1=>c_in(1),a2=>a(2),b2=>b(2),c2=>c_in(2),s2=>s(2));
p3: add11
port map(c1=>c_in(2),a2=>a(3),b2=>b(3),c2=>c,s2=>s(3));
end structural;

