1 |
10 |
gedra |
----------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- WISHBONE I2S Interface IP Core ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- This file is part of the I2S Interface project ----
|
6 |
|
|
---- http://www.opencores.org/cores/i2s_interface/ ----
|
7 |
|
|
---- ----
|
8 |
|
|
---- Description ----
|
9 |
|
|
---- I2S receiver component declarations. ----
|
10 |
|
|
---- ----
|
11 |
|
|
---- To Do: ----
|
12 |
|
|
---- - ----
|
13 |
|
|
---- ----
|
14 |
|
|
---- Author(s): ----
|
15 |
|
|
---- - Geir Drange, gedra@opencores.org ----
|
16 |
|
|
---- ----
|
17 |
|
|
----------------------------------------------------------------------
|
18 |
|
|
---- ----
|
19 |
|
|
---- Copyright (C) 2004 Authors and OPENCORES.ORG ----
|
20 |
|
|
---- ----
|
21 |
|
|
---- This source file may be used and distributed without ----
|
22 |
|
|
---- restriction provided that this copyright statement is not ----
|
23 |
|
|
---- removed from the file and that any derivative work contains ----
|
24 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
25 |
|
|
---- ----
|
26 |
|
|
---- This source file is free software; you can redistribute it ----
|
27 |
|
|
---- and/or modify it under the terms of the GNU General ----
|
28 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
29 |
|
|
---- either version 2.0 of the License, or (at your option) any ----
|
30 |
|
|
---- later version. ----
|
31 |
|
|
---- ----
|
32 |
|
|
---- This source is distributed in the hope that it will be ----
|
33 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
34 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
35 |
18 |
gedra |
---- PURPOSE. See the GNU General Public License for more details.----
|
36 |
10 |
gedra |
---- ----
|
37 |
|
|
---- You should have received a copy of the GNU General ----
|
38 |
|
|
---- Public License along with this source; if not, download it ----
|
39 |
|
|
---- from http://www.gnu.org/licenses/gpl.txt ----
|
40 |
|
|
---- ----
|
41 |
|
|
----------------------------------------------------------------------
|
42 |
|
|
--
|
43 |
|
|
-- CVS Revision History
|
44 |
|
|
--
|
45 |
|
|
-- $Log: not supported by cvs2svn $
|
46 |
24 |
gedra |
-- Revision 1.2 2004/08/06 18:55:43 gedra
|
47 |
|
|
-- De-linting.
|
48 |
|
|
--
|
49 |
18 |
gedra |
-- Revision 1.1 2004/08/04 14:28:54 gedra
|
50 |
|
|
-- Receiver component declarations.
|
51 |
10 |
gedra |
--
|
52 |
|
|
--
|
53 |
18 |
gedra |
--
|
54 |
24 |
gedra |
|
55 |
10 |
gedra |
library ieee;
|
56 |
24 |
gedra |
use ieee.std_logic_1164.all;
|
57 |
10 |
gedra |
|
58 |
|
|
package rx_i2s_pack is
|
59 |
|
|
|
60 |
|
|
-- components used in the receiver
|
61 |
24 |
gedra |
|
62 |
|
|
component gen_control_reg
|
63 |
|
|
generic (DATA_WIDTH : integer;
|
64 |
|
|
-- note that this vector is (0 to xx), reverse order
|
65 |
|
|
ACTIVE_BIT_MASK : std_logic_vector);
|
66 |
|
|
port (
|
67 |
|
|
clk : in std_logic; -- clock
|
68 |
|
|
rst : in std_logic; -- reset
|
69 |
|
|
ctrl_wr : in std_logic; -- control register write
|
70 |
|
|
ctrl_rd : in std_logic; -- control register read
|
71 |
|
|
ctrl_din : in std_logic_vector(DATA_WIDTH - 1 downto 0);
|
72 |
|
|
ctrl_dout : out std_logic_vector(DATA_WIDTH - 1 downto 0);
|
73 |
|
|
ctrl_bits : out std_logic_vector(DATA_WIDTH - 1 downto 0));
|
74 |
|
|
end component;
|
75 |
10 |
gedra |
|
76 |
24 |
gedra |
component gen_event_reg
|
77 |
|
|
generic (DATA_WIDTH : integer);
|
78 |
|
|
port (
|
79 |
|
|
clk : in std_logic; -- clock
|
80 |
|
|
rst : in std_logic; -- reset
|
81 |
|
|
evt_wr : in std_logic; -- event register write
|
82 |
|
|
evt_rd : in std_logic; -- event register read
|
83 |
|
|
evt_din : in std_logic_vector(DATA_WIDTH - 1 downto 0); -- write data
|
84 |
|
|
event : in std_logic_vector(DATA_WIDTH - 1 downto 0); -- event vector
|
85 |
|
|
evt_mask : in std_logic_vector(DATA_WIDTH - 1 downto 0); -- irq mask
|
86 |
|
|
evt_en : in std_logic; -- irq enable
|
87 |
|
|
evt_dout : out std_logic_vector(DATA_WIDTH - 1 downto 0); -- read data
|
88 |
|
|
evt_irq : out std_logic); -- interrupt request
|
89 |
|
|
end component;
|
90 |
10 |
gedra |
|
91 |
24 |
gedra |
component dpram
|
92 |
|
|
generic (DATA_WIDTH : positive;
|
93 |
|
|
RAM_WIDTH : positive);
|
94 |
|
|
port (
|
95 |
|
|
clk : in std_logic;
|
96 |
|
|
rst : in std_logic; -- reset is optional, not used here
|
97 |
|
|
din : in std_logic_vector(DATA_WIDTH - 1 downto 0);
|
98 |
|
|
wr_en : in std_logic;
|
99 |
|
|
rd_en : in std_logic;
|
100 |
|
|
wr_addr : in std_logic_vector(RAM_WIDTH - 1 downto 0);
|
101 |
|
|
rd_addr : in std_logic_vector(RAM_WIDTH - 1 downto 0);
|
102 |
|
|
dout : out std_logic_vector(DATA_WIDTH - 1 downto 0));
|
103 |
|
|
end component;
|
104 |
10 |
gedra |
|
105 |
24 |
gedra |
component i2s_version
|
106 |
|
|
generic (DATA_WIDTH : integer;
|
107 |
|
|
ADDR_WIDTH : integer;
|
108 |
|
|
IS_MASTER : integer);
|
109 |
|
|
port (
|
110 |
|
|
ver_rd : in std_logic; -- version register read
|
111 |
|
|
ver_dout : out std_logic_vector(DATA_WIDTH - 1 downto 0));
|
112 |
|
|
end component;
|
113 |
10 |
gedra |
|
114 |
24 |
gedra |
component rx_i2s_wbd
|
115 |
|
|
generic (DATA_WIDTH : integer;
|
116 |
|
|
ADDR_WIDTH : integer);
|
117 |
|
|
port (
|
118 |
|
|
wb_clk_i : in std_logic; -- wishbone clock
|
119 |
|
|
wb_rst_i : in std_logic; -- reset signal
|
120 |
|
|
wb_sel_i : in std_logic; -- select input
|
121 |
|
|
wb_stb_i : in std_logic; -- strobe input
|
122 |
|
|
wb_we_i : in std_logic; -- write enable
|
123 |
|
|
wb_cyc_i : in std_logic; -- cycle input
|
124 |
|
|
wb_bte_i : in std_logic_vector(1 downto 0); -- burts type extension
|
125 |
|
|
wb_cti_i : in std_logic_vector(2 downto 0); -- cycle type identifier
|
126 |
|
|
wb_adr_i : in std_logic_vector(ADDR_WIDTH - 1 downto 0); -- address
|
127 |
|
|
data_out : in std_logic_vector(DATA_WIDTH - 1 downto 0); -- internal bus
|
128 |
|
|
wb_ack_o : out std_logic; -- acknowledge
|
129 |
|
|
wb_dat_o : out std_logic_vector(DATA_WIDTH - 1 downto 0); -- data out
|
130 |
|
|
version_rd : out std_logic; -- Version register read
|
131 |
|
|
config_rd : out std_logic; -- Config register read
|
132 |
|
|
config_wr : out std_logic; -- Config register write
|
133 |
|
|
intmask_rd : out std_logic; -- Interrupt mask register read
|
134 |
|
|
intmask_wr : out std_logic; -- Interrupt mask register write
|
135 |
|
|
intstat_rd : out std_logic; -- Interrupt status register read
|
136 |
|
|
intstat_wr : out std_logic; -- Interrupt status register read
|
137 |
|
|
mem_rd : out std_logic; -- Sample memory write
|
138 |
|
|
mem_addr : out std_logic_vector(ADDR_WIDTH - 2 downto 0)); -- memory addr.
|
139 |
|
|
end component;
|
140 |
10 |
gedra |
|
141 |
24 |
gedra |
component i2s_codec
|
142 |
|
|
generic (DATA_WIDTH : integer;
|
143 |
|
|
ADDR_WIDTH : integer;
|
144 |
|
|
IS_MASTER : integer range 0 to 1;
|
145 |
|
|
IS_RECEIVER : integer range 0 to 1);
|
146 |
|
|
port (
|
147 |
|
|
wb_clk_i : in std_logic; -- wishbone clock
|
148 |
|
|
conf_res : in std_logic_vector(5 downto 0); -- sample resolution
|
149 |
|
|
conf_ratio : in std_logic_vector(7 downto 0); -- clock divider ratio
|
150 |
|
|
conf_swap : in std_logic; -- left/right sample order
|
151 |
|
|
conf_en : in std_logic; -- transmitter/recevier enable
|
152 |
|
|
i2s_sd_i : in std_logic; -- I2S serial data input
|
153 |
|
|
i2s_sck_i : in std_logic; -- I2S clock input
|
154 |
|
|
i2s_ws_i : in std_logic; -- I2S word select input
|
155 |
|
|
sample_dat_i : in std_logic_vector(DATA_WIDTH - 1 downto 0); -- audio data
|
156 |
|
|
sample_dat_o : out std_logic_vector(DATA_WIDTH - 1 downto 0); -- audio data
|
157 |
|
|
mem_rdwr : out std_logic; -- sample buffer read/write
|
158 |
|
|
sample_addr : out std_logic_vector(ADDR_WIDTH - 2 downto 0); -- address
|
159 |
|
|
evt_hsbf : out std_logic; -- higher sample buf empty event
|
160 |
|
|
evt_lsbf : out std_logic; -- lower sample buf empty event
|
161 |
|
|
i2s_sd_o : out std_logic; -- I2S serial data output
|
162 |
|
|
i2s_sck_o : out std_logic; -- I2S clock output
|
163 |
|
|
i2s_ws_o : out std_logic); -- I2S word select output
|
164 |
|
|
end component;
|
165 |
|
|
|
166 |
10 |
gedra |
end rx_i2s_pack;
|