Guest User

Untitled

a guest
May 16th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.66 KB | None | 0 0
  1.  
  2.  
  3.  
  4. ----------------------------------------------------------------------------------
  5. -- Company:
  6. -- Engineer:
  7. --
  8. -- Create Date:    16:53:25 12/01/2011
  9. -- Design Name:
  10. -- Module Name:    guigui - Behavioral
  11. -- Project Name:
  12. -- Target Devices:
  13. -- Tool versions:
  14. -- Description:
  15. --
  16. -- Dependencies:
  17. --
  18. -- Revision:
  19. -- Revision 0.01 - File Created
  20. -- Additional Comments:
  21. --
  22. ----------------------------------------------------------------------------------
  23. library IEEE;                                       -- Uncomment the following library declaration if instantiating
  24. use IEEE.STD_LOGIC_1164.ALL;                    -- any Xilinx primitives in this code.
  25. use IEEE.STD_LOGIC_ARITH.ALL;                   -- library UNISIM;
  26. use IEEE.STD_LOGIC_UNSIGNED.ALL;                -- use UNISIM.VComponents.all;
  27.  
  28.  
  29. entity guigui is                                                                                -- ouverture de la "boîte"
  30.     Port ( clk : in  STD_LOGIC;                                                         -- Declarations
  31.            reset : in  STD_LOGIC;                                                       -- des
  32.               Q : out  Std_logic;                                                           -- variables
  33.               Cpt_H : out Std_logic_vector(9 downto 0);                            
  34.               HS : out  Std_logic);                                                        
  35. end guigui;                                                                                     -- fermeture de la "boîte"
  36.  
  37. architecture Behavioral of guigui is                                                    -- Début architecture
  38. Signal Qint: Std_logic ;                                                                    -- Declarations
  39. Signal a : Std_logic_vector(9 downto 0);                                                --
  40.  
  41. begin                                                                                               -- Début
  42.  
  43.     Q<=Qint;                                                                                        -- Q prend la valeur de Qint
  44.     Cpt_H<=a;                                                                                   -- Compt_H prend la valeur de a
  45.     process (CLK, reset)                                                                        -- début du "sous-programme"
  46.     begin                                                                                           -- Début
  47.         if (reset='1') then Qint<='0';                                                  -- Si reset = 1 alors Qint = 0
  48.         elsif (CLK'event and CLK='1') then Qint<=not(Qint);                         -- Sinon front montant de CLK alors on inverse Qint
  49.         end if;                                                                                
  50.  
  51.     end process;                                                                                -- Fin "sous-programme"
  52.    
  53.  
  54.     process (Qint, reset)                                                                   -- Début du "sous-programme"
  55.         begin                                                                                       -- Début
  56.         if (reset='1') then a<="0000000000";                                            -- Si reset = 1 alors a = 0
  57.         elsif (Qint'event and Qint='1') then                                            -- Sinon front montant de Qint alors
  58.             if (a="1100011111") then a<="0000000000";                                   -- Si a = 799 alors on fixe a = 0
  59.             else a<=a+1;                                                                        -- donc on incremente de 1 la variable a
  60.             end if;                                                                             -- fin de la deuxiéme boucle if
  61.         end if;                                                                                 -- fin de la premiére boucle if
  62.     end process;                                                                                -- fin du "sous-programme"
  63.    
  64. HS<='1' when (a<"0001100000") else '0';                                             -- HS prend la valeur 1 quand a = 48
  65.                            
  66. end Behavioral;                                                                                 -- Fin de architecture
Add Comment
Please, Sign In to add comment