Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.std_logic_1164.ALL;
  3.  
  4. --entity--
  5. entity clock_ex is
  6. -- nothing inside because is only an example of clock process VS clock event
  7. end clock_ex;
  8.  
  9. -- Architecture --
  10.  
  11. architecture CLKEX of clock_ex is
  12.  
  13. signal clk_p: std_logic :='0'; -- clock for process 2ns semiperiod
  14. signal clk_e: std_logic :='0'; -- clock for event 1 ns
  15.  
  16. begin
  17.  
  18. clk_e <= not clk_e after 1 ns; -- change in the clock trough event
  19. process
  20. begin
  21. clk_p <= not clk_p; -- change in the clock trough process
  22. wait for 2 ns;
  23. end process;
  24.  
  25. end;
  26.  
  27. process
  28. variable stop_s: integer :=100; -- to stop the process
  29. variable count_s: integer :=0; -- counter integer
  30. begin
  31. if(count_s < stop_s) then
  32. clk_p <= not clk_p; -- change in the clock trough process
  33. count_s:= count_s+1; -- change in the clock trough event
  34. wait for 2 ns;
  35. end if;
  36. end process;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement