You are on page 1of 1

library ieee;

use IEEE.std_logic_1164.all;

entity add4b is
port(a,b:in std_logic_vector(3 downto 0);
cin: in std_logic;
cout: out std_logic ;
s:out std_logic_vector(3 downto 0));
end;

component HA is
port (a,b,cin :in std_logic;
s,cout: out std_logic);
end component;

architecture struct of add4b is


signal y: std_logic_vecotr(2 downto 0);
begin
p0: HA port map (a(0), b(0),cin,s(0) ,y(0));
p1: HA port map (a(1), b(1),y0,s(1) ,y(1));
p2:HA port map (a(2), b(2),y1,s(2) ,y(2));
p3: HA port map(a(3), b(3),y2,s(3) ,cout);
end;
end ;

You might also like