VHDL - Xilinx board - Seven segment display + buttons + LEDs + UART throw RS232 code (Debouncer only)

---------------------------------------------------------------------------------- -- Company: MordorBet -- Engineer: Urko Pineda -- -- Description: -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.all; entity Debounce is Generic( counter_size: INTEGER := 10 ); Port( clk: in std_logic; btn_in: in std_logic; btn_out: out std_logic ); end Debounce; architecture Behavioral of Debounce is signal flipflops: std_logic_vector(1 downto 0); signal counter_set: std_logic; signal counter_out: std_logic_vector(counter_size downto 0) := (others => '0'); begin counter_set <= flipflops(0) xor flipflops(1); debsys: process (clk, btn_in) begin if (clk'EVENT and clk = '1') then flipflops(0) <= btn_in; flipflops(1) <= flipflops(0); if (counter_set = '1') then counter_out <= (others => '0'); elsif (counter_out(counter_size) = '0') then counter_out <= counter_out + 1; else btn_out <= flipflops(1); end if; end if; end process; end Behavioral;

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.