TDC_REGISTER_02 : out std_logic_vector(31 downto 0);
TDC_REGISTER_03 : out std_logic_vector(31 downto 0);
TDC_REGISTER_04 : out std_logic_vector(31 downto 0);
+ TDC_REGISTER_05 : in std_logic_vector(31 downto 0);
BUNCH_RESET : out std_logic;
EVENT_RESET : out std_logic;
READ_ADRESS_END_UP : out std_logic; --here
signal lvl1_fifo_rd_en_fsm : std_logic;
signal tdc_data_valid_i_fsm : std_logic;
signal lvl1_data_counter : std_logic_vector(15 downto 0):=(others => '0');
+ signal trigger_counter : std_logic_vector(7 downto 0);
+ signal lvl1_code_i : std_logic_vector(3 downto 0);
begin
READ_ADRESS_END_UP <= lvl2_busy_end_pulse; --here
TDC_REGISTER : process (CLK, RESET)
end if;
end if;
end process COUNT_WORDS_IN_EVENT;
+ TRIGGER_COUNTER_PROC : process (CLK, RESET)
+ begin
+ if rising_edge(CLK) then
+ if RESET = '1' then
+ trigger_counter <= (others => '1');
+ elsif trigger_with_gen_pulse = '1' then
+ trigger_counter <= trigger_counter + 1;
+ else
+ trigger_counter <= trigger_counter;
+ end if;
+ end if;
+ end process TRIGGER_COUNTER_PROC;
-- words_in_event <= x"0001" + HOW_MANY_ADD_DATA + 2 + lvl1_buffer_counter;
- lvl1_tag_minus1 <= LVL1_TAG - 1;
- first_header <= x"0" & LVL1_CODE & lvl1_tag_minus1 & words_in_event;
- second_header <= x"030000" & HOW_MANY_ADD_DATA;
-
+ lvl1_tag_minus1 <= trigger_counter when TRIGGER_WITH_GEN_EN = '1' else LVL1_TAG - 1;
+ lvl1_code_i <= x"1" when TRIGGER_WITH_GEN_EN = '1'else LVL1_CODE;
+-- first_header <= x"0" & LVL1_CODE & lvl1_tag_minus1 & words_in_event;
+-- second_header <= x"030000" & HOW_MANY_ADD_DATA;
+ first_header <= x"0" & lvl1_code_i & lvl1_tag_minus1 & words_in_event;
+ second_header <= TDC_REGISTER_05(7 downto 0) & x"0000" & HOW_MANY_ADD_DATA;
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
-- LVL2 logic (only CLK domain)