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

Back to eFEX documentation
link_errors_ORed.vhd
Go to the documentation of this file.
1 
11 
12 library IEEE;
13 use IEEE.STD_LOGIC_1164.ALL;
14 use IEEE.NUMERIC_STD.ALL;
15 
16 library UNISIM;
17 use UNISIM.VCOMPONENTS.ALL;
18 
19 library TOB_rdout_lib;
20 use TOB_rdout_lib.data_type_pkg.all;
21 use TOB_rdout_lib.TOB_rdout_ip_pkg.all;
22 
25  Generic
26  ( N : integer ) ;
27  Port (
28  clk_in : in STD_LOGIC;
29  rst_in : in STD_LOGIC;
31  en_error_valid_in : in STD_LOGIC;
33  err_flag_in : in link_error_type;
35  err_flag_out : out STD_LOGIC_VECTOR (3 downto 0);
37  channel_error_map : out STD_LOGIC_VECTOR (48 downto 0);
39  req_err_rd_raw : out std_logic
40  );
42 
44 architecture Behavioral of link_errors_ORed is
45 
46  signal err_flag_tmp : link_error_type ;
47 -- signal n : integer := 0 ;
48 
49 begin
50  -- OR all error flags and then set ERR RDOUT bit
51  err_flag_tmp(0) <= err_flag_in(0);
52  gen: for i in 1 to N-1 generate -- 48 channels
53  err_flag_tmp(i) <= err_flag_tmp(i-1) OR err_flag_in(i); -- error flag for all links.
54  end generate;
55 
56 -- create flag to read calorimeter data on error
57 U0: process (clk_in)
58  begin
59  if (clk_in'event and clk_in = '1') then
60  if rst_in = '1' then
61  err_flag_out <= (others => '0') ;
62  req_err_rd_raw <= '0' ;
63  else
64  if en_error_valid_in = '1' then
65  err_flag_out <= err_flag_tmp(N-1); -- set output zero + input_crc + input_disparity + not_in_table
66  if err_flag_tmp(N-1) /= "0000" then -- if error set, RAW data request
67  req_err_rd_raw <= '1' ; -- set flag to read calorimeter data on error
68  else
69  req_err_rd_raw <= '0' ;
70  end if;
71  end if;
72  end if ;
73  end if;
74  end process;
75 
76 -- create 49-bit channel error map
77 U1: process (clk_in)
78  begin
79  if (clk_in'event and clk_in = '1') then
80  if rst_in = '1' then
81  channel_error_map <= (others => '0') ;
82  else
83  if en_error_valid_in = '1' then
84  for i in 0 to 48 loop
85  channel_error_map(i) <= OR (err_flag_in(i)); -- every OR'ed error flag is assigned to 1 bit of the register.
86  end loop;
87  end if;
88  end if;
89  end if;
90  end process;
91 
92 end Behavioral;