eFEX firmware  1.7.3
ATLAS l1-calo - electron and tau feature extraction firmware for eFEX boards

Back to eFEX documentation
crc_checker.vhd
Go to the documentation of this file.
1 
7 library IEEE;
8 use IEEE.STD_LOGIC_1164.ALL;
9 USE ieee.std_logic_arith.all;
11  entity crc_checker is
12  port (
14  clk :in std_logic;
16  reset :in std_logic;
17  enable_mgt : in std_logic;
19  mgt_commdet :in std_logic;
21  rxdata :in std_logic_vector(31 downto 0);
23  crc_error :out std_logic
25  );
26  end crc_checker;
28 
29  architecture behavioral of crc_checker is
30  constant REVERSE_BIT_ORDER : boolean := TRUE;
31 
32  signal start_rxcrc_i : std_logic := '0';
33  signal start_rxcrc_temp : std_logic := '0';
34 
35  signal rx_data_i : std_logic_vector(31 downto 0);
36  signal rx_crc_i : std_logic_vector(8 downto 0) := (others => '0');
37  signal rx_crc_temp : std_logic_vector(8 downto 0) := (others => '0');
38  signal enable_i : std_logic;
39  signal crc_error_i : std_logic := '0';
40 
41  type state_type is ( idle, high_crc ) ;
42  signal current_state : state_type;
43  signal count_40 :unsigned (2 downto 0) := "000";
44 
45  begin
46  crc_error <= crc_error_i ;
47  pipe_start : process(clk)
48  variable count: unsigned(2 downto 0);
49  begin
50  if clk' event and clk ='1' then
51  if mgt_commdet ='1' or count = 6 then
52  count := (others => '0');
53  start_rxcrc_i <= '1';
54  else
55  count := count + 1;
56  start_rxcrc_i <= '0';
57  end if;
58  end if;
59  end process;
60 
61  -- pipeline the incoming rx data
62  pipe_rxdata: process (clk)
63  begin
64  if clk' event and clk ='1' then
65  if mgt_commdet ='1' then
66  rx_data_i <= rxdata (31 downto 8) & x"00";
67  else
68  rx_data_i <= rxdata;
69  end if;
70  end if;
71  end process;
72 
73 
74  RX: entity work.osum_crc9d32
75  generic map(
76  REVERSE_BIT_ORDER => REVERSE_BIT_ORDER)
77  port map (
78  d_in => rx_data_i,
79  crc_start => start_rxcrc_i,
80  clock => clk,
81  crc_out => rx_crc_i
82  );
83 -- check crc if is zero
84  Check_crc: process (clk)
85  begin
86  if clk' event and clk ='1' then
87  enable_i <= start_rxcrc_i;
88  if (start_rxcrc_i = '1' and enable_mgt = '1' and rx_crc_i /= "000000000") then
89  crc_error_i <= '1';
90  else
91  crc_error_i <= '0';
92  end if;
93  end if;
94  end process;
95 
96 
97 
98 
99 end behavioral;
crc checker
Definition: crc_checker.vhd:11
in reset std_logic
reset
Definition: crc_checker.vhd:16
in clk std_logic
MGT rx clock.
Definition: crc_checker.vhd:14
in mgt_commdet std_logic
MGT commadet.
Definition: crc_checker.vhd:19
in rxdata std_logic_vector( 31 downto 0)
MGT rx data.
Definition: crc_checker.vhd:21
out crc_error std_logic
crc error crc error in 40MHz clock domain
Definition: crc_checker.vhd:25