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 |
42 |
gedra |
-- Revision 1.8 2004/06/27 16:16:55 gedra
|
49 |
|
|
-- Signal renaming and bug fix.
|
50 |
|
|
--
|
51 |
38 |
gedra |
-- Revision 1.7 2004/06/26 14:14:47 gedra
|
52 |
|
|
-- Converted to numeric_std and fixed a few bugs.
|
53 |
|
|
--
|
54 |
37 |
gedra |
-- Revision 1.6 2004/06/23 18:10:17 gedra
|
55 |
|
|
-- Added Wishbone bus cycle decoder.
|
56 |
|
|
--
|
57 |
30 |
gedra |
-- Revision 1.5 2004/06/16 19:03:45 gedra
|
58 |
|
|
-- Changed status reg. declaration
|
59 |
|
|
--
|
60 |
25 |
gedra |
-- Revision 1.4 2004/06/13 18:08:09 gedra
|
61 |
|
|
-- Added frame decoder and sample extractor
|
62 |
|
|
--
|
63 |
19 |
gedra |
-- Revision 1.3 2004/06/10 18:57:36 gedra
|
64 |
|
|
-- Cleaned up lint warnings.
|
65 |
|
|
--
|
66 |
17 |
gedra |
-- Revision 1.2 2004/06/09 19:24:50 gedra
|
67 |
|
|
-- Added dual port ram.
|
68 |
|
|
--
|
69 |
16 |
gedra |
-- Revision 1.1 2004/06/07 18:06:00 gedra
|
70 |
|
|
-- Receiver component declarations.
|
71 |
14 |
gedra |
--
|
72 |
16 |
gedra |
--
|
73 |
14 |
gedra |
|
74 |
|
|
library IEEE;
|
75 |
|
|
use IEEE.std_logic_1164.all;
|
76 |
|
|
|
77 |
|
|
package rx_package is
|
78 |
|
|
|
79 |
|
|
-- type declarations
|
80 |
|
|
type bus_array is array (0 to 7) of std_logic_vector(31 downto 0);
|
81 |
|
|
|
82 |
|
|
-- components
|
83 |
|
|
component rx_ver_reg
|
84 |
|
|
generic (DATA_WIDTH: integer;
|
85 |
|
|
ADDR_WIDTH: integer;
|
86 |
|
|
CH_ST_CAPTURE: integer);
|
87 |
|
|
port (
|
88 |
|
|
ver_rd: in std_logic; -- version register read
|
89 |
|
|
ver_dout: out std_logic_vector(DATA_WIDTH - 1 downto 0)); -- read data
|
90 |
|
|
end component;
|
91 |
|
|
|
92 |
|
|
component gen_control_reg
|
93 |
|
|
generic (DATA_WIDTH: integer;
|
94 |
|
|
-- note that this vector is (0 to xx), reverse order
|
95 |
|
|
ACTIVE_BIT_MASK: std_logic_vector);
|
96 |
|
|
port (
|
97 |
|
|
clk: in std_logic; -- clock
|
98 |
|
|
rst: in std_logic; -- reset
|
99 |
|
|
ctrl_wr: in std_logic; -- control register write
|
100 |
|
|
ctrl_rd: in std_logic; -- control register read
|
101 |
|
|
ctrl_din: in std_logic_vector(DATA_WIDTH - 1 downto 0);
|
102 |
|
|
ctrl_dout: out std_logic_vector(DATA_WIDTH - 1 downto 0);
|
103 |
|
|
ctrl_bits: out std_logic_vector(DATA_WIDTH - 1 downto 0));
|
104 |
|
|
end component;
|
105 |
|
|
|
106 |
|
|
component rx_status_reg
|
107 |
|
|
generic (DATA_WIDTH: integer);
|
108 |
|
|
port (
|
109 |
25 |
gedra |
wb_clk_i: in std_logic; -- clock
|
110 |
14 |
gedra |
status_rd: in std_logic; -- status register read
|
111 |
25 |
gedra |
lock: in std_logic; -- signal lock status
|
112 |
|
|
chas: in std_logic; -- channel A or B select
|
113 |
38 |
gedra |
rx_block_start: in std_logic; -- start of block signal
|
114 |
25 |
gedra |
ch_data: in std_logic; -- channel status/user data
|
115 |
|
|
cs_a_en: in std_logic; -- channel status ch. A enable
|
116 |
|
|
cs_b_en: in std_logic; -- channel status ch. B enable
|
117 |
|
|
status_dout: out std_logic_vector(DATA_WIDTH - 1 downto 0));
|
118 |
14 |
gedra |
end component;
|
119 |
|
|
|
120 |
|
|
component gen_event_reg
|
121 |
|
|
generic (DATA_WIDTH: integer);
|
122 |
|
|
port (
|
123 |
|
|
clk: in std_logic; -- clock
|
124 |
|
|
rst: in std_logic; -- reset
|
125 |
|
|
evt_wr: in std_logic; -- event register write
|
126 |
|
|
evt_rd: in std_logic; -- event register read
|
127 |
|
|
evt_din: in std_logic_vector(DATA_WIDTH - 1 downto 0); -- write data
|
128 |
|
|
event: in std_logic_vector(DATA_WIDTH - 1 downto 0); -- event vector
|
129 |
|
|
evt_mask: in std_logic_vector(DATA_WIDTH - 1 downto 0); -- irq mask
|
130 |
|
|
evt_en: in std_logic; -- irq enable
|
131 |
|
|
evt_dout: out std_logic_vector(DATA_WIDTH - 1 downto 0); -- read data
|
132 |
|
|
evt_irq: out std_logic); -- interrupt request
|
133 |
|
|
end component;
|
134 |
|
|
|
135 |
|
|
component rx_cap_reg
|
136 |
|
|
port (
|
137 |
|
|
clk: in std_logic; -- clock
|
138 |
|
|
rst: in std_logic; -- reset
|
139 |
|
|
cap_ctrl_wr: in std_logic; -- control register write
|
140 |
|
|
cap_ctrl_rd: in std_logic; -- control register read
|
141 |
|
|
cap_data_rd: in std_logic; -- data register read
|
142 |
|
|
cap_din: in std_logic_vector(31 downto 0); -- write data
|
143 |
38 |
gedra |
rx_block_start: in std_logic; -- start of block signal
|
144 |
14 |
gedra |
ch_data: in std_logic; -- channel status/user data
|
145 |
|
|
ud_a_en: in std_logic; -- user data ch. A enable
|
146 |
|
|
ud_b_en: in std_logic; -- user data ch. B enable
|
147 |
|
|
cs_a_en: in std_logic; -- channel status ch. A enable
|
148 |
|
|
cs_b_en: in std_logic; -- channel status ch. B enable
|
149 |
|
|
cap_dout: out std_logic_vector(31 downto 0); -- read data
|
150 |
|
|
cap_evt: out std_logic); -- capture event (interrupt)
|
151 |
|
|
end component;
|
152 |
|
|
|
153 |
|
|
component rx_phase_det
|
154 |
19 |
gedra |
generic (WISHBONE_FREQ: natural := 33); -- WishBone frequency in MHz
|
155 |
14 |
gedra |
port (
|
156 |
|
|
wb_clk_i: in std_logic;
|
157 |
|
|
rxen: in std_logic;
|
158 |
|
|
spdif: in std_logic;
|
159 |
|
|
lock: out std_logic;
|
160 |
42 |
gedra |
lock_evt: out std_logic; -- lock status change event
|
161 |
14 |
gedra |
rx_data: out std_logic;
|
162 |
|
|
rx_data_en: out std_logic;
|
163 |
|
|
rx_block_start: out std_logic;
|
164 |
|
|
rx_frame_start: out std_logic;
|
165 |
|
|
rx_channel_a: out std_logic;
|
166 |
|
|
rx_error: out std_logic;
|
167 |
|
|
ud_a_en: out std_logic; -- user data ch. A enable
|
168 |
|
|
ud_b_en: out std_logic; -- user data ch. B enable
|
169 |
|
|
cs_a_en: out std_logic; -- channel status ch. A enable
|
170 |
|
|
cs_b_en: out std_logic); -- channel status ch. B enable);
|
171 |
|
|
end component;
|
172 |
16 |
gedra |
|
173 |
|
|
component dpram
|
174 |
|
|
generic (DATA_WIDTH: positive;
|
175 |
17 |
gedra |
RAM_WIDTH: positive);
|
176 |
16 |
gedra |
port (
|
177 |
|
|
clk: in std_logic;
|
178 |
|
|
rst: in std_logic; -- reset is optional, not used here
|
179 |
|
|
din: in std_logic_vector(DATA_WIDTH - 1 downto 0);
|
180 |
|
|
wr_en: in std_logic;
|
181 |
|
|
rd_en: in std_logic;
|
182 |
17 |
gedra |
wr_addr: in std_logic_vector(RAM_WIDTH - 1 downto 0);
|
183 |
|
|
rd_addr: in std_logic_vector(RAM_WIDTH - 1 downto 0);
|
184 |
16 |
gedra |
dout: out std_logic_vector(DATA_WIDTH - 1 downto 0));
|
185 |
19 |
gedra |
end component;
|
186 |
|
|
|
187 |
|
|
component rx_decode
|
188 |
|
|
generic (DATA_WIDTH: integer range 16 to 32;
|
189 |
|
|
ADDR_WIDTH: integer range 8 to 64);
|
190 |
|
|
port (
|
191 |
|
|
wb_clk_i: in std_logic;
|
192 |
|
|
conf_rxen: in std_logic;
|
193 |
|
|
conf_sample: in std_logic;
|
194 |
|
|
conf_valid: in std_logic;
|
195 |
|
|
conf_mode: in std_logic_vector(3 downto 0);
|
196 |
|
|
conf_blken: in std_logic;
|
197 |
|
|
conf_valen: in std_logic;
|
198 |
|
|
conf_useren: in std_logic;
|
199 |
|
|
conf_staten: in std_logic;
|
200 |
|
|
conf_paren: in std_logic;
|
201 |
|
|
lock: in std_logic;
|
202 |
|
|
rx_data: in std_logic;
|
203 |
|
|
rx_data_en: in std_logic;
|
204 |
|
|
rx_block_start: in std_logic;
|
205 |
|
|
rx_frame_start: in std_logic;
|
206 |
|
|
rx_channel_a: in std_logic;
|
207 |
|
|
wr_en: out std_logic;
|
208 |
|
|
wr_addr: out std_logic_vector(ADDR_WIDTH - 2 downto 0);
|
209 |
37 |
gedra |
wr_data: out std_logic_vector(DATA_WIDTH - 1 downto 0);
|
210 |
19 |
gedra |
stat_paritya: out std_logic;
|
211 |
|
|
stat_parityb: out std_logic;
|
212 |
|
|
stat_lsbf: out std_logic;
|
213 |
|
|
stat_hsbf: out std_logic);
|
214 |
|
|
end component;
|
215 |
30 |
gedra |
|
216 |
|
|
component rx_wb_decoder
|
217 |
|
|
generic (DATA_WIDTH: integer;
|
218 |
|
|
ADDR_WIDTH: integer);
|
219 |
|
|
port (
|
220 |
|
|
wb_clk_i: in std_logic; -- wishbone clock
|
221 |
|
|
wb_rst_i: in std_logic; -- reset signal
|
222 |
|
|
wb_sel_i: in std_logic; -- select input
|
223 |
|
|
wb_stb_i: in std_logic; -- strobe input
|
224 |
|
|
wb_we_i: in std_logic; -- write enable
|
225 |
|
|
wb_cyc_i: in std_logic; -- cycle input
|
226 |
|
|
wb_bte_i: in std_logic_vector(1 downto 0); -- burts type extension
|
227 |
|
|
wb_adr_i: in std_logic_vector(ADDR_WIDTH - 1 downto 0); -- address
|
228 |
|
|
wb_cti_i: in std_logic_vector(2 downto 0); -- cycle type identifier
|
229 |
|
|
data_out: in std_logic_vector(DATA_WIDTH - 1 downto 0); -- internal bus
|
230 |
|
|
wb_ack_o: out std_logic; -- acknowledge
|
231 |
|
|
wb_dat_o: out std_logic_vector(DATA_WIDTH - 1 downto 0); -- data out
|
232 |
|
|
version_rd: out std_logic; -- Version register read
|
233 |
|
|
config_rd: out std_logic; -- Config register read
|
234 |
|
|
config_wr: out std_logic; -- Config register write
|
235 |
|
|
status_rd: out std_logic; -- Status register read
|
236 |
|
|
intmask_rd: out std_logic; -- Interrupt mask register read
|
237 |
|
|
intmask_wr: out std_logic; -- Interrupt mask register write
|
238 |
|
|
intstat_rd: out std_logic; -- Interrupt status register read
|
239 |
|
|
intstat_wr: out std_logic; -- Interrupt status register read
|
240 |
|
|
mem_rd: out std_logic; -- Sample memory read
|
241 |
|
|
mem_addr: out std_logic_vector(ADDR_WIDTH - 2 downto 0); -- memory addr.
|
242 |
|
|
ch_st_cap_rd: out std_logic_vector(7 downto 0); -- Ch. status cap. read
|
243 |
|
|
ch_st_cap_wr: out std_logic_vector(7 downto 0); -- Ch. status cap. write
|
244 |
|
|
ch_st_data_rd: out std_logic_vector(7 downto 0)); -- Ch. status data read
|
245 |
|
|
end component;
|
246 |
37 |
gedra |
|
247 |
14 |
gedra |
end rx_package;
|