1 |
14 |
gedra |
----------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- WISHBONE SPDIF IP Core ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- This file is part of the SPDIF project ----
|
6 |
|
|
---- http://www.opencores.org/cores/spdif_interface/ ----
|
7 |
|
|
---- ----
|
8 |
|
|
---- Description ----
|
9 |
|
|
---- SPDIF receiver component package. ----
|
10 |
|
|
---- ----
|
11 |
|
|
---- ----
|
12 |
|
|
---- To Do: ----
|
13 |
|
|
---- - ----
|
14 |
|
|
---- ----
|
15 |
|
|
---- Author(s): ----
|
16 |
|
|
---- - Geir Drange, gedra@opencores.org ----
|
17 |
|
|
---- ----
|
18 |
|
|
----------------------------------------------------------------------
|
19 |
|
|
---- ----
|
20 |
|
|
---- Copyright (C) 2004 Authors and OPENCORES.ORG ----
|
21 |
|
|
---- ----
|
22 |
|
|
---- This source file may be used and distributed without ----
|
23 |
|
|
---- restriction provided that this copyright statement is not ----
|
24 |
|
|
---- removed from the file and that any derivative work contains ----
|
25 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
26 |
|
|
---- ----
|
27 |
|
|
---- This source file is free software; you can redistribute it ----
|
28 |
|
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
29 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
30 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
31 |
|
|
---- later version. ----
|
32 |
|
|
---- ----
|
33 |
|
|
---- This source is distributed in the hope that it will be ----
|
34 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
35 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
36 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
37 |
|
|
---- details. ----
|
38 |
|
|
---- ----
|
39 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
40 |
|
|
---- Public License along with this source; if not, download it ----
|
41 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
42 |
|
|
---- ----
|
43 |
|
|
----------------------------------------------------------------------
|
44 |
|
|
--
|
45 |
|
|
-- CVS Revision History
|
46 |
|
|
--
|
47 |
|
|
-- $Log: not supported by cvs2svn $
|
48 |
72 |
gedra |
-- Revision 1.9 2004/07/12 17:06:41 gedra
|
49 |
|
|
-- Fixed bug with lock event generation.
|
50 |
|
|
--
|
51 |
42 |
gedra |
-- Revision 1.8 2004/06/27 16:16:55 gedra
|
52 |
|
|
-- Signal renaming and bug fix.
|
53 |
|
|
--
|
54 |
38 |
gedra |
-- Revision 1.7 2004/06/26 14:14:47 gedra
|
55 |
|
|
-- Converted to numeric_std and fixed a few bugs.
|
56 |
|
|
--
|
57 |
37 |
gedra |
-- Revision 1.6 2004/06/23 18:10:17 gedra
|
58 |
|
|
-- Added Wishbone bus cycle decoder.
|
59 |
|
|
--
|
60 |
30 |
gedra |
-- Revision 1.5 2004/06/16 19:03:45 gedra
|
61 |
|
|
-- Changed status reg. declaration
|
62 |
|
|
--
|
63 |
25 |
gedra |
-- Revision 1.4 2004/06/13 18:08:09 gedra
|
64 |
|
|
-- Added frame decoder and sample extractor
|
65 |
|
|
--
|
66 |
19 |
gedra |
-- Revision 1.3 2004/06/10 18:57:36 gedra
|
67 |
|
|
-- Cleaned up lint warnings.
|
68 |
|
|
--
|
69 |
17 |
gedra |
-- Revision 1.2 2004/06/09 19:24:50 gedra
|
70 |
|
|
-- Added dual port ram.
|
71 |
|
|
--
|
72 |
16 |
gedra |
-- Revision 1.1 2004/06/07 18:06:00 gedra
|
73 |
|
|
-- Receiver component declarations.
|
74 |
14 |
gedra |
--
|
75 |
16 |
gedra |
--
|
76 |
72 |
gedra |
|
77 |
14 |
gedra |
library IEEE;
|
78 |
72 |
gedra |
use IEEE.std_logic_1164.all;
|
79 |
14 |
gedra |
|
80 |
|
|
package rx_package is
|
81 |
|
|
|
82 |
|
|
-- type declarations
|
83 |
72 |
gedra |
type bus_array is array (0 to 7) of std_logic_vector(31 downto 0);
|
84 |
14 |
gedra |
|
85 |
|
|
-- components
|
86 |
72 |
gedra |
component rx_ver_reg
|
87 |
|
|
generic (DATA_WIDTH : integer;
|
88 |
|
|
ADDR_WIDTH : integer;
|
89 |
|
|
CH_ST_CAPTURE : integer);
|
90 |
|
|
port (
|
91 |
|
|
ver_rd : in std_logic; -- version register read
|
92 |
|
|
ver_dout : out std_logic_vector(DATA_WIDTH - 1 downto 0)); -- read data
|
93 |
|
|
end component;
|
94 |
14 |
gedra |
|
95 |
72 |
gedra |
component gen_control_reg
|
96 |
|
|
generic (DATA_WIDTH : integer;
|
97 |
|
|
-- note that this vector is (0 to xx), reverse order
|
98 |
|
|
ACTIVE_BIT_MASK : std_logic_vector);
|
99 |
|
|
port (
|
100 |
|
|
clk : in std_logic; -- clock
|
101 |
|
|
rst : in std_logic; -- reset
|
102 |
|
|
ctrl_wr : in std_logic; -- control register write
|
103 |
|
|
ctrl_rd : in std_logic; -- control register read
|
104 |
|
|
ctrl_din : in std_logic_vector(DATA_WIDTH - 1 downto 0);
|
105 |
|
|
ctrl_dout : out std_logic_vector(DATA_WIDTH - 1 downto 0);
|
106 |
|
|
ctrl_bits : out std_logic_vector(DATA_WIDTH - 1 downto 0));
|
107 |
|
|
end component;
|
108 |
14 |
gedra |
|
109 |
72 |
gedra |
component rx_status_reg
|
110 |
|
|
generic (DATA_WIDTH : integer);
|
111 |
|
|
port (
|
112 |
|
|
wb_clk_i : in std_logic; -- clock
|
113 |
|
|
status_rd : in std_logic; -- status register read
|
114 |
|
|
lock : in std_logic; -- signal lock status
|
115 |
|
|
chas : in std_logic; -- channel A or B select
|
116 |
|
|
rx_block_start : in std_logic; -- start of block signal
|
117 |
|
|
ch_data : in std_logic; -- channel status/user data
|
118 |
|
|
cs_a_en : in std_logic; -- channel status ch. A enable
|
119 |
|
|
cs_b_en : in std_logic; -- channel status ch. B enable
|
120 |
|
|
status_dout : out std_logic_vector(DATA_WIDTH - 1 downto 0));
|
121 |
|
|
end component;
|
122 |
14 |
gedra |
|
123 |
72 |
gedra |
component gen_event_reg
|
124 |
|
|
generic (DATA_WIDTH : integer);
|
125 |
|
|
port (
|
126 |
|
|
clk : in std_logic; -- clock
|
127 |
|
|
rst : in std_logic; -- reset
|
128 |
|
|
evt_wr : in std_logic; -- event register write
|
129 |
|
|
evt_rd : in std_logic; -- event register read
|
130 |
|
|
evt_din : in std_logic_vector(DATA_WIDTH - 1 downto 0); -- write data
|
131 |
|
|
event : in std_logic_vector(DATA_WIDTH - 1 downto 0); -- event vector
|
132 |
|
|
evt_mask : in std_logic_vector(DATA_WIDTH - 1 downto 0); -- irq mask
|
133 |
|
|
evt_en : in std_logic; -- irq enable
|
134 |
|
|
evt_dout : out std_logic_vector(DATA_WIDTH - 1 downto 0); -- read data
|
135 |
|
|
evt_irq : out std_logic); -- interrupt request
|
136 |
|
|
end component;
|
137 |
14 |
gedra |
|
138 |
72 |
gedra |
component rx_cap_reg
|
139 |
|
|
port (
|
140 |
|
|
clk : in std_logic; -- clock
|
141 |
|
|
rst : in std_logic; -- reset
|
142 |
|
|
cap_ctrl_wr : in std_logic; -- control register write
|
143 |
|
|
cap_ctrl_rd : in std_logic; -- control register read
|
144 |
|
|
cap_data_rd : in std_logic; -- data register read
|
145 |
|
|
cap_din : in std_logic_vector(31 downto 0); -- write data
|
146 |
|
|
rx_block_start : in std_logic; -- start of block signal
|
147 |
|
|
ch_data : in std_logic; -- channel status/user data
|
148 |
|
|
ud_a_en : in std_logic; -- user data ch. A enable
|
149 |
|
|
ud_b_en : in std_logic; -- user data ch. B enable
|
150 |
|
|
cs_a_en : in std_logic; -- channel status ch. A enable
|
151 |
|
|
cs_b_en : in std_logic; -- channel status ch. B enable
|
152 |
|
|
cap_dout : out std_logic_vector(31 downto 0); -- read data
|
153 |
|
|
cap_evt : out std_logic); -- capture event (interrupt)
|
154 |
|
|
end component;
|
155 |
14 |
gedra |
|
156 |
72 |
gedra |
component rx_phase_det
|
157 |
|
|
generic (WISHBONE_FREQ : natural := 33); -- WishBone frequency in MHz
|
158 |
|
|
port (
|
159 |
|
|
wb_clk_i : in std_logic;
|
160 |
|
|
rxen : in std_logic;
|
161 |
|
|
spdif : in std_logic;
|
162 |
|
|
lock : out std_logic;
|
163 |
|
|
lock_evt : out std_logic; -- lock status change event
|
164 |
|
|
rx_data : out std_logic;
|
165 |
|
|
rx_data_en : out std_logic;
|
166 |
|
|
rx_block_start : out std_logic;
|
167 |
|
|
rx_frame_start : out std_logic;
|
168 |
|
|
rx_channel_a : out std_logic;
|
169 |
|
|
rx_error : out std_logic;
|
170 |
|
|
ud_a_en : out std_logic; -- user data ch. A enable
|
171 |
|
|
ud_b_en : out std_logic; -- user data ch. B enable
|
172 |
|
|
cs_a_en : out std_logic; -- channel status ch. A enable
|
173 |
|
|
cs_b_en : out std_logic); -- channel status ch. B enable);
|
174 |
|
|
end component;
|
175 |
16 |
gedra |
|
176 |
72 |
gedra |
component dpram
|
177 |
|
|
generic (DATA_WIDTH : positive;
|
178 |
|
|
RAM_WIDTH : positive);
|
179 |
|
|
port (
|
180 |
|
|
clk : in std_logic;
|
181 |
|
|
rst : in std_logic; -- reset is optional, not used here
|
182 |
|
|
din : in std_logic_vector(DATA_WIDTH - 1 downto 0);
|
183 |
|
|
wr_en : in std_logic;
|
184 |
|
|
rd_en : in std_logic;
|
185 |
|
|
wr_addr : in std_logic_vector(RAM_WIDTH - 1 downto 0);
|
186 |
|
|
rd_addr : in std_logic_vector(RAM_WIDTH - 1 downto 0);
|
187 |
|
|
dout : out std_logic_vector(DATA_WIDTH - 1 downto 0));
|
188 |
|
|
end component;
|
189 |
19 |
gedra |
|
190 |
72 |
gedra |
component rx_decode
|
191 |
|
|
generic (DATA_WIDTH : integer range 16 to 32;
|
192 |
|
|
ADDR_WIDTH : integer range 8 to 64);
|
193 |
|
|
port (
|
194 |
|
|
wb_clk_i : in std_logic;
|
195 |
|
|
conf_rxen : in std_logic;
|
196 |
|
|
conf_sample : in std_logic;
|
197 |
|
|
conf_valid : in std_logic;
|
198 |
|
|
conf_mode : in std_logic_vector(3 downto 0);
|
199 |
|
|
conf_blken : in std_logic;
|
200 |
|
|
conf_valen : in std_logic;
|
201 |
|
|
conf_useren : in std_logic;
|
202 |
|
|
conf_staten : in std_logic;
|
203 |
|
|
conf_paren : in std_logic;
|
204 |
|
|
lock : in std_logic;
|
205 |
|
|
rx_data : in std_logic;
|
206 |
|
|
rx_data_en : in std_logic;
|
207 |
|
|
rx_block_start : in std_logic;
|
208 |
|
|
rx_frame_start : in std_logic;
|
209 |
|
|
rx_channel_a : in std_logic;
|
210 |
|
|
wr_en : out std_logic;
|
211 |
|
|
wr_addr : out std_logic_vector(ADDR_WIDTH - 2 downto 0);
|
212 |
|
|
wr_data : out std_logic_vector(DATA_WIDTH - 1 downto 0);
|
213 |
|
|
stat_paritya : out std_logic;
|
214 |
|
|
stat_parityb : out std_logic;
|
215 |
|
|
stat_lsbf : out std_logic;
|
216 |
|
|
stat_hsbf : out std_logic);
|
217 |
|
|
end component;
|
218 |
30 |
gedra |
|
219 |
72 |
gedra |
component rx_wb_decoder
|
220 |
|
|
generic (DATA_WIDTH : integer;
|
221 |
|
|
ADDR_WIDTH : integer);
|
222 |
|
|
port (
|
223 |
|
|
wb_clk_i : in std_logic; -- wishbone clock
|
224 |
|
|
wb_rst_i : in std_logic; -- reset signal
|
225 |
|
|
wb_sel_i : in std_logic; -- select input
|
226 |
|
|
wb_stb_i : in std_logic; -- strobe input
|
227 |
|
|
wb_we_i : in std_logic; -- write enable
|
228 |
|
|
wb_cyc_i : in std_logic; -- cycle input
|
229 |
|
|
wb_bte_i : in std_logic_vector(1 downto 0); -- burts type extension
|
230 |
|
|
wb_adr_i : in std_logic_vector(ADDR_WIDTH - 1 downto 0); -- address
|
231 |
|
|
wb_cti_i : in std_logic_vector(2 downto 0); -- cycle type identifier
|
232 |
|
|
data_out : in std_logic_vector(DATA_WIDTH - 1 downto 0); -- internal bus
|
233 |
|
|
wb_ack_o : out std_logic; -- acknowledge
|
234 |
|
|
wb_dat_o : out std_logic_vector(DATA_WIDTH - 1 downto 0); -- data out
|
235 |
|
|
version_rd : out std_logic; -- Version register read
|
236 |
|
|
config_rd : out std_logic; -- Config register read
|
237 |
|
|
config_wr : out std_logic; -- Config register write
|
238 |
|
|
status_rd : out std_logic; -- Status register read
|
239 |
|
|
intmask_rd : out std_logic; -- Interrupt mask register read
|
240 |
|
|
intmask_wr : out std_logic; -- Interrupt mask register write
|
241 |
|
|
intstat_rd : out std_logic; -- Interrupt status register read
|
242 |
|
|
intstat_wr : out std_logic; -- Interrupt status register read
|
243 |
|
|
mem_rd : out std_logic; -- Sample memory read
|
244 |
|
|
mem_addr : out std_logic_vector(ADDR_WIDTH - 2 downto 0); -- memory addr.
|
245 |
|
|
ch_st_cap_rd : out std_logic_vector(7 downto 0); -- Ch. status cap. read
|
246 |
|
|
ch_st_cap_wr : out std_logic_vector(7 downto 0); -- Ch. status cap. write
|
247 |
|
|
ch_st_data_rd : out std_logic_vector(7 downto 0)); -- Ch. status data read
|
248 |
|
|
end component;
|
249 |
37 |
gedra |
|
250 |
14 |
gedra |
end rx_package;
|