From aae492f5c6ba78d31a14817374c699bf52d3d85d Mon Sep 17 00:00:00 2001 From: hadeshyp Date: Thu, 1 Jul 2010 08:06:58 +0000 Subject: [PATCH] *** empty log message *** --- special/handler_lvl1.vhd | 96 +++++++++++++++++++++++++++++++++++----- 1 file changed, 85 insertions(+), 11 deletions(-) diff --git a/special/handler_lvl1.vhd b/special/handler_lvl1.vhd index 29648d9..4079f48 100644 --- a/special/handler_lvl1.vhd +++ b/special/handler_lvl1.vhd @@ -8,30 +8,35 @@ use work.trb_net_components.all; entity handler_lvl1 is + generic( + TIMING_TRIGGER_RAW : integer range 0 to 1 := c_YES + ); port ( RESET : in std_logic; CLOCK : in std_logic; --Timing Trigger - LVL1_TIMING_TRG_IN : in std_logic; - LVL1_INT_TRG_NUMBER_IN : in std_logic_vector(15 downto 0); + LVL1_TIMING_TRG_IN : in std_logic; --raw trigger signal input, min. 80 ns or strobe, see generics + LVL1_PSEUDO_TMG_TRG_IN : in std_logic; --strobe for dummy timing trigger --LVL1_handler connection - LVL1_TRG_TYPE_IN : in std_logic_vector(3 downto 0); LVL1_TRG_RECEIVED_IN : in std_logic; + LVL1_TRG_TYPE_IN : in std_logic_vector(3 downto 0); LVL1_TRG_NUMBER_IN : in std_logic_vector(15 downto 0); LVL1_TRG_CODE_IN : in std_logic_vector(7 downto 0); LVL1_TRG_INFORMATION_IN : in std_logic_vector(23 downto 0); LVL1_ERROR_PATTERN_OUT : out std_logic_vector(31 downto 0); LVL1_TRG_RELEASE_OUT : out std_logic := '0'; + LVL1_INT_TRG_NUMBER_OUT : out std_logic_vector(15 downto 0); + --FEE logic / Data Handler - FEE_TIMING_TRIGGER_OUT : out std_logic; --timing trigger (registered) - FEE_TRG_RECEIVED_OUT : out std_logic; --TRG Info valid & FEE busy - FEE_TRG_TYPE_OUT : out std_logic_vector(3 downto 0); --trigger type - FEE_TRG_INFO_OUT : out std_logic_vector(23 downto 0); --further trigger details - FEE_TRG_CODE_OUT : out std_logic_vector(7 downto 0); --further trigger details - FEE_TRG_NUMBER_OUT : out std_logic_vector(15 downto 0); --trigger number - FEE_RELEASE_IN : in std_logic; - FEE_TRG_STATUSBITS_IN : in std_logic_vector(31 downto 0); + LVL1_TRG_DATA_VALID_OUT : out std_logic; --trigger type, number, code, information are valid + LVL1_VALID_TIMING_TRG_OUT : out std_logic; --valid timing trigger has been received + LVL1_VALID_NOTIMING_TRG_OUT : out std_logic; --valid trigger without timing trigger has been received + LVL1_INVALID_TRG_OUT : out std_logic; --the current trigger is invalid (e.g. no timing trigger, no LVL1...) + + LVL1_ERROR_PATTERN_IN : in std_logic_vector(31 downto 0); + LVL1_TRG_RELEASE_IN : in std_logic := '0'; + --Debug DEBUG_OUT : out std_logic_vector (15 downto 0) @@ -43,4 +48,73 @@ architecture handler_lvl1_arch of handler_lvl1 is begin +--This code is copied from endpoint_hades_full + +-- ------------------------------------------------- +-- -- Check LVL1 trigger number +-- ------------------------------------------------- +-- proc_internal_trigger_number : process(CLK) +-- begin +-- if rising_edge(CLK) then +-- if reset_no_link = '1' then +-- int_trigger_num <= (others => '0'); +-- elsif LVL1_TRG_RECEIVED_OUT_falling = '1' then +-- int_trigger_num <= int_trigger_num + 1; +-- elsif buf_COMMON_CTRL_REG_STROBE(1) = '1' then +-- int_trigger_num <= buf_REGIO_COMMON_CTRL_REG_OUT(47 downto 32); +-- end if; +-- end if; +-- end process; +-- +-- proc_check_trigger_number : process(CLK) +-- begin +-- if rising_edge(CLK) then +-- if reset_no_link = '1' or LVL1_TRG_RECEIVED_OUT_falling = '1' then +-- trigger_number_match <= '1'; +-- elsif LVL1_TRG_RECEIVED_OUT_rising = '1' then +-- if int_trigger_num = buf_LVL1_TRG_NUMBER_OUT then +-- trigger_number_match <= '1'; +-- else +-- trigger_number_match <= '0'; +-- end if; +-- end if; +-- end if; +-- end process; +-- +-- +-- proc_detect_trigger_receive : process(CLK) +-- begin +-- if rising_edge(CLK) then +-- last_LVL1_TRG_RECEIVED_OUT <= buf_LVL1_TRG_RECEIVED_OUT; +-- LVL1_TRG_RECEIVED_OUT_rising <= buf_LVL1_TRG_RECEIVED_OUT and not last_LVL1_TRG_RECEIVED_OUT; +-- LVL1_TRG_RECEIVED_OUT_falling <= not buf_LVL1_TRG_RECEIVED_OUT and last_LVL1_TRG_RECEIVED_OUT; +-- +-- if reset_no_link = '1' or LVL1_TRG_RECEIVED_OUT_falling = '1' then +-- got_timing_trigger <= '0'; +-- got_timingless_trigger <= '0'; +-- timing_trigger_missing <= '0'; +-- elsif TRG_TIMING_TRG_RECEIVED_IN = '1' then +-- got_timing_trigger <= '1'; +-- elsif (LVL1_TRG_RECEIVED_OUT_rising = '1' and buf_LVL1_TRG_TYPE_OUT >= x"8" and buf_LVL1_TRG_INFORMATION_OUT(7) = '1') then +-- got_timingless_trigger <= '1'; +-- elsif (LVL1_TRG_RECEIVED_OUT_rising = '1' and not (buf_LVL1_TRG_TYPE_OUT >= x"8" and buf_LVL1_TRG_INFORMATION_OUT(7) = '1')) then +-- timing_trigger_missing <= '1'; +-- end if; +-- end if; +-- end process; +-- +-- +-- proc_gen_lvl1_error_pattern : process(LVL1_ERROR_PATTERN_IN, trigger_number_match, got_timing_trigger,got_timingless_trigger ) +-- begin +-- buf_LVL1_ERROR_PATTERN_IN <= LVL1_ERROR_PATTERN_IN; +-- buf_LVL1_ERROR_PATTERN_IN(16) <= not trigger_number_match or LVL1_ERROR_PATTERN_IN(16); +-- buf_LVL1_ERROR_PATTERN_IN(17) <= (not got_timing_trigger and not got_timingless_trigger) or LVL1_ERROR_PATTERN_IN(17); +-- end process; +-- +-- buf_LVL1_VALID_TIMING_TRG_OUT <= TRG_TIMING_TRG_RECEIVED_IN; +-- buf_LVL1_VALID_NOTIMING_TRG_OUT <= LVL1_TRG_RECEIVED_OUT_rising and not got_timing_trigger +-- and buf_LVL1_TRG_TYPE_OUT(3) and buf_LVL1_TRG_INFORMATION_OUT(7); +-- buf_LVL1_INVALID_TRG_OUT <= '0'; + + end architecture; \ No newline at end of file -- 2.43.0