Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 03/01/2018 10:16:06 PM
  6. -- Design Name:
  7. -- Module Name: debounce - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool Versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20.  
  21.  
  22. library IEEE;
  23. use IEEE.STD_LOGIC_1164.ALL;
  24.  
  25. -- Uncomment the following library declaration if using
  26. -- arithmetic functions with Signed or Unsigned values
  27. --use IEEE.NUMERIC_STD.ALL;
  28.  
  29. -- Uncomment the following library declaration if instantiating
  30. -- any Xilinx leaf cells in this code.
  31. --library UNISIM;
  32. --use UNISIM.VComponents.all;
  33.  
  34. entity debounce is
  35. Port ( Clk : in STD_LOGIC;
  36. Rst : in STD_LOGIC;
  37. D_in : in STD_LOGIC;
  38. Q_out : out STD_LOGIC);
  39. end debounce;
  40.  
  41. architecture Behavioral of debounce is
  42.  
  43. signal Q1, Q2, Q3 : std_logic;
  44.  
  45. begin
  46.  
  47. process(Clk)
  48. begin
  49. if (Clk'event and Clk = '1') then
  50. if (Rst = '1') then
  51. Q1 <= '0';
  52. Q2 <= '0';
  53. Q3 <= '0';
  54. else
  55. Q1 <= D_in;
  56. Q2 <= Q1;
  57. Q3 <= Q2;
  58. end if;
  59. end if;
  60. end process;
  61.  
  62. Q_out <= Q1 and Q2 and (not Q3);
  63.  
  64.  
  65. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement