library ieee ;
use ieee.std_logic_1164.all ;
use ieee.numeric_std.all ;
use ieee.math_real.all ;
library work ;
use work.package_functions.all ;
entity tb_debouncer is
generic
(
G : unsigned ( 31 downto 0 ) := to_unsigned ( 50000000 , 32 )
) ;
end entity tb_debouncer ;
architecture simulation_tb_debouncer of tb_debouncer is
component debouncer is
generic
(
G : unsigned ( 31 downto 0 ) := to_unsigned ( 50000000 , 32 )
) ;
port
(
I_CLOCK : in std_logic ;
I_RESET_GLOBAL : in std_logic ;
I_RESET_LOCAL : in std_logic ;
I_TIME : in unsigned ( log_2_unsigned ( G ) downto 0 ) ;
I_BOUNCING : in std_logic ;
O_DEBOUNCED : buffer std_logic ;
O_RISE : buffer std_logic ;
O_FALL : buffer std_logic
) ;
end component debouncer ;
signal stimulus_i_clock : std_logic := '0' ;
signal stimulus_i_reset_global : std_logic ;
signal stimulus_i_reset_local : std_logic ;
signal stimulus_i_time : unsigned ( log_2_unsigned ( G ) downto 0 ) ;
signal stimulus_noise : std_logic := '0' ;
signal stimulus_i_bouncing : std_logic ;
begin
stimulus_noise <= not stimulus_noise after 500 ns ;
stimulus_i_clock <= not stimulus_i_clock after 10 ns ;
stimulus_i_reset_global <= '1' , '0' after 1 us ;
stimulus_i_reset_local <= '1' , '0' after 2 us ;
stimulus_i_time <= to_unsigned ( 900000000 , stimulus_i_time ' length ) ;
stimulus_i_bouncing <= stimulus_noise , '1' after 10 ms ;
waveform : debouncer
generic map
(
G => G
)
port map
(
I_CLOCK => stimulus_i_clock ,
I_RESET_GLOBAL => stimulus_i_reset_global ,
I_RESET_LOCAL => stimulus_i_reset_local ,
I_TIME => stimulus_i_time ,
I_BOUNCING => stimulus_i_bouncing ,
O_DEBOUNCED => open ,
O_RISE => open ,
O_FALL => open
) ;
end architecture simulation_tb_debouncer ;