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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ----------------------------------------------------------------------------------
  2. -- Company: INSA-Toulouse
  3. -- Engineer: Paul Faure
  4. --
  5. -- Create Date: 08.05.2021 21:00:25
  6. -- Module Name: Clock_Divider - Behavioral
  7. -- Project Name: Processeur sécurisé
  8. -- Target Devices: Basys 3 ARTIX7
  9. -- Tool Versions: Vivado 2016.4
  10. -- Description: Diviseur de clock (rapport de 1000)
  11. --
  12. -- Dependencies: None
  13. ----------------------------------------------------------------------------------
  14. library IEEE;
  15. use IEEE.STD_LOGIC_1164.ALL;
  16. entity Clock_Divider is
  17. Port ( CLK_IN : in STD_LOGIC;
  18. CLK_OUT : out STD_LOGIC);
  19. end Clock_Divider;
  20. architecture Behavioral of Clock_Divider is
  21. -- Compteur pour le diviseur
  22. signal N : Integer := 0;
  23. -- Signal enregistrant l'ancienne valeur de CLK
  24. signal CLK : STD_LOGIC := '1';
  25. begin
  26. process
  27. begin
  28. -- Synchronisation
  29. wait until CLK_IN'event and CLK_IN = '1';
  30. -- Incrementation du compteur
  31. N <= N + 1;
  32. if (N = 1000) then
  33. -- Remise a 0 et changement d'état de la CLK
  34. N <= 0;
  35. if (CLK = '1') then
  36. CLK <= '0';
  37. else
  38. CLK <= '1';
  39. end if;
  40. end if;
  41. end process;
  42. -- Sortie du signal (assynchrone -> imédiat)
  43. CLK_OUT <= CLK;
  44. end Behavioral;