From 7d5e6d4780af6432c759a221de6064f02f84ba66 Mon Sep 17 00:00:00 2001 From: palka Date: Thu, 21 Feb 2008 15:03:44 +0000 Subject: [PATCH] lvl1 code and trigger counter for stand alone system --- tdc_interface.vhd | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/tdc_interface.vhd b/tdc_interface.vhd index 5d867e8..236dc00 100755 --- a/tdc_interface.vhd +++ b/tdc_interface.vhd @@ -59,6 +59,7 @@ entity tdc_interface is 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 @@ -201,6 +202,8 @@ architecture tdc_interface of tdc_interface is 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) @@ -589,11 +592,25 @@ begin 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) -- 2.43.0