Line 42... |
Line 42... |
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
--
|
--
|
-- CVS Revision History
|
-- CVS Revision History
|
--
|
--
|
-- $Log: not supported by cvs2svn $
|
-- $Log: not supported by cvs2svn $
|
|
-- Revision 1.1 2004/08/03 18:49:43 gedra
|
|
-- I2S encoder/decoder.
|
|
--
|
--
|
--
|
--
|
--
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
Line 59... |
Line 62... |
port (
|
port (
|
wb_clk_i: in std_logic; -- wishbone clock
|
wb_clk_i: in std_logic; -- wishbone clock
|
conf_res: in std_logic_vector(5 downto 0); -- sample resolution
|
conf_res: in std_logic_vector(5 downto 0); -- sample resolution
|
conf_ratio: in std_logic_vector(7 downto 0); -- clock divider ratio
|
conf_ratio: in std_logic_vector(7 downto 0); -- clock divider ratio
|
conf_swap: in std_logic; -- left/right sample order
|
conf_swap: in std_logic; -- left/right sample order
|
conf_inten: in std_logic; -- interrupt enable
|
|
conf_en: in std_logic; -- transmitter/recevier enable
|
conf_en: in std_logic; -- transmitter/recevier enable
|
i2s_sd_i: in std_logic; -- I2S serial data input
|
i2s_sd_i: in std_logic; -- I2S serial data input
|
i2s_sck_i: in std_logic; -- I2S clock input
|
i2s_sck_i: in std_logic; -- I2S clock input
|
i2s_ws_i: in std_logic; -- I2S word select input
|
i2s_ws_i: in std_logic; -- I2S word select input
|
sample_dat_i: in std_logic_vector(DATA_WIDTH - 1 downto 0); -- audio data
|
sample_dat_i: in std_logic_vector(DATA_WIDTH - 1 downto 0); -- audio data
|
Line 337... |
Line 339... |
i2s_sd_o <= sample_dat_i(bits_to_trx - bit_cnt);
|
i2s_sd_o <= sample_dat_i(bits_to_trx - bit_cnt);
|
else
|
else
|
bit_cnt <= bit_cnt + 1;
|
bit_cnt <= bit_cnt + 1;
|
if bit_cnt > bits_to_trx then
|
if bit_cnt > bits_to_trx then
|
i2s_sd_o <= '0';
|
i2s_sd_o <= '0';
|
|
else
|
|
i2s_sd_o <= sample_dat_i(0);
|
end if;
|
end if;
|
-- transmitter address counter
|
-- transmitter address counter
|
imem_rdwr <= '1';
|
imem_rdwr <= '1';
|
adr_cnt <= (adr_cnt + 1) mod 2**(ADDR_WIDTH - 1);
|
adr_cnt <= (adr_cnt + 1) mod 2**(ADDR_WIDTH - 1);
|
if adr_cnt = 2**(ADDR_WIDTH - 2) - 1 then
|
if adr_cnt = 2**(ADDR_WIDTH - 2) - 1 then
|
Line 364... |
Line 368... |
else
|
else
|
bit_cnt <= bit_cnt + 1;
|
bit_cnt <= bit_cnt + 1;
|
if bit_cnt > bits_to_trx then
|
if bit_cnt > bits_to_trx then
|
i2s_sd_o <= '0';
|
i2s_sd_o <= '0';
|
else
|
else
|
i2s_sd_o <= sample_dat_i(bits_to_trx - bit_cnt);
|
i2s_sd_o <= sample_dat_i(0);
|
end if;
|
end if;
|
if new_word = '1' then -- transmitter address counter
|
if new_word = '1' then -- transmitter address counter
|
imem_rdwr <= '1';
|
imem_rdwr <= '1';
|
adr_cnt <= (adr_cnt + 1) mod 2**(ADDR_WIDTH - 1);
|
adr_cnt <= (adr_cnt + 1) mod 2**(ADDR_WIDTH - 1);
|
if adr_cnt = 2**(ADDR_WIDTH - 2) - 1 then
|
if adr_cnt = 2**(ADDR_WIDTH - 2) - 1 then
|