----------------------------------------------------------------------------------
-- Company: 
-- Engineer: 
-- 
-- Create Date: 02/02/2020 03:29:29 PM
-- Design Name: 
-- Module Name: buttons_debouncer - Behavioral
-- Project Name: 
-- Target Devices: 
-- Tool Versions: 
-- Description: 
-- 
-- Dependencies: 
-- 
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
-- 
----------------------------------------------------------------------------------


library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity buttons_debouncer is
    Port ( clk                                     : in std_logic;
           in_btn_Mid                              : in std_logic;
           in_btnU                                 : in std_logic;
           in_btnD                                 : in std_logic;
           in_btnL                                 : in std_logic;
           in_btnR                                 : in std_logic;
           out_buttons_pulse                       : out std_logic_vector (4 downto 0);
           out_buttons_continuous                  : out std_logic_vector (4 downto 0));
end buttons_debouncer;

architecture Behavioral of buttons_debouncer is

    --**********************************************************************************************
    --      DEBOUNCER COMPONENT                                                                    *
    --**********************************************************************************************

    component debouncer
	port (  --INPUTS
	        button                                 : in std_logic;
			clk                                    : in std_logic;
			--OUTPUTS
			continuous_output                      : out std_logic;
			pulse_output                           : out std_logic);
    end component;

begin

--**********************************************************************************************
    --      DEBOUNCER INSTANTIATION                                                                *
    --********************************************************************************************** 
                 
    debouncer_btnU_module : debouncer
        PORT MAP(  button                          => in_btnU,
                   clk                             => clk,
                   continuous_output               => out_buttons_continuous(0),
                   pulse_output                    => out_buttons_pulse(0));  
                   
    debouncer_btnD_module : debouncer
        PORT MAP(  button                          => in_btnD,
                   clk                             => clk,
                   continuous_output               => out_buttons_continuous(1),
                   pulse_output                    => out_buttons_pulse(1));  
                   
    debouncer_btnL_module : debouncer
        PORT MAP(  button                          => in_btnL,
                   clk                             => clk,
                   continuous_output               => out_buttons_continuous(2),
                   pulse_output                    => out_buttons_pulse(2));  
                   
    debouncer_btnR_module : debouncer
        PORT MAP(  button                          => in_btnR,
                   clk                             => clk,
                   continuous_output               => out_buttons_continuous(3),
                   pulse_output                    => out_buttons_pulse(3));  
                   
   debouncer_btn_Mid_module : debouncer
        PORT MAP(  button                          => in_btn_Mid,
                   clk                             => clk,
                   continuous_output               => out_buttons_continuous(4),
                   pulse_output                    => out_buttons_pulse(4));  

end Behavioral;
