Revision 1499
Added by markw 3 days ago
| spdif_transmitter.vhdl | ||
|---|---|---|
|
entity spdif_transmitter is
|
||
|
port(
|
||
|
bit_clock : in std_logic; -- 128x Fsample (6.144MHz for 48K samplerate)
|
||
|
data_in : in std_logic_vector(23 downto 0);
|
||
|
address_out : out std_logic := '0'; -- 1 address bit means stereo only
|
||
|
left_in : in std_logic_vector(23 downto 0);
|
||
|
right_in : in std_logic_vector(23 downto 0);
|
||
|
spdif_out : out std_logic
|
||
|
);
|
||
|
end entity spdif_transmitter;
|
||
| ... | ... | |
|
if bit_clock'event and bit_clock = '1' then
|
||
|
parity <= data_in_buffer(23) xor data_in_buffer(22) xor data_in_buffer(21) xor data_in_buffer(20) xor data_in_buffer(19) xor data_in_buffer(18) xor data_in_buffer(17) xor data_in_buffer(16) xor data_in_buffer(15) xor data_in_buffer(14) xor data_in_buffer(13) xor data_in_buffer(12) xor data_in_buffer(11) xor data_in_buffer(10) xor data_in_buffer(9) xor data_in_buffer(8) xor data_in_buffer(7) xor data_in_buffer(6) xor data_in_buffer(5) xor data_in_buffer(4) xor data_in_buffer(3) xor data_in_buffer(2) xor data_in_buffer(1) xor data_in_buffer(0) xor channel_status_shift(23);
|
||
|
if bit_counter = "000011" then
|
||
|
data_in_buffer <= data_in;
|
||
|
if frame_counter(0) = '0' then
|
||
|
data_in_buffer <= left_in;
|
||
|
else
|
||
|
data_in_buffer <= right_in;
|
||
|
end if;
|
||
|
end if;
|
||
|
if bit_counter = "111111" then
|
||
|
if frame_counter = "101111111" then
|
||
| ... | ... | |
|
if bit_clock'event and bit_clock = '1' then
|
||
|
if bit_counter = "111111" then
|
||
|
if frame_counter = "101111111" then -- next frame is 0, load preamble Z
|
||
|
address_out <= '0';
|
||
|
channel_status_shift <= channel_status;
|
||
|
data_out_buffer <= "10011100";
|
||
|
else
|
||
|
if frame_counter(0) = '1' then -- next frame is even, load preamble X
|
||
|
channel_status_shift <= channel_status_shift(22 downto 0) & '0';
|
||
|
data_out_buffer <= "10010011";
|
||
|
address_out <= '0';
|
||
|
else -- next frame is odd, load preable Y
|
||
|
data_out_buffer <= "10010110";
|
||
|
address_out <= '1';
|
||
|
end if;
|
||
|
end if;
|
||
|
else
|
||
Disable lowpass again, remembered the filter is explicit for spdif output (where it matters). Make spdif component explicitly have a port for left/right. Get all versions building again (some needed old dac for space reasons). Change default volume for adc and sio mixing for v4.5 (SHOULD not need the filtering there, testing now).