OpenCores
URL https://opencores.org/ocsvn/i2sparalell/i2sparalell/trunk

Subversion Repositories i2sparalell

[/] [i2sparalell/] [trunk/] [Clocks.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 franksdeve
library IEEE;
2
use IEEE.STD_LOGIC_1164.ALL;
3
use IEEE.STD_LOGIC_ARITH.ALL;
4
use IEEE.STD_LOGIC_UNSIGNED.ALL;
5
 
6
--  Uncomment the following lines to use the declarations that are
7
--  provided for instantiating Xilinx primitive components.
8
--library UNISIM;
9
--use UNISIM.VComponents.all;
10
 
11
entity ClocksPorts is
12
    port (
13
                                Xtal :  in std_logic; --main system oscillator
14
                                LRClk : out std_logic; --LR clock for analog serial bus
15
                                SClk : out std_logic; --Serial Bit clock for analog serial bus
16
                                MClk : out std_logic--; --Master clock for analog serial bus (runs DeltaSig hardware in converters)
17
                );
18
end ClocksPorts;
19
 
20
architecture Clocks of ClocksPorts is
21
 
22
        signal XtalDiv : std_logic_vector(3 downto 0);
23
        signal div256 : std_logic_vector(8 downto 0);
24
 
25
begin
26
 
27
        MClk <= div256(0); --run at mclk (XtalDiv/2)
28
        SClk <= div256(2); --divide MCLK by 4 to Get SCLK (64*Fs)               
29
        LRClk <= div256(8); --divide MCLK by 256 to Get LRCLK (1*Fs)
30
 
31
        process (Xtal)
32
 
33
                begin
34
 
35
                if (Xtal'event and Xtal = '1') then
36
 
37
                        --the following divider calculations assume a Xtal input of 25MHz:
38
                        XtalDiv <= XtalDiv + "0001";
39
                        --if (XtalDiv = "1001") then --9: divide by 10 -> fs=4.833kHz
40
                        if (XtalDiv = "0101") then --5: divide by 6 -> fs=8.137kHz
41
                        --if (XtalDiv = "0100") then --4: divide by 5 -> fs=9.766kHz
42
                        --if (XtalDiv = "0011") then --3: divide by 4 -> fs=12kHz
43
                        --if (XtalDiv = "0010") then --2: divide by 3 -> fs=16kHz
44
                        --if (XtalDiv = "0001") then --1: divide by 2 -> fs=32kHz
45
                        --if 'this divider removed              : divide by 1 -> fs=48kHz                                               
46
 
47
                                --reset master divide counter
48
                                XtalDiv <= "0000";
49
 
50
                                --drive other dividers...
51
                                div256 <= div256 + "000000001";
52
 
53
                        end if; -- if (XtalDiv = ...
54
 
55
                end if; --if (Xtal'event ...
56
 
57
        end process;
58
 
59
end Clocks;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.