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

Subversion Repositories i2sparalell

[/] [i2sparalell/] [trunk/] [I2SParalell.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
 
7
--This has been tested on a Xilinx XC2C256 (Coolrunner-II 256) with 
8
-- Cirrus CS5340 ADC's and CS4334 DAC's connected to an Atmel AVR AtMega128L uC.
9
 
10
entity I2SParalellPorts is
11
    port (
12
                                Xtal : in std_logic;
13
 
14
                                --analog bus ports                                                                                                              
15
                                AdcData : in std_logic;
16
                                DacData : out std_logic;
17
                                LRClk : out std_logic;
18
                                SClk : out std_logic;
19
                                MClk : out std_logic;
20
 
21
                                --digital bus ports
22
                                ADCSampleBus : out std_logic_vector(23 downto 0);
23
                                DACSampleBus : in std_logic_vector(23 downto 0);
24
                                LDataStrobe : out std_logic;
25
                                RDataStrobe : out std_logic;
26
 
27
                                --debug port
28
                                nDebugLoopBack : in std_logic --;
29
                );
30
end I2SParalellPorts;
31
 
32
architecture I2SParalell of I2SParalellPorts is
33
 
34
        component ClocksPorts
35
        port (
36
                Xtal :  in std_logic; --main system oscillator   
37
                LRClk : out std_logic; --LR clock for analog serial bus
38
                SClk : out std_logic; --Serial Bit clock for analog serial bus
39
                MClk : out std_logic--; --Master clock for analog serial bus (runs DeltaSig hardware in converters)
40
        );
41
        end component;
42
 
43
        component AnalogBusPorts
44
        port (
45
                SClk : in std_logic;     --this whole schebang runs of the analog serial bus clock
46
                LRClk : in std_logic;    --which channel at the moment?
47
                AdcData : in std_logic;  --data coming in from adc
48
                DacData : out std_logic;         --data coming in from adc
49
                SampleStrobe : out std_logic;                                            --dump the contents of FifoData into the fifo on next clock
50
                nSampleStrobe : out std_logic;                                           --dump the contents of FifoData into the fifo on next clock
51
                LastAdcSample : out std_logic_vector(23 downto 0);    --buffer for fifo data                
52
                NextDacSample : in std_logic_vector(23 downto 0)--;    --buffer for fifo data               
53
        );
54
        end component;
55
 
56
        signal LRClk_i : std_logic;
57
        signal SClk_i  : std_logic;
58
        signal DacData_e  : std_logic;
59
        signal DacData_i  : std_logic;
60
 
61
        --signal count : std_logic_vector(24 downto 0);
62
 
63
begin
64
 
65
        Clocks: ClocksPorts
66
        port map (
67
                        Xtal=>Xtal,
68
                        LRClk=>LRClk_i,
69
                        SClk=>SClk_i,
70
                        MClk=>MClk--,
71
        );
72
 
73
        AnalogBus: AnalogBusPorts
74
        port map (
75
                        SClk=>SClk_i,
76
                        LRClk=>LRClk_i,
77
                        AdcData=>AdcData,
78
                        DacData=>DacData_e,
79
                        SampleStrobe=>LDataStrobe,
80
                        nSampleStrobe=>RDataStrobe,
81
                        LastAdcSample=>ADCSampleBus,
82
                        NextDacSample=>DACSampleBus--,                     
83
        );
84
 
85
        LRClk <= LRClk_i;
86
        SClk <= SClk_i;
87
        DacData <= DacData_i;
88
 
89
        process (Xtal)
90
 
91
        begin
92
 
93
                if (Xtal'event and Xtal = '1') then
94
 
95
                        if (nDebugLoopBack = '0') then
96
 
97
                                DacData_i <= AdcData;
98
 
99
                        else
100
 
101
                                DacData_i <= DacData_e;
102
 
103
                        end if;
104
 
105
                end if; --if (Xtal'event ...
106
 
107
        end process;
108
 
109
end I2SParalell;

powered by: WebSVN 2.1.0

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