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

Back to eFEX documentation
fsm_TOB_double_word.vhd
Go to the documentation of this file.
1 
9 
10 
11 library IEEE;
12 use IEEE.STD_LOGIC_1164.ALL;
13 
14 use IEEE.NUMERIC_STD.ALL;
15 
16 library TOB_rdout_lib;
17 use TOB_rdout_lib.TOB_rdout_ip_pkg.ALL;
18 use TOB_rdout_lib.data_type_pkg.all;
19 
22  Port (
24  CLK_IN : in STD_LOGIC;
26  rst_in : in std_logic ;
28  TOB_data_in : in STD_LOGIC_VECTOR (31 downto 0);
30  double_counter_en : out std_logic;
32  DPR_wr_enable : out STD_LOGIC
33  );
35 
37 architecture Behavioral of fsm_TOB_double_word is
38 
39  signal double_reg_1 : STD_LOGIC_VECTOR (31 downto 0);
40  signal double_reg_2 : STD_LOGIC_VECTOR (31 downto 0);
41 
42  TYPE STATE_TYPE IS (
43  idle,
44  ser_1,
45  ser_2,
46  ser_3,
47  ser_4
48  ) ;
49 
50  SIGNAL current_state : STATE_TYPE;
51  signal count : integer range 0 to 7;
52  signal tmp : std_logic_vector (7 downto 0);
53 
54 begin
55 
56 U0_clk_proc : process (CLK_IN)
57  begin
58  if CLK_IN'event and CLK_IN = '1' then
59 
60  end if;
61  end process;
62 
63 -- This FSM checks TOBs data for double identical words
64 
65 U3_rd_XTOB_fsm : process (CLK_IN)
66 
67  begin
68  if CLK_IN'event and CLK_IN = '1' then
69  if ( rst_in = '1' )then -- RST
70  current_state <= idle ;
71  double_counter_en <= '0' ;
72  DPR_wr_enable <= '0' ;
73  double_reg_1 <= X"00000000";
74  double_reg_2 <= X"00000000";
75  else
76  double_reg_1 <= TOB_data_in; -- latch TOB data
77  double_reg_2 <= double_reg_1; -- latch TOB data
78 
79  CASE current_state is
80  when idle =>
81  double_counter_en <= '0' ; -- signal to increment double word counter
82  DPR_wr_enable <= '1' ; -- signal to enable wrting into SPY RAM
83  if double_reg_1 = double_reg_2 then
84  if double_reg_2 = X"00000000" or double_reg_2 = X"000000BC" then
85  current_state <= idle ;
86  else
87  current_state <= ser_1 ;
88  end if;
89  else
90  current_state <= idle ;
91  end if;
92  when ser_1 =>
93  double_counter_en <= '1' ; -- signal to increment double word counter
94  DPR_wr_enable <= '1' ; -- wrting into SPY RAM
95  current_state <= ser_2 ; -- was ser_2
96 
97  when ser_2 =>
98  double_counter_en <= '0' ; -- signal to increment double word counter
99  DPR_wr_enable <= '0' ; -- disablee wrting into SPY RAM
100  current_state <= ser_2 ; -- was ser_2
101  if ( rst_in = '1' )then -- RST
102  current_state <= idle ;
103  DPR_wr_enable <= '1' ; -- signal to enable wrting into SPY RAM
104  end if;
105 
106  when others =>
107  NULL;
108  end case;
109  end if;
110  END IF;
111  end process;
112 
113  tmp <= std_logic_vector(to_unsigned(count, tmp'length));
114 
115 --U2_ila_XTOB_BCN_in : ila_ipbus_fabric_rd_wr
116 --PORT MAP (
117 -- clk => CLK_IN,
118 -- probe0(7 downto 0) => tmp , -- 36b
119 -- probe0(15 downto 8) => (others => '0') , -- 36b
120 -- probe0(24 downto 16) => DPR_rd_addr_i (8 downto 0), -- 36b
121 -- probe0(33 downto 25) => DPR_wr_addr_i (8 downto 0) , -- 36b
122 -- probe0(35 downto 34) => (others => '0') , -- 36b
123 -- probe1 => (others => '0'), -- 36b
124 -- probe2(0) => SIPO_sync_in_i , -- 1b
125 -- probe3(0) => DRP_rd_en_i , -- 1b
126 -- probe4(0) => FIFO_wr_en_i , -- 1b
127 -- probe5 => (others => '0'), -- 36b
128 -- probe6 => (others => '0'), -- 36b
129 -- probe7(0) => L1A_in, -- 1b
130 -- probe8(0) => TOB_FIFO_sw_rst , -- 1b
131 -- probe9(0) => '0' -- 1b
132 --);
133 
134 end Behavioral;
135 
Top of fsm_TOB_double_word for process FPGA.
Top of fsm_TOB_double_word for process FPGA.
out double_counter_en std_logic
Enable double counter updon detection of double identical words.
out DPR_wr_enable STD_LOGIC
DPRAM write enable.
in CLK_IN STD_LOGIC
Clock input signal.
in TOB_data_in STD_LOGIC_VECTOR( 31 downto 0)
TOB data input.
in rst_in std_logic
Reset input.