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

Back to eFEX documentation
cntrl_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;
10 library infrastructure_lib;
11 use infrastructure_lib.all;
14  port (
16  clk :in std_logic;
18  reset :in std_logic;
20  mgt_enable :in std_logic;
22  mgt_commdet :in std_logic;
24  rxdata :in std_logic_vector(31 downto 0);
26  crc_error :out std_logic
27 
28  );
29 
30  end cntrl_crc_checker;
31 
33 
34  architecture behavioral of cntrl_crc_checker is
35 
36 
37  constant REVERSE_BIT_ORDER : boolean := FALSE;
38  signal start_rxcrc_i,crc_error_i : std_logic:='0';
39  signal rx_data_i,rxdata_reg0,rxdata_reg1,rxdata_reg2 : std_logic_vector(31 downto 0):= x"00000000";
40  signal rxdata_crc_in, rx_crc_i,rxdata_crc_reg : std_logic_vector(8 downto 0):= "000000000";
41  signal check_crc,latch_crc,crc_start_reg,crc_rdy_i : std_logic := '0';
42 
43  type state_type is ( idle,wt,high_crc ) ;
44  signal current_state : state_type;
45 
46 
47 begin
48 
49 
50  pipe_rxdata_crc: process (clk)
51  begin
52  if clk' event and clk ='1' then
53  if latch_crc ='1' then
54  rxdata_crc_reg <= rxdata_crc_in;
55  end if;
56  end if;
57  end process;
58 
59 
60 pipe_rxdata: process (clk)
61  begin
62  if clk' event and clk ='1' then
63  rxdata_reg0 <= rxdata after 1 ns ;
64  rxdata_reg1 <= rxdata_reg0 after 1 ns ;
65  crc_start_reg <= start_rxcrc_i after 1 ns;
66  end if;
67  end process;
68 
69  RX: entity work.osum_crc9d32
70  generic map(
71  REVERSE_BIT_ORDER => REVERSE_BIT_ORDER)
72  port map (
73 
74  d_in => rx_data_i,
75  crc_start => crc_start_reg and mgt_enable ,
76  clock => clk,
77  crc_out => rx_crc_i
78 
79  );
80 
81 crc_sm : entity infrastructure_lib.ttc_crc_sm
82  port map (
83  clk => clk,
85  reset => reset,
86  mgt_enable => mgt_enable,
87  rxdata => rxdata_reg1,
88  check_crc => check_crc,
89  crc_data => rx_data_i,
90  latch_crc => latch_crc ,
91  rxdata_crc_in => rxdata_crc_in,
92  start_crc => start_rxcrc_i,
93  crc_rdy => crc_rdy_i
94  );
95 
96 
97 crc_error_i <= '1' when (rxdata_crc_reg /= rx_crc_i and (check_crc ='1')) else '0';
98 crc_error <= crc_error_i;
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 end behavioral;
in reset std_logic
reset
in clk std_logic
MGT rx clock of 160MHz.
in mgt_enable std_logic
mgt_enbable
in mgt_commdet std_logic
MGT commadet.
in rxdata std_logic_vector( 31 downto 0)
MGT rx data.
out crc_error std_logic
crc error
in reset std_logic
reset
Definition: ttc_crc_sm.vhd:24
out check_crc std_logic
check crc ready
Definition: ttc_crc_sm.vhd:28
out start_crc std_logic
start calculating crc
Definition: ttc_crc_sm.vhd:36
in clk std_logic
MGT rx clock of 160MHz.
Definition: ttc_crc_sm.vhd:19
in rxdata std_logic_vector( 31 DOWNTO 0)
MGT TTC rx data.
Definition: ttc_crc_sm.vhd:26
in mgt_commdet std_logic
MGT commadet.
Definition: ttc_crc_sm.vhd:21
out latch_crc std_logic
latch crc data
Definition: ttc_crc_sm.vhd:32
out rxdata_crc_in std_logic_vector( 8 DOWNTO 0)
incoming data crc
Definition: ttc_crc_sm.vhd:34
out crc_data std_logic_vector( 31 DOWNTO 0)
crc input data
Definition: ttc_crc_sm.vhd:30