No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Clock_Divider.vhd 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 08.05.2021 21:00:25
  6. -- Design Name:
  7. -- Module Name: Clock_Divider - 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. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22. -- Uncomment the following library declaration if using
  23. -- arithmetic functions with Signed or Unsigned values
  24. --use IEEE.NUMERIC_STD.ALL;
  25. -- Uncomment the following library declaration if instantiating
  26. -- any Xilinx leaf cells in this code.
  27. --library UNISIM;
  28. --use UNISIM.VComponents.all;
  29. entity Clock_Divider is
  30. Port ( CLK_IN : in STD_LOGIC;
  31. CLK_OUT : out STD_LOGIC);
  32. end Clock_Divider;
  33. architecture Behavioral of Clock_Divider is
  34. signal N : Integer := 0;
  35. signal CLK : STD_LOGIC := '1';
  36. begin
  37. process
  38. begin
  39. wait until CLK_IN'event and CLK_IN = '1';
  40. N <= N + 1;
  41. if (N = 1000) then
  42. N <= 0;
  43. if (CLK = '1') then
  44. CLK <= '0';
  45. else
  46. CLK <= '1';
  47. end if;
  48. end if;
  49. end process;
  50. CLK_OUT <= CLK;
  51. end Behavioral;