Advertisement
Guest User

Untitled

a guest
Apr 21st, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 11:03:23 04/05/2017
  6. -- Design Name:
  7. -- Module Name: prescaler - 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.  
  23. -- Uncomment the following library declaration if using
  24. -- arithmetic functions with Signed or Unsigned values
  25. --use IEEE.NUMERIC_STD.ALL;
  26.  
  27. -- Uncomment the following library declaration if instantiating
  28. -- any Xilinx primitives in this code.
  29. --library UNISIM;
  30. --use UNISIM.VComponents.all;
  31.  
  32. entity prescaler is
  33. Port ( clk_in : in STD_LOGIC;
  34. clk_out : out STD_LOGIC;
  35. rst : in STD_LOGIC);
  36. end prescaler;
  37.  
  38. architecture Behavioral of prescaler is
  39. signal co : std_logic;
  40. begin
  41. process(clk_in,rst)
  42. variable count: integer range 0 to 25_000_000;
  43. begin
  44. if rst='1' then
  45. co<='0';
  46. count:=0;
  47. elsif clk_in'event and clk_in='1' then
  48. count:=count+1;
  49. if count= 25_000_000 then
  50. count:=0
  51. co <= not co;
  52. end if;
  53. end if;
  54. end process;
  55. clk_out <= co;
  56.  
  57. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement