library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counter is
port(count
ut std_logic_vector(3 downto 0);
clk:in std_logic;
reset:in std_logic);
end counter;
architecture behav_counter of ha is
component ha port (a: in std_logic;
b: in std_logic;
sum: out std_logic;
c_out: out std_logic);
end component;
signal a,b,c1,c2,c3,c4,s1,s2,s3,s4:std_logic;
begin
counter
rocess(clk, reset) --process(sensitivity list)
begin
if reset'event and (reset = '1') then
c <= (others => '0');
elsif clk'event and (clk='1') then
--configuration specification
for ha1, ha2, ha3, ha4: ha use entity work.ha(rtl);
ha1:ha port map(a => a, b => b, sum => s1, c_out => c1);
ha2:ha port map(a => s1, b => b, sum => s2, c_out => c2);
ha3:ha port map(a => s2, b => b, sum => s3, c_out => c3);
ha4:ha port map(a => s3, b => b, sum => s4, c_out => c4);
end if;
end process;
count <= s;
end behav_counter;