1 |
6 |
root |
library ieee;
|
2 |
|
|
use ieee.std_logic_1164.all;
|
3 |
|
|
use ieee.std_logic_unsigned.all;
|
4 |
|
|
|
5 |
|
|
entity madi_receiver is
|
6 |
|
|
port(
|
7 |
|
|
clk_125_in : in std_logic;
|
8 |
|
|
madi_in : in std_logic;
|
9 |
|
|
|
10 |
|
|
madi_write : out std_logic;
|
11 |
|
|
madi_wordclock : out std_logic;
|
12 |
|
|
madi_channel : out std_logic_vector(5 downto 0) := (others => '0');
|
13 |
|
|
madi_data : out std_logic_vector(23 downto 0) := (others => '0')
|
14 |
|
|
);
|
15 |
|
|
end madi_receiver;
|
16 |
|
|
|
17 |
|
|
architecture behavioral of madi_receiver is
|
18 |
|
|
type nibble_buffer is array(7 downto 0) of std_logic_vector(3 downto 0);
|
19 |
|
|
|
20 |
|
|
signal madi_nrzi_shift : std_logic_vector(1 downto 0);
|
21 |
|
|
signal madi_nrzi_data : std_logic;
|
22 |
|
|
signal madi_sync_shift : std_logic_vector(9 downto 0);
|
23 |
|
|
signal madi_sync_count : std_logic_vector(2 downto 0);
|
24 |
|
|
signal madi_sync_clk : std_logic;
|
25 |
|
|
signal madi_symbol : std_logic_vector(4 downto 0);
|
26 |
|
|
signal madi_nibble_clk : std_logic;
|
27 |
|
|
signal madi_nibble : std_logic_vector(3 downto 0);
|
28 |
|
|
signal madi_nibble_cnt : std_logic_vector(2 downto 0);
|
29 |
|
|
signal madi_nibble_buffer : nibble_buffer;
|
30 |
|
|
signal madi_nibble_rst : std_logic;
|
31 |
|
|
signal madi_channel_cnt : std_logic_vector(5 downto 0) := (others => '0');
|
32 |
|
|
signal madi_channel_rst : std_logic := '0';
|
33 |
|
|
signal madi_write_buffer : std_logic;
|
34 |
|
|
signal madi_wordclk_shift : std_logic_vector(1 downto 0);
|
35 |
|
|
signal madi_wordclk_count : std_logic_vector(11 downto 0) := (others => '0');
|
36 |
|
|
signal madi_wordclk_max : std_logic_vector(11 downto 0) := (others => '0');
|
37 |
|
|
signal madi_wordclk_wait : std_logic_vector(30 downto 0) := (others => '0');
|
38 |
|
|
|
39 |
|
|
begin
|
40 |
|
|
|
41 |
|
|
madi_nrzi_in : process (clk_125_in)
|
42 |
|
|
begin
|
43 |
|
|
if clk_125_in'event and clk_125_in = '1' then
|
44 |
|
|
madi_nrzi_shift <= madi_nrzi_shift(0) & madi_in;
|
45 |
|
|
if madi_nrzi_shift = "01" or madi_nrzi_shift = "10" then
|
46 |
|
|
madi_nrzi_data <= '1';
|
47 |
|
|
else
|
48 |
|
|
madi_nrzi_data <= '0';
|
49 |
|
|
end if;
|
50 |
|
|
end if;
|
51 |
|
|
end process madi_nrzi_in;
|
52 |
|
|
|
53 |
|
|
madi_sync : process (clk_125_in)
|
54 |
|
|
begin
|
55 |
|
|
if clk_125_in'event and clk_125_in = '1' then
|
56 |
|
|
madi_sync_shift <= madi_sync_shift(madi_sync_shift'left-1 downto 0) & madi_nrzi_data;
|
57 |
|
|
madi_sync_count <= madi_sync_count + 1;
|
58 |
|
|
if madi_sync_shift = "1100010001" then -- JK sync symbols detected
|
59 |
|
|
madi_sync_count <= (others => '0');
|
60 |
|
|
end if;
|
61 |
|
|
if madi_sync_count = 4 then
|
62 |
|
|
madi_sync_clk <= '1';
|
63 |
|
|
madi_symbol <= madi_sync_shift(4 downto 0);
|
64 |
|
|
madi_sync_count <= (others => '0');
|
65 |
|
|
else
|
66 |
|
|
madi_sync_clk <= '0';
|
67 |
|
|
end if;
|
68 |
|
|
end if;
|
69 |
|
|
end process madi_sync;
|
70 |
|
|
|
71 |
|
|
madi_decode : process (clk_125_in)
|
72 |
|
|
begin
|
73 |
|
|
if clk_125_in'event and clk_125_in = '1' then
|
74 |
|
|
if madi_sync_clk = '1' then
|
75 |
|
|
case madi_symbol is
|
76 |
|
|
when "11110" =>
|
77 |
|
|
madi_nibble <= "0000";
|
78 |
|
|
madi_nibble_clk <= '1';
|
79 |
|
|
madi_nibble_rst <= '0';
|
80 |
|
|
when "01001" =>
|
81 |
|
|
madi_nibble <= "0001";
|
82 |
|
|
madi_nibble_clk <= '1';
|
83 |
|
|
madi_nibble_rst <= '0';
|
84 |
|
|
when "10100" =>
|
85 |
|
|
madi_nibble <= "0010";
|
86 |
|
|
madi_nibble_clk <= '1';
|
87 |
|
|
madi_nibble_rst <= '0';
|
88 |
|
|
when "10101" =>
|
89 |
|
|
madi_nibble <= "0011";
|
90 |
|
|
madi_nibble_clk <= '1';
|
91 |
|
|
madi_nibble_rst <= '0';
|
92 |
|
|
when "01010" =>
|
93 |
|
|
madi_nibble <= "0100";
|
94 |
|
|
madi_nibble_clk <= '1';
|
95 |
|
|
madi_nibble_rst <= '0';
|
96 |
|
|
when "01011" =>
|
97 |
|
|
madi_nibble <= "0101";
|
98 |
|
|
madi_nibble_clk <= '1';
|
99 |
|
|
madi_nibble_rst <= '0';
|
100 |
|
|
when "01110" =>
|
101 |
|
|
madi_nibble <= "0110";
|
102 |
|
|
madi_nibble_clk <= '1';
|
103 |
|
|
madi_nibble_rst <= '0';
|
104 |
|
|
when "01111" =>
|
105 |
|
|
madi_nibble <= "0111";
|
106 |
|
|
madi_nibble_clk <= '1';
|
107 |
|
|
madi_nibble_rst <= '0';
|
108 |
|
|
when "10010" =>
|
109 |
|
|
madi_nibble <= "1000";
|
110 |
|
|
madi_nibble_clk <= '1';
|
111 |
|
|
madi_nibble_rst <= '0';
|
112 |
|
|
when "10011" =>
|
113 |
|
|
madi_nibble <= "1001";
|
114 |
|
|
madi_nibble_clk <= '1';
|
115 |
|
|
madi_nibble_rst <= '0';
|
116 |
|
|
when "10110" =>
|
117 |
|
|
madi_nibble <= "1010";
|
118 |
|
|
madi_nibble_clk <= '1';
|
119 |
|
|
madi_nibble_rst <= '0';
|
120 |
|
|
when "10111" =>
|
121 |
|
|
madi_nibble <= "1011";
|
122 |
|
|
madi_nibble_clk <= '1';
|
123 |
|
|
madi_nibble_rst <= '0';
|
124 |
|
|
when "11010" =>
|
125 |
|
|
madi_nibble <= "1100";
|
126 |
|
|
madi_nibble_clk <= '1';
|
127 |
|
|
madi_nibble_rst <= '0';
|
128 |
|
|
when "11011" =>
|
129 |
|
|
madi_nibble <= "1101";
|
130 |
|
|
madi_nibble_clk <= '1';
|
131 |
|
|
madi_nibble_rst <= '0';
|
132 |
|
|
when "11101" =>
|
133 |
|
|
madi_nibble <= "1110";
|
134 |
|
|
madi_nibble_clk <= '1';
|
135 |
|
|
madi_nibble_rst <= '0';
|
136 |
|
|
when "00100" =>
|
137 |
|
|
madi_nibble <= "1111";
|
138 |
|
|
madi_nibble_clk <= '1';
|
139 |
|
|
madi_nibble_rst <= '0';
|
140 |
|
|
when others =>
|
141 |
|
|
madi_nibble <= "0000";
|
142 |
|
|
madi_nibble_clk <= '0';
|
143 |
|
|
madi_nibble_rst <= '1';
|
144 |
|
|
end case;
|
145 |
|
|
else
|
146 |
|
|
madi_nibble_clk <= '0';
|
147 |
|
|
madi_nibble_rst <= '0';
|
148 |
|
|
end if;
|
149 |
|
|
end if;
|
150 |
|
|
end process madi_decode;
|
151 |
|
|
|
152 |
|
|
place_nibble : process (clk_125_in)
|
153 |
|
|
begin
|
154 |
|
|
if clk_125_in'event and clk_125_in = '1' then
|
155 |
|
|
if madi_nibble_rst = '1' then
|
156 |
|
|
madi_nibble_cnt <= (others => '0');
|
157 |
|
|
end if;
|
158 |
|
|
if madi_nibble_clk = '1' then
|
159 |
|
|
madi_nibble_cnt <= madi_nibble_cnt + 1;
|
160 |
|
|
case madi_nibble_cnt is
|
161 |
|
|
when "000" =>
|
162 |
|
|
madi_nibble_buffer(0) <= madi_nibble;
|
163 |
|
|
when "001" =>
|
164 |
|
|
madi_nibble_buffer(1) <= madi_nibble;
|
165 |
|
|
when "010" =>
|
166 |
|
|
madi_nibble_buffer(2) <= madi_nibble;
|
167 |
|
|
when "011" =>
|
168 |
|
|
madi_nibble_buffer(3) <= madi_nibble;
|
169 |
|
|
when "100" =>
|
170 |
|
|
madi_nibble_buffer(4) <= madi_nibble;
|
171 |
|
|
when "101" =>
|
172 |
|
|
madi_nibble_buffer(5) <= madi_nibble;
|
173 |
|
|
when "110" =>
|
174 |
|
|
madi_nibble_buffer(6) <= madi_nibble;
|
175 |
|
|
when "111" =>
|
176 |
|
|
madi_nibble_buffer(7) <= madi_nibble;
|
177 |
|
|
when others =>
|
178 |
|
|
end case;
|
179 |
|
|
madi_channel_rst <= madi_nibble_buffer(0)(3);
|
180 |
|
|
if madi_channel_rst = '1' then
|
181 |
|
|
madi_channel_cnt <= (others => '0');
|
182 |
|
|
end if;
|
183 |
|
|
if madi_nibble_cnt = 7 then
|
184 |
|
|
madi_data <= madi_nibble_buffer(1) & madi_nibble_buffer(2) & madi_nibble_buffer(3) & madi_nibble_buffer(4) & madi_nibble_buffer(5) & madi_nibble_buffer(6);
|
185 |
|
|
madi_channel_cnt <= madi_channel_cnt + 1;
|
186 |
|
|
madi_write_buffer <= '1';
|
187 |
|
|
else
|
188 |
|
|
madi_write_buffer <= '0';
|
189 |
|
|
end if;
|
190 |
|
|
madi_wordclk_shift <= madi_wordclk_shift(0) & madi_channel_rst;
|
191 |
|
|
madi_write <= madi_write_buffer;
|
192 |
|
|
end if;
|
193 |
|
|
madi_channel <= madi_channel_cnt;
|
194 |
|
|
end if;
|
195 |
|
|
end process place_nibble;
|
196 |
|
|
|
197 |
|
|
generate_madi_wordclk : process (clk_125_in)
|
198 |
|
|
begin
|
199 |
|
|
if clk_125_in'event and clk_125_in = '1' then
|
200 |
|
|
if madi_wordclk_shift = "01" then
|
201 |
|
|
madi_wordclk_count <= (others => '0');
|
202 |
|
|
else
|
203 |
|
|
madi_wordclk_count <= madi_wordclk_count + 1;
|
204 |
|
|
end if;
|
205 |
|
|
if madi_wordclk_count > madi_wordclk_max then
|
206 |
|
|
madi_wordclk_max <= madi_wordclk_count;
|
207 |
|
|
madi_wordclk_wait <= (others => '0');
|
208 |
|
|
else
|
209 |
|
|
if madi_wordclk_wait = 2**(madi_wordclk_wait'length-1) then
|
210 |
|
|
madi_wordclk_wait <= madi_wordclk_wait - 1;
|
211 |
|
|
end if;
|
212 |
|
|
end if;
|
213 |
|
|
if madi_wordclk_count < madi_wordclk_max(madi_wordclk_max'left downto 1) then
|
214 |
|
|
madi_wordclock <= '1';
|
215 |
|
|
else
|
216 |
|
|
madi_wordclock <= '0';
|
217 |
|
|
end if;
|
218 |
|
|
end if;
|
219 |
|
|
end process generate_madi_wordclk;
|
220 |
|
|
|
221 |
|
|
end behavioral;
|
222 |
|
|
|
223 |
|
|
library ieee;
|
224 |
|
|
use ieee.std_logic_1164.all;
|
225 |
|
|
use ieee.std_logic_unsigned.all;
|
226 |
|
|
|
227 |
|
|
entity adat_transmitter is
|
228 |
|
|
port(
|
229 |
|
|
data_in : in std_logic_vector(23 downto 0);
|
230 |
|
|
address_out : out std_logic_vector(2 downto 0);
|
231 |
|
|
|
232 |
|
|
bitclk_in : in std_logic;
|
233 |
|
|
wordclk_in : in std_logic;
|
234 |
|
|
adat_out : out std_logic
|
235 |
|
|
);
|
236 |
|
|
end adat_transmitter;
|
237 |
|
|
|
238 |
|
|
architecture behavioral of adat_transmitter is
|
239 |
|
|
signal bit_counter : std_logic_vector(7 downto 0) := (others => '0');
|
240 |
|
|
signal wordclk_shift : std_logic_vector(1 downto 0):= (others => '0');
|
241 |
|
|
signal adat_buffer : std_logic_vector(29 downto 0) := (others => '0');
|
242 |
|
|
signal adat_address : std_logic_vector(2 downto 0) := (others => '0');
|
243 |
|
|
signal adat_nrzi : std_logic := '0';
|
244 |
|
|
|
245 |
|
|
begin
|
246 |
|
|
|
247 |
|
|
bit_count : process (bitclk_in)
|
248 |
|
|
begin
|
249 |
|
|
if bitclk_in'event and bitclk_in='1' then
|
250 |
|
|
wordclk_shift <= wordclk_shift(0) & wordclk_in;
|
251 |
|
|
bit_counter <= bit_counter + 1;
|
252 |
|
|
if wordclk_shift = "01" then
|
253 |
|
|
bit_counter <= (others => '0');
|
254 |
|
|
end if;
|
255 |
|
|
end if;
|
256 |
|
|
end process bit_count;
|
257 |
|
|
|
258 |
|
|
proc_adat_buffer : process (bitclk_in, bit_counter, data_in, adat_address)
|
259 |
|
|
begin
|
260 |
|
|
if bitclk_in'event and bitclk_in='1' then
|
261 |
|
|
case bit_counter is
|
262 |
|
|
when "00000000" =>
|
263 |
|
|
adat_buffer <= data_in(23 downto 20) & '1' & data_in(19 downto 16) & '1' & data_in(15 downto 12) & '1' & data_in(11 downto 8) & '1' & data_in(7 downto 4) & '1' & data_in(3 downto 0) & '1';
|
264 |
|
|
when "00000001" =>
|
265 |
|
|
adat_address <= adat_address +1;
|
266 |
|
|
when "00011110" =>
|
267 |
|
|
adat_buffer <= data_in(23 downto 20) & '1' & data_in(19 downto 16) & '1' & data_in(15 downto 12) & '1' & data_in(11 downto 8) & '1' & data_in(7 downto 4) & '1' & data_in(3 downto 0) & '1';
|
268 |
|
|
when "00011111" =>
|
269 |
|
|
adat_address <= adat_address +1;
|
270 |
|
|
when "00111100" =>
|
271 |
|
|
adat_buffer <= data_in(23 downto 20) & '1' & data_in(19 downto 16) & '1' & data_in(15 downto 12) & '1' & data_in(11 downto 8) & '1' & data_in(7 downto 4) & '1' & data_in(3 downto 0) & '1';
|
272 |
|
|
when "00111101" =>
|
273 |
|
|
adat_address <= adat_address +1;
|
274 |
|
|
when "01011010" =>
|
275 |
|
|
adat_buffer <= data_in(23 downto 20) & '1' & data_in(19 downto 16) & '1' & data_in(15 downto 12) & '1' & data_in(11 downto 8) & '1' & data_in(7 downto 4) & '1' & data_in(3 downto 0) & '1';
|
276 |
|
|
when "01011011" =>
|
277 |
|
|
adat_address <= adat_address +1;
|
278 |
|
|
when "01111000" =>
|
279 |
|
|
adat_buffer <= data_in(23 downto 20) & '1' & data_in(19 downto 16) & '1' & data_in(15 downto 12) & '1' & data_in(11 downto 8) & '1' & data_in(7 downto 4) & '1' & data_in(3 downto 0) & '1';
|
280 |
|
|
when "01111001" =>
|
281 |
|
|
adat_address <= adat_address +1;
|
282 |
|
|
when "10010110" =>
|
283 |
|
|
adat_buffer <= data_in(23 downto 20) & '1' & data_in(19 downto 16) & '1' & data_in(15 downto 12) & '1' & data_in(11 downto 8) & '1' & data_in(7 downto 4) & '1' & data_in(3 downto 0) & '1';
|
284 |
|
|
when "10010111" =>
|
285 |
|
|
adat_address <= adat_address +1;
|
286 |
|
|
when "10110100" =>
|
287 |
|
|
adat_buffer <= data_in(23 downto 20) & '1' & data_in(19 downto 16) & '1' & data_in(15 downto 12) & '1' & data_in(11 downto 8) & '1' & data_in(7 downto 4) & '1' & data_in(3 downto 0) & '1';
|
288 |
|
|
when "10110101" =>
|
289 |
|
|
adat_address <= adat_address +1;
|
290 |
|
|
when "11010010" =>
|
291 |
|
|
adat_buffer <= data_in(23 downto 20) & '1' & data_in(19 downto 16) & '1' & data_in(15 downto 12) & '1' & data_in(11 downto 8) & '1' & data_in(7 downto 4) & '1' & data_in(3 downto 0) & '1';
|
292 |
|
|
when "11010011" =>
|
293 |
|
|
adat_address <= adat_address +1;
|
294 |
|
|
when "11110000" =>
|
295 |
|
|
adat_buffer <= "0000" & '1' & "0000000000" & '1' & "00000000000000";
|
296 |
|
|
when "11110001" =>
|
297 |
|
|
adat_address <= (others => '0');
|
298 |
|
|
when others =>
|
299 |
|
|
adat_buffer <= adat_buffer(adat_buffer'left-1 downto 0) & '0';
|
300 |
|
|
end case;
|
301 |
|
|
end if;
|
302 |
|
|
end process proc_adat_buffer;
|
303 |
|
|
|
304 |
|
|
proc_adat_nrzi : process (bitclk_in)
|
305 |
|
|
begin
|
306 |
|
|
if bitclk_in'event and bitclk_in='1' then
|
307 |
|
|
if adat_buffer(adat_buffer'left)='0' then
|
308 |
|
|
adat_nrzi <= adat_nrzi;
|
309 |
|
|
else
|
310 |
|
|
adat_nrzi <= not adat_nrzi;
|
311 |
|
|
end if;
|
312 |
|
|
end if;
|
313 |
|
|
end process proc_adat_nrzi;
|
314 |
|
|
|
315 |
|
|
address_out <= adat_address;
|
316 |
|
|
adat_out <= adat_nrzi;
|
317 |
|
|
|
318 |
|
|
end behavioral;
|
319 |
|
|
|
320 |
|
|
LIBRARY ieee;
|
321 |
|
|
USE ieee.std_logic_1164.all;
|
322 |
|
|
LIBRARY altera_mf;
|
323 |
|
|
USE altera_mf.all;
|
324 |
|
|
|
325 |
|
|
entity dp_ram is
|
326 |
|
|
port(
|
327 |
|
|
clock : in std_logic;
|
328 |
|
|
data : in std_logic_vector(23 downto 0);
|
329 |
|
|
rdaddress : in std_logic_vector(2 downto 0);
|
330 |
|
|
wraddress : in std_logic_vector(2 downto 0);
|
331 |
|
|
wren : in std_logic := '1';
|
332 |
|
|
q : out std_logic_vector(23 downto 0)
|
333 |
|
|
);
|
334 |
|
|
end dp_ram;
|
335 |
|
|
|
336 |
|
|
architecture syn of dp_ram is
|
337 |
|
|
|
338 |
|
|
SIGNAL sub_wire0 : std_logic_vector(23 downto 0);
|
339 |
|
|
|
340 |
|
|
component altsyncram
|
341 |
|
|
generic (
|
342 |
|
|
address_reg_b : string;
|
343 |
|
|
clock_enable_input_a : string;
|
344 |
|
|
clock_enable_input_b : string;
|
345 |
|
|
clock_enable_output_a : string;
|
346 |
|
|
clock_enable_output_b : string;
|
347 |
|
|
intended_device_family : string;
|
348 |
|
|
lpm_type : string;
|
349 |
|
|
numwords_a : natural;
|
350 |
|
|
numwords_b : natural;
|
351 |
|
|
operation_mode : string;
|
352 |
|
|
outdata_aclr_b : string;
|
353 |
|
|
outdata_reg_b : string;
|
354 |
|
|
power_up_uninitialized : string;
|
355 |
|
|
read_during_write_mode_mixed_ports : string;
|
356 |
|
|
widthad_a : natural;
|
357 |
|
|
widthad_b : natural;
|
358 |
|
|
width_a : natural;
|
359 |
|
|
width_b : natural;
|
360 |
|
|
width_byteena_a : natural
|
361 |
|
|
);
|
362 |
|
|
port(
|
363 |
|
|
wren_a : in std_logic ;
|
364 |
|
|
clock0 : in std_logic ;
|
365 |
|
|
address_a : in std_logic_vector(2 downto 0);
|
366 |
|
|
address_b : in std_logic_vector(2 downto 0);
|
367 |
|
|
q_b : out std_logic_vector(23 downto 0);
|
368 |
|
|
data_a : in std_logic_vector(23 downto 0)
|
369 |
|
|
);
|
370 |
|
|
end component;
|
371 |
|
|
|
372 |
|
|
begin
|
373 |
|
|
q <= sub_wire0(23 downto 0);
|
374 |
|
|
altsyncram_component : altsyncram
|
375 |
|
|
generic map(
|
376 |
|
|
address_reg_b => "CLOCK0",
|
377 |
|
|
clock_enable_input_a => "BYPASS",
|
378 |
|
|
clock_enable_input_b => "BYPASS",
|
379 |
|
|
clock_enable_output_a => "BYPASS",
|
380 |
|
|
clock_enable_output_b => "BYPASS",
|
381 |
|
|
intended_device_family => "Cyclone II",
|
382 |
|
|
lpm_type => "altsyncram",
|
383 |
|
|
numwords_a => 8,
|
384 |
|
|
numwords_b => 8,
|
385 |
|
|
operation_mode => "DUAL_PORT",
|
386 |
|
|
outdata_aclr_b => "NONE",
|
387 |
|
|
outdata_reg_b => "CLOCK0",
|
388 |
|
|
power_up_uninitialized => "FALSE",
|
389 |
|
|
read_during_write_mode_mixed_ports => "OLD_DATA",
|
390 |
|
|
widthad_a => 3,
|
391 |
|
|
widthad_b => 3,
|
392 |
|
|
width_a => 24,
|
393 |
|
|
width_b => 24,
|
394 |
|
|
width_byteena_a => 1
|
395 |
|
|
)
|
396 |
|
|
port map(
|
397 |
|
|
wren_a => wren,
|
398 |
|
|
clock0 => clock,
|
399 |
|
|
address_a => wraddress,
|
400 |
|
|
address_b => rdaddress,
|
401 |
|
|
data_a => data,
|
402 |
|
|
q_b => sub_wire0
|
403 |
|
|
);
|
404 |
|
|
end syn;
|
405 |
|
|
|
406 |
|
|
library ieee;
|
407 |
|
|
use ieee.std_logic_1164.all;
|
408 |
|
|
use ieee.std_logic_unsigned.all;
|
409 |
|
|
|
410 |
|
|
entity madi_to_adat is
|
411 |
|
|
port(
|
412 |
|
|
clk_125_in : in std_logic;
|
413 |
|
|
madi_in : in std_logic;
|
414 |
|
|
|
415 |
|
|
word_clk_in : in std_logic;
|
416 |
|
|
word_clk_out : out std_logic;
|
417 |
|
|
bit_clk_in : in std_logic;
|
418 |
|
|
adat_0_out : out std_logic;
|
419 |
|
|
adat_1_out : out std_logic;
|
420 |
|
|
adat_2_out : out std_logic;
|
421 |
|
|
adat_3_out : out std_logic;
|
422 |
|
|
adat_4_out : out std_logic;
|
423 |
|
|
adat_5_out : out std_logic;
|
424 |
|
|
adat_6_out : out std_logic;
|
425 |
|
|
adat_7_out : out std_logic
|
426 |
|
|
);
|
427 |
|
|
end madi_to_adat;
|
428 |
|
|
|
429 |
|
|
architecture behavioral of madi_to_adat is
|
430 |
|
|
signal madi_channel : std_logic_vector(5 downto 0);
|
431 |
|
|
signal madi_data : std_logic_vector(23 downto 0);
|
432 |
|
|
signal madi_write : std_logic;
|
433 |
|
|
|
434 |
|
|
signal madi_write_0 : std_logic;
|
435 |
|
|
signal madi_write_1 : std_logic;
|
436 |
|
|
signal madi_write_2 : std_logic;
|
437 |
|
|
signal madi_write_3 : std_logic;
|
438 |
|
|
signal madi_write_4 : std_logic;
|
439 |
|
|
signal madi_write_5 : std_logic;
|
440 |
|
|
signal madi_write_6 : std_logic;
|
441 |
|
|
signal madi_write_7 : std_logic;
|
442 |
|
|
|
443 |
|
|
signal adat_addr_0 : std_logic_vector(2 downto 0);
|
444 |
|
|
signal adat_addr_1 : std_logic_vector(2 downto 0);
|
445 |
|
|
signal adat_addr_2 : std_logic_vector(2 downto 0);
|
446 |
|
|
signal adat_addr_3 : std_logic_vector(2 downto 0);
|
447 |
|
|
signal adat_addr_4 : std_logic_vector(2 downto 0);
|
448 |
|
|
signal adat_addr_5 : std_logic_vector(2 downto 0);
|
449 |
|
|
signal adat_addr_6 : std_logic_vector(2 downto 0);
|
450 |
|
|
signal adat_addr_7 : std_logic_vector(2 downto 0);
|
451 |
|
|
|
452 |
|
|
signal adat_data_0 : std_logic_vector(23 downto 0);
|
453 |
|
|
signal adat_data_1 : std_logic_vector(23 downto 0);
|
454 |
|
|
signal adat_data_2 : std_logic_vector(23 downto 0);
|
455 |
|
|
signal adat_data_3 : std_logic_vector(23 downto 0);
|
456 |
|
|
signal adat_data_4 : std_logic_vector(23 downto 0);
|
457 |
|
|
signal adat_data_5 : std_logic_vector(23 downto 0);
|
458 |
|
|
signal adat_data_6 : std_logic_vector(23 downto 0);
|
459 |
|
|
signal adat_data_7 : std_logic_vector(23 downto 0);
|
460 |
|
|
|
461 |
|
|
component madi_receiver is
|
462 |
|
|
port(
|
463 |
|
|
clk_125_in : in std_logic;
|
464 |
|
|
madi_in : in std_logic;
|
465 |
|
|
|
466 |
|
|
madi_write : out std_logic;
|
467 |
|
|
madi_wordclock : out std_logic;
|
468 |
|
|
madi_channel : out std_logic_vector(5 downto 0);
|
469 |
|
|
madi_data : out std_logic_vector(23 downto 0)
|
470 |
|
|
);
|
471 |
|
|
end component madi_receiver;
|
472 |
|
|
|
473 |
|
|
component adat_transmitter is
|
474 |
|
|
port(
|
475 |
|
|
data_in : in std_logic_vector(23 downto 0);
|
476 |
|
|
address_out : out std_logic_vector(2 downto 0);
|
477 |
|
|
|
478 |
|
|
bitclk_in : in std_logic;
|
479 |
|
|
wordclk_in : in std_logic;
|
480 |
|
|
adat_out : out std_logic
|
481 |
|
|
);
|
482 |
|
|
end component adat_transmitter;
|
483 |
|
|
|
484 |
|
|
component dp_ram is
|
485 |
|
|
port(
|
486 |
|
|
clock: in std_logic;
|
487 |
|
|
data: in std_logic_vector(23 downto 0);
|
488 |
|
|
rdaddress: in std_logic_vector(2 downto 0);
|
489 |
|
|
wraddress: in std_logic_vector(2 downto 0);
|
490 |
|
|
wren: in std_logic := '1';
|
491 |
|
|
q: out std_logic_vector(23 downto 0)
|
492 |
|
|
);
|
493 |
|
|
end component dp_ram;
|
494 |
|
|
|
495 |
|
|
begin
|
496 |
|
|
|
497 |
|
|
madi_receive : madi_receiver
|
498 |
|
|
port map(
|
499 |
|
|
clk_125_in => clk_125_in,
|
500 |
|
|
madi_in => madi_in,
|
501 |
|
|
madi_write => madi_write,
|
502 |
|
|
madi_wordclock => word_clk_out,
|
503 |
|
|
madi_channel => madi_channel,
|
504 |
|
|
madi_data => madi_data
|
505 |
|
|
);
|
506 |
|
|
|
507 |
|
|
-- adat channel 0
|
508 |
|
|
|
509 |
|
|
dp_ram_0_write : process (clk_125_in)
|
510 |
|
|
begin
|
511 |
|
|
if clk_125_in'event and clk_125_in='1' then
|
512 |
|
|
if madi_channel(5 downto 3) = 0 and madi_write = '1' then
|
513 |
|
|
madi_write_0 <= '1';
|
514 |
|
|
else
|
515 |
|
|
madi_write_0 <= '0';
|
516 |
|
|
end if;
|
517 |
|
|
end if;
|
518 |
|
|
end process dp_ram_0_write;
|
519 |
|
|
|
520 |
|
|
dp_ram_0 : dp_ram
|
521 |
|
|
port map(
|
522 |
|
|
clock => clk_125_in,
|
523 |
|
|
data => madi_data,
|
524 |
|
|
rdaddress => adat_addr_0,
|
525 |
|
|
wraddress => madi_channel(2 downto 0),
|
526 |
|
|
wren => madi_write_0,
|
527 |
|
|
q => adat_data_0
|
528 |
|
|
);
|
529 |
|
|
|
530 |
|
|
adat_transmitter_0 : adat_transmitter
|
531 |
|
|
port map(
|
532 |
|
|
data_in => adat_data_0,
|
533 |
|
|
address_out => adat_addr_0,
|
534 |
|
|
bitclk_in => bit_clk_in,
|
535 |
|
|
wordclk_in => word_clk_in,
|
536 |
|
|
adat_out => adat_0_out
|
537 |
|
|
);
|
538 |
|
|
|
539 |
|
|
-- adat channel 1
|
540 |
|
|
|
541 |
|
|
dp_ram_1_write : process (clk_125_in)
|
542 |
|
|
begin
|
543 |
|
|
if clk_125_in'event and clk_125_in='1' then
|
544 |
|
|
if madi_channel(5 downto 3) = 1 and madi_write = '1' then
|
545 |
|
|
madi_write_1 <= '1';
|
546 |
|
|
else
|
547 |
|
|
madi_write_1 <= '0';
|
548 |
|
|
end if;
|
549 |
|
|
end if;
|
550 |
|
|
end process dp_ram_1_write;
|
551 |
|
|
|
552 |
|
|
dp_ram_1 : dp_ram
|
553 |
|
|
port map(
|
554 |
|
|
clock => clk_125_in,
|
555 |
|
|
data => madi_data,
|
556 |
|
|
rdaddress => adat_addr_1,
|
557 |
|
|
wraddress => madi_channel(2 downto 0),
|
558 |
|
|
wren => madi_write_1,
|
559 |
|
|
q => adat_data_1
|
560 |
|
|
);
|
561 |
|
|
|
562 |
|
|
adat_transmitter_1 : adat_transmitter
|
563 |
|
|
port map(
|
564 |
|
|
data_in => adat_data_1,
|
565 |
|
|
address_out => adat_addr_1,
|
566 |
|
|
bitclk_in => bit_clk_in,
|
567 |
|
|
wordclk_in => word_clk_in,
|
568 |
|
|
adat_out => adat_1_out
|
569 |
|
|
);
|
570 |
|
|
|
571 |
|
|
-- adat channel 2
|
572 |
|
|
|
573 |
|
|
dp_ram_2_write : process (clk_125_in)
|
574 |
|
|
begin
|
575 |
|
|
if clk_125_in'event and clk_125_in='1' then
|
576 |
|
|
if madi_channel(5 downto 3) = 2 and madi_write = '1' then
|
577 |
|
|
madi_write_2 <= '1';
|
578 |
|
|
else
|
579 |
|
|
madi_write_2 <= '0';
|
580 |
|
|
end if;
|
581 |
|
|
end if;
|
582 |
|
|
end process dp_ram_2_write;
|
583 |
|
|
|
584 |
|
|
dp_ram_2 : dp_ram
|
585 |
|
|
port map(
|
586 |
|
|
clock => clk_125_in,
|
587 |
|
|
data => madi_data,
|
588 |
|
|
rdaddress => adat_addr_2,
|
589 |
|
|
wraddress => madi_channel(2 downto 0),
|
590 |
|
|
wren => madi_write_2,
|
591 |
|
|
q => adat_data_2
|
592 |
|
|
);
|
593 |
|
|
|
594 |
|
|
adat_transmitter_2 : adat_transmitter
|
595 |
|
|
port map(
|
596 |
|
|
data_in => adat_data_2,
|
597 |
|
|
address_out => adat_addr_2,
|
598 |
|
|
bitclk_in => bit_clk_in,
|
599 |
|
|
wordclk_in => word_clk_in,
|
600 |
|
|
adat_out => adat_2_out
|
601 |
|
|
);
|
602 |
|
|
|
603 |
|
|
-- adat channel 3
|
604 |
|
|
|
605 |
|
|
dp_ram_3_write : process (clk_125_in)
|
606 |
|
|
begin
|
607 |
|
|
if clk_125_in'event and clk_125_in='1' then
|
608 |
|
|
if madi_channel(5 downto 3) = 3 and madi_write = '1' then
|
609 |
|
|
madi_write_3 <= '1';
|
610 |
|
|
else
|
611 |
|
|
madi_write_3 <= '0';
|
612 |
|
|
end if;
|
613 |
|
|
end if;
|
614 |
|
|
end process dp_ram_3_write;
|
615 |
|
|
|
616 |
|
|
dp_ram_3 : dp_ram
|
617 |
|
|
port map(
|
618 |
|
|
clock => clk_125_in,
|
619 |
|
|
data => madi_data,
|
620 |
|
|
rdaddress => adat_addr_3,
|
621 |
|
|
wraddress => madi_channel(2 downto 0),
|
622 |
|
|
wren => madi_write_3,
|
623 |
|
|
q => adat_data_3
|
624 |
|
|
);
|
625 |
|
|
|
626 |
|
|
adat_transmitter_3 : adat_transmitter
|
627 |
|
|
port map(
|
628 |
|
|
data_in => adat_data_3,
|
629 |
|
|
address_out => adat_addr_3,
|
630 |
|
|
bitclk_in => bit_clk_in,
|
631 |
|
|
wordclk_in => word_clk_in,
|
632 |
|
|
adat_out => adat_3_out
|
633 |
|
|
);
|
634 |
|
|
|
635 |
|
|
-- adat channel 4
|
636 |
|
|
|
637 |
|
|
dp_ram_4_write : process (clk_125_in)
|
638 |
|
|
begin
|
639 |
|
|
if clk_125_in'event and clk_125_in='1' then
|
640 |
|
|
if madi_channel(5 downto 3) = 4 and madi_write = '1' then
|
641 |
|
|
madi_write_4 <= '1';
|
642 |
|
|
else
|
643 |
|
|
madi_write_4 <= '0';
|
644 |
|
|
end if;
|
645 |
|
|
end if;
|
646 |
|
|
end process dp_ram_4_write;
|
647 |
|
|
|
648 |
|
|
dp_ram_4 : dp_ram
|
649 |
|
|
port map(
|
650 |
|
|
clock => clk_125_in,
|
651 |
|
|
data => madi_data,
|
652 |
|
|
rdaddress => adat_addr_4,
|
653 |
|
|
wraddress => madi_channel(2 downto 0),
|
654 |
|
|
wren => madi_write_4,
|
655 |
|
|
q => adat_data_4
|
656 |
|
|
);
|
657 |
|
|
|
658 |
|
|
adat_transmitter_4 : adat_transmitter
|
659 |
|
|
port map(
|
660 |
|
|
data_in => adat_data_4,
|
661 |
|
|
address_out => adat_addr_4,
|
662 |
|
|
bitclk_in => bit_clk_in,
|
663 |
|
|
wordclk_in => word_clk_in,
|
664 |
|
|
adat_out => adat_4_out
|
665 |
|
|
);
|
666 |
|
|
|
667 |
|
|
-- adat channel 5
|
668 |
|
|
|
669 |
|
|
dp_ram_5_write : process (clk_125_in)
|
670 |
|
|
begin
|
671 |
|
|
if clk_125_in'event and clk_125_in='1' then
|
672 |
|
|
if madi_channel(5 downto 3) = 5 and madi_write = '1' then
|
673 |
|
|
madi_write_5 <= '1';
|
674 |
|
|
else
|
675 |
|
|
madi_write_5 <= '0';
|
676 |
|
|
end if;
|
677 |
|
|
end if;
|
678 |
|
|
end process dp_ram_5_write;
|
679 |
|
|
|
680 |
|
|
dp_ram_5 : dp_ram
|
681 |
|
|
port map(
|
682 |
|
|
clock => clk_125_in,
|
683 |
|
|
data => madi_data,
|
684 |
|
|
rdaddress => adat_addr_5,
|
685 |
|
|
wraddress => madi_channel(2 downto 0),
|
686 |
|
|
wren => madi_write_5,
|
687 |
|
|
q => adat_data_5
|
688 |
|
|
);
|
689 |
|
|
|
690 |
|
|
adat_transmitter_5 : adat_transmitter
|
691 |
|
|
port map(
|
692 |
|
|
data_in => adat_data_5,
|
693 |
|
|
address_out => adat_addr_5,
|
694 |
|
|
bitclk_in => bit_clk_in,
|
695 |
|
|
wordclk_in => word_clk_in,
|
696 |
|
|
adat_out => adat_5_out
|
697 |
|
|
);
|
698 |
|
|
|
699 |
|
|
-- adat channel 6
|
700 |
|
|
|
701 |
|
|
dp_ram_6_write : process (clk_125_in)
|
702 |
|
|
begin
|
703 |
|
|
if clk_125_in'event and clk_125_in='1' then
|
704 |
|
|
if madi_channel(5 downto 3) = 6 and madi_write = '1' then
|
705 |
|
|
madi_write_6 <= '1';
|
706 |
|
|
else
|
707 |
|
|
madi_write_6 <= '0';
|
708 |
|
|
end if;
|
709 |
|
|
end if;
|
710 |
|
|
end process dp_ram_6_write;
|
711 |
|
|
|
712 |
|
|
dp_ram_6 : dp_ram
|
713 |
|
|
port map(
|
714 |
|
|
clock => clk_125_in,
|
715 |
|
|
data => madi_data,
|
716 |
|
|
rdaddress => adat_addr_6,
|
717 |
|
|
wraddress => madi_channel(2 downto 0),
|
718 |
|
|
wren => madi_write_6,
|
719 |
|
|
q => adat_data_6
|
720 |
|
|
);
|
721 |
|
|
|
722 |
|
|
adat_transmitter_6 : adat_transmitter
|
723 |
|
|
port map(
|
724 |
|
|
data_in => adat_data_6,
|
725 |
|
|
address_out => adat_addr_6,
|
726 |
|
|
bitclk_in => bit_clk_in,
|
727 |
|
|
wordclk_in => word_clk_in,
|
728 |
|
|
adat_out => adat_6_out
|
729 |
|
|
);
|
730 |
|
|
|
731 |
|
|
-- adat channel 7
|
732 |
|
|
|
733 |
|
|
dp_ram_7_write : process (clk_125_in)
|
734 |
|
|
begin
|
735 |
|
|
if clk_125_in'event and clk_125_in='1' then
|
736 |
|
|
if madi_channel(5 downto 3) = 7 and madi_write = '1' then
|
737 |
|
|
madi_write_7 <= '1';
|
738 |
|
|
else
|
739 |
|
|
madi_write_7 <= '0';
|
740 |
|
|
end if;
|
741 |
|
|
end if;
|
742 |
|
|
end process dp_ram_7_write;
|
743 |
|
|
|
744 |
|
|
dp_ram_7 : dp_ram
|
745 |
|
|
port map(
|
746 |
|
|
clock => clk_125_in,
|
747 |
|
|
data => madi_data,
|
748 |
|
|
rdaddress => adat_addr_7,
|
749 |
|
|
wraddress => madi_channel(2 downto 0),
|
750 |
|
|
wren => madi_write_7,
|
751 |
|
|
q => adat_data_7
|
752 |
|
|
);
|
753 |
|
|
|
754 |
|
|
adat_transmitter_7 : adat_transmitter
|
755 |
|
|
port map(
|
756 |
|
|
data_in => adat_data_7,
|
757 |
|
|
address_out => adat_addr_7,
|
758 |
|
|
bitclk_in => bit_clk_in,
|
759 |
|
|
wordclk_in => word_clk_in,
|
760 |
|
|
adat_out => adat_7_out
|
761 |
|
|
);
|
762 |
|
|
|
763 |
|
|
end behavioral;
|