-
Notifications
You must be signed in to change notification settings - Fork 0
/
clkdiv.vhd
49 lines (40 loc) · 940 Bytes
/
clkdiv.vhd
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
-- Filename:
-- clkdiv.vhd
-- Description:
-- Asynchrnous clock divider
-- Author:
-- Code provided by industry partner
-- Date:
-- December 2020
-- Available on GitHub:
-- https://github.com/kcranky/IEEE1722CRFImplementation
-- Licence:
-- MIT
-- https://github.com/kcranky/IEEE1722CRFImplementation/blob/main/LICENSE
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity aclkdiv is
port (
clk : in std_logic;
div2 : out std_logic;
div4 : out std_logic;
div8 : out std_logic;
div256 : out std_logic;
div512 : out std_logic);
end entity aclkdiv;
architecture rtl of aclkdiv is
begin
process (clk)
variable cnt : std_logic_vector(8 downto 0) := (others => '0');
begin
if rising_edge(clk) then
cnt := std_logic_vector(unsigned(cnt) + 1);
div512 <= cnt(8);
div256 <= cnt(7);
div8 <= cnt(2);
div4 <= cnt(1);
div2 <= cnt(0);
end if;
end process;
end architecture;