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

Back to eFEX documentation
SortingCell.vhd
Go to the documentation of this file.
1 
6 
7 library ieee;
8 use ieee.std_logic_1164.all;
9 
10 library work;
11 use work.DataTypes.all;
12 use work.AlgoDataTypes.all;
13 
14 -------------------------------------------------------------------------------
15 
17 entity SortingCell is
18 
19 -- generic (
20 -- );
21 
22  port (
23  clk : in std_logic;
24  IN_Clear : in std_logic;
25  IN_Previous : in AlgoTriggerObject;
26  OUT_Next : out AlgoTriggerObject;
27  IN_Parallel : in AlgoTriggerObject;
28  IN_Inhibit : in std_logic;
29  OUT_Inhibit : out std_logic
30  );
31 
32 end entity SortingCell;
33 
34 -------------------------------------------------------------------------------
35 
37 architecture str of SortingCell is
38 
39  -----------------------------------------------------------------------------
40  -- Internal signal declarations
41  -----------------------------------------------------------------------------
42  signal StoredWord : AlgoTriggerObject := ZERO_ALGO_TRIGGER_OBJECT;
43  signal Inhibit : std_logic := '0';
44  signal Selector : std_logic_vector(2 downto 0);
45 
46 -- ####### Attributes ########
47  attribute keep : string ;
48  attribute max_fanout : integer;
49 
50  attribute keep of StoredWord : signal is "true" ;
51  attribute max_fanout of StoredWord : signal is 30;
52 -- ###########################
53 
54 begin -- architecture str
55 
56  Inhibit <= '0' when (TOBEnergy(IN_Parallel) < TOBEnergy(StoredWord)) else '1';
57  OUT_Inhibit <= Inhibit or IN_Clear;
58  OUT_Next <= StoredWord;
59 
60  Selector <= (2 => IN_Clear, 1 => IN_Inhibit, 0 => Inhibit);
61 
62  process (clk)
63  begin
64  if rising_edge(clk) then
65  case Selector is
66  when "000" =>
67  StoredWord <= StoredWord;
68  when "001" =>
69  StoredWord <= IN_Parallel;
70  when "010" =>
71  StoredWord <= IN_Previous;
72  when "011" =>
73  StoredWord <= IN_Previous;
74  when "100" =>
75  StoredWord <= IN_Parallel;
76  when "101" =>
77  StoredWord <= IN_Parallel;
78  when "110" =>
79  StoredWord <= ZERO_ALGO_TRIGGER_OBJECT;
80  when "111" =>
81  StoredWord <= ZERO_ALGO_TRIGGER_OBJECT;
82  when others => null;
83 
84 
85  end case;
86 
87  end if;
88  end process;
89 
90 
91 end architecture str;
92 
93 -------------------------------------------------------------------------------
External data-types and functions.
std_logic_vector( OUT_TOB_WIDTH- 1 downto 0) AlgoTriggerObject
Algorithm Trigger Object TOB.
Serial sorter Cell.
Definition: SortingCell.vhd:37
Serial sorter Cell.
Definition: SortingCell.vhd:17