-- PROJECT: D0 Run IIb Trigger L1 Calorimeter upgrade -- -- MODULE: Channel Link Receiver Test Card -- -- ELEMENT: trigger -- -- DESCRIPTION: trigger generator -- Activates a trigger output when the input pattern -- matches the trigger pattern. Each bit can match on 0, -- 1 or can be masked so that it does not participate to -- the trigger. If mask is 0, all bits participate in -- the trigger. Input FORCE is used to set the output -- independentely of all other inputs -- -- AUTHOR: D. Calvet calvet@hep.saclay.cea.fr -- -- DATE AND HISTORY: -- June 2003 : created -- -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.all; -------------------------------------------------------------------------------- -- -- Trigger -- ENTITY trigger is generic ( SIZE : NATURAL := 8 ); port ( ----------------------------------------------------------------------- RESET : in std_logic; -- Reset CLK : in std_logic; -- Clock ----------------------------------------------------------------------- ----------------------------------------------------------------------- -- -- Inputs -- DATA : in std_logic_vector((SIZE-1) downto 0); -- Data MATCH : in std_logic_vector((SIZE-1) downto 0); -- Match MASK : in std_logic_vector((SIZE-1) downto 0); -- Mask FORCE : in std_logic; -- To force a match ----------------------------------------------------------------------- ----------------------------------------------------------------------- -- -- Output -- TRIG : out std_logic -- Indicates a match ----------------------------------------------------------------------- ); END trigger; architecture structure of trigger is begin -- MatchPattern : process(DATA, MATCH, MASK, FORCE) MatchPattern : process(RESET, CLK) variable trig_int : std_logic; begin if RESET = '1' then TRIG <= '0'; elsif CLK'event and CLK = '1' then for i IN SIZE downto 0 loop if i = SIZE then trig_int := '1'; -- assume pattern matches else -- as soon as a bit is non masked and does not match: clear trig_int if MASK(i) = '0' and (DATA(i) /= MATCH(i)) then trig_int := '0'; end if; end if; end loop; TRIG <= trig_int or FORCE; end if; end process; end;