Advertisement
Guest User

Untitled

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