-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclock_divider.vhd
More file actions
31 lines (28 loc) · 784 Bytes
/
Copy pathclock_divider.vhd
File metadata and controls
31 lines (28 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity clock_divider is
Port (
clk_in : in STD_LOGIC;
reset : in STD_LOGIC;
clk_out: out STD_LOGIC
);
end clock_divider;
architecture Behavioral of clock_divider is
signal temporal: STD_LOGIC;
signal counter : integer range 0 to 24999999 := 0;
begin
frequency_divider: process (reset, clk_in) begin
if (reset = '0') then
temporal <= '0';
counter <= 0;
elsif rising_edge(clk_in) then
if (counter = 24999999) then
temporal <= NOT(temporal);
counter <= 0;
else
counter <= counter + 1;
end if;
end if;
end process;
clk_out <= temporal;
end Behavioral;