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

Back to eFEX documentation
ttc_crc_sm.vhd
Go to the documentation of this file.
1 
9 
11 library ieee;
12 use ieee.std_logic_1164.all;
13 use ieee.std_logic_arith.all;
14 
16 entity ttc_crc_sm is
17  port(
19  clk : in std_logic;
21  mgt_commdet : in std_logic;
22  mgt_enable : in std_logic;
24  reset : in std_logic;
26  rxdata : in std_logic_vector (31 DOWNTO 0);
28  check_crc : out std_logic;
30  crc_data : out std_logic_vector (31 DOWNTO 0);
32  latch_crc : out std_logic;
34  rxdata_crc_in : out std_logic_vector (8 DOWNTO 0);
36  start_crc : out std_logic;
37  crc_rdy : out std_logic
38  );
39 
40 
41 end entity ttc_crc_sm ;
43 architecture fsm of ttc_crc_sm is
44 
45  type state_type is (
46  idle,
47  st0,
48  st1,
49  st2,
50  st3,
51  st4
52  );
53 
54  signal current_state : state_type;
55 
56 begin
57 
58 
59  clocked_proc : process ( clk, reset)
60 
61  begin
62  if (reset = '1') then
63  current_state <= idle;
64  check_crc <= '0';
65  crc_data <= (others => '0');
66  latch_crc <= '0';
67  rxdata_crc_in <= (others => '0');
68  start_crc <= '0';
69  crc_rdy <= '0';
70  elsif (clk'event and clk = '1') then
71 
72  case current_state is
73  when idle =>
74  latch_crc <= '0';
75  if (mgt_commdet ='1' and mgt_enable ='1') then
76  current_state <= st0;
77  else
78  current_state <= idle;
79  end if;
80  when st0 =>
81  start_crc <= '1';
82 -- crc_data <= rxdata(31 downto 8) & x"00";
83  check_crc <= '0' ;
84  latch_crc <= '0';
85  current_state <= st1;
86  when st1 =>
87  start_crc <= '0';
88  crc_data <= rxdata(31 downto 8) & x"00"; --crc_data <= rxdata(31 downto 0);
89  check_crc <= '1' ;
90  latch_crc <= '0';
91  current_state <= st2;
92  when st2 =>
93  crc_data <= rxdata(31 downto 0);
94  check_crc <= '0' ;
95  crc_rdy <= '1';
96  current_state <= st3;
97  when st3 =>
98  crc_data <= rxdata(31 downto 0);
99  current_state <= st4;
100  when st4 =>
101  crc_data <= "000000000" & rxdata(22 downto 0) ;
102  rxdata_crc_in <= rxdata (31 downto 23);
103  latch_crc <= '1';
104  start_crc <= '1';
105  crc_rdy <= '0';
106  -- if (mgt_commdet ='1') then
107  current_state <= st1;
108  -- else
109  -- current_state <= st4;
110  -- end if;
111  when others =>
112  current_state <= idle;
113  end case;
114  end if;
115  end process clocked_proc;
116 
117 end architecture fsm;
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