Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 13:37:55 06/13/2016
  6. -- Design Name:
  7. -- Module Name: dzielnik - 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. use IEEE.STD_LOGIC_ARITH.ALL;
  23. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  24.  
  25. ---- Uncomment the following library declaration if instantiating
  26. ---- any Xilinx primitives in this code.
  27. --library UNISIM;
  28. --use UNISIM.VComponents.all;
  29.  
  30. entity dzielnik is
  31. generic (N : integer := 25_000_000);
  32. Port ( clk_in : in STD_LOGIC;
  33. reset : in STD_LOGIC;
  34. clk_out : out STD_LOGIC);
  35. end dzielnik;
  36.  
  37. architecture Behavioral of dzielnik is
  38.  
  39. signal temp: STD_LOGIC;
  40. signal licznik : integer range 0 to N := 0;
  41.  
  42. begin
  43.  
  44. dzielnik: process (reset, clk_in) begin
  45. if (reset = '1') then
  46. temp <= '0';
  47. licznik <= 0;
  48. elsif rising_edge(clk_in) then
  49. if (licznik = N) then
  50. temp <= NOT(temp);
  51. licznik <= 0;
  52. else
  53. licznik <= licznik + 1;
  54. end if;
  55. end if;
  56. end process;
  57.  
  58. clk_out <= temp;
  59.  
  60. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement