Line 44... |
Line 44... |
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
--
|
--
|
-- CVS Revision History
|
-- CVS Revision History
|
--
|
--
|
-- $Log: not supported by cvs2svn $
|
-- $Log: not supported by cvs2svn $
|
|
-- Revision 1.2 2004/06/16 19:04:09 gedra
|
|
-- Fixed a few bugs.
|
|
--
|
-- Revision 1.1 2004/06/13 18:07:47 gedra
|
-- Revision 1.1 2004/06/13 18:07:47 gedra
|
-- Frame decoder and sample extractor
|
-- Frame decoder and sample extractor
|
--
|
--
|
--
|
--
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_arith.all;
|
use ieee.numeric_std.all;
|
|
|
entity rx_decode is
|
entity rx_decode is
|
generic (DATA_WIDTH: integer range 16 to 32;
|
generic (DATA_WIDTH: integer range 16 to 32;
|
ADDR_WIDTH: integer range 8 to 64);
|
ADDR_WIDTH: integer range 8 to 64);
|
port (
|
port (
|
Line 89... |
Line 92... |
signal adr_cnt : integer range 0 to 2**(ADDR_WIDTH - 1) - 1;
|
signal adr_cnt : integer range 0 to 2**(ADDR_WIDTH - 1) - 1;
|
type samp_states is (IDLE, CHA_SYNC, GET_SAMP, PAR_CHK);
|
type samp_states is (IDLE, CHA_SYNC, GET_SAMP, PAR_CHK);
|
signal sampst : samp_states;
|
signal sampst : samp_states;
|
signal bit_cnt, par_cnt : integer range 0 to 31;
|
signal bit_cnt, par_cnt : integer range 0 to 31;
|
signal samp_start : integer range 0 to 15;
|
signal samp_start : integer range 0 to 15;
|
signal tmp_data : std_logic_vector(DATA_WIDTH - 6 downto 0);
|
signal tmp_data : std_logic_vector(26 downto 0);
|
signal tmp_stat : std_logic_vector(4 downto 0);
|
signal tmp_stat : std_logic_vector(4 downto 0);
|
signal valid, next_is_a, blk_start : std_logic;
|
signal valid, next_is_a, blk_start : std_logic;
|
|
|
begin
|
begin
|
|
|
Line 126... |
Line 129... |
next_is_a <= '1';
|
next_is_a <= '1';
|
if lock = '1' and conf_sample = '1' then
|
if lock = '1' and conf_sample = '1' then
|
sampst <= CHA_SYNC;
|
sampst <= CHA_SYNC;
|
end if;
|
end if;
|
when CHA_SYNC =>
|
when CHA_SYNC =>
|
wr_addr <= CONV_STD_LOGIC_VECTOR(adr_cnt, ADDR_WIDTH - 1);
|
wr_addr <= std_logic_vector(to_unsigned(adr_cnt, ADDR_WIDTH - 1));
|
wr_en <= '0';
|
wr_en <= '0';
|
bit_cnt <= 0;
|
bit_cnt <= 0;
|
valid <= '0';
|
valid <= '0';
|
par_cnt <= 0;
|
par_cnt <= 0;
|
stat_paritya <= '0';
|
stat_paritya <= '0';
|
stat_parityb <= '0';
|
stat_parityb <= '0';
|
stat_lsbf <= '0';
|
stat_lsbf <= '0';
|
stat_hsbf <= '0';
|
stat_hsbf <= '0';
|
tmp_data(DATA_WIDTH - 6 downto 0) <= (others => '0');
|
tmp_data(26 downto 0) <= (others => '0');
|
if rx_block_start = '1' and conf_blken = '1' then
|
if rx_block_start = '1' and conf_blken = '1' then
|
blk_start <= '1';
|
blk_start <= '1';
|
end if;
|
end if;
|
if rx_frame_start = '1' and rx_channel_a = next_is_a then
|
if rx_frame_start = '1' and rx_channel_a = next_is_a then
|
next_is_a <= not next_is_a;
|
next_is_a <= not next_is_a;
|