Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 02/26/2020 05:59:06 PM
  6. -- Design Name:
  7. -- Module Name: MPG - 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. use IEEE.STD_LOGIC_ARITH.ALL;
  25. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  26. -- Uncomment the following library declaration if using
  27. -- arithmetic functions with Signed or Unsigned values
  28. --use IEEE.NUMERIC_STD.ALL;
  29.  
  30. -- Uncomment the following library declaration if instantiating
  31. -- any Xilinx leaf cells in this code.
  32. --library UNISIM;
  33. --use UNISIM.VComponents.all;
  34.  
  35. entity MPG is
  36. -- Port ( );
  37. port(enable: out std_logic;
  38. buton: in std_logic;
  39. clk: in std_logic
  40. );
  41. end MPG;
  42.  
  43. architecture Behavioral of MPG is
  44.  
  45. signal count: std_logic_vector(15 downto 0) := "0000000000000000";
  46. signal Q1: std_logic;
  47. signal Q2: std_logic;
  48. signal Q3: std_logic;
  49.  
  50. begin
  51.  
  52. enable <= Q2 and (not Q3);
  53.  
  54. process(clk)
  55. begin
  56. if rising_edge(clk) then
  57. count <= count + 1;
  58. end if;
  59. end process;
  60.  
  61. process(clk)
  62. begin
  63. if rising_edge(clk) then
  64. if count = "1111111111111111" then
  65. Q1 <= buton;
  66. end if;
  67. end if;
  68. end process;
  69.  
  70. process(clk)
  71. begin
  72. if rising_edge(clk) then
  73. Q2 <= Q1;
  74. Q3 <= Q2;
  75. end if;
  76. end process;
  77.  
  78. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement