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

Back to eFEX documentation
SerialSorter.vhd
Go to the documentation of this file.
1 
7 
8 library ieee;
9 use ieee.std_logic_1164.all;
10 use IEEE.NUMERIC_STD.all;
11 
12 library work;
13 use work.DataTypes.all;
14 use work.AlgoDataTypes.all;
15 
17 entity SerialSorter is
18  port (
19  clk : in std_logic;
20  clk_out : in std_logic;
21  IN_Load : in std_logic;
22  IN_Clear : in std_logic;
23  IN_Data : in AlgoTriggerObject;
24  OUT_Start : out std_logic;
25  OUT_Data : out AlgoTriggerObject
26  );
27 
28 end entity SerialSorter;
29 
30 
32 architecture str of SerialSorter is
33  -----------------------------------------------------------------------------
34  -- Internal signal declarations
35  -----------------------------------------------------------------------------
36  signal serial : AlgoTriggerObjects(5 downto 0);
37  signal OutputData : AlgoTriggerObjects(4 downto 0);
38  signal Inhibit : std_logic_vector(5 downto 0);
39  signal SyncData : AlgoTriggerObjects(4 downto 0);
40 
41 begin -- architecture str
42 
43  -----------------------------------------------------------------------------
44  -- Component instantiations
45  -----------------------------------------------------------------------------
46  SortingCells : for i in 0 to 4 generate
47  serial(0) <= ZERO_ALGO_TRIGGER_OBJECT;
48  Inhibit(0) <= '0';
49 
50  SORT_CELL : entity work.SortingCell
51  port map (
52  clk => clk,
53  IN_clear => IN_Clear,
54  IN_Previous => serial(i),
55  OUT_Next => serial(i+1),
56  IN_Parallel => IN_Data,
57  IN_Inhibit => Inhibit(i),
58  OUT_Inhibit => Inhibit(i+1));
59  end generate SortingCells;
60 
61  -- Just before the sorter gets cleared saves the data in the SyncData buffer
62  Sync_proc : process (clk)
63  begin
64  if rising_edge(clk) then
65  if IN_Clear = '1' then
66  SyncData <= serial(5 downto 1);
67  else
68  SyncData <= SyncData;
69  end if;
70  end if;
71  end process Sync_proc;
72 
73  -- When IN_Load comes, in the 280 domain, transers the data from SyncData to Output data
74  Output_proc : process (clk_out)
75  begin -- process Output_proc
76  if rising_edge(clk_out) then
77  if IN_Load = '1' then
78  OUT_Start <= '1';
79  OutputData <= SyncData;
80  else
81  OUT_Start <= '0';
82  OutputData(OutputData'high) <= ZERO_ALGO_TRIGGER_OBJECT;
83  for i in OutputData'low to OutputData'high-1 loop
84  OutputData(i) <= OutputData(i+1);
85  end loop; -- i
86  end if;
87  end if;
88  end process Output_proc;
89 
90  OUT_Data <= OutputData(0);
91 
92 end architecture str;
93 
94 -------------------------------------------------------------------------------
External data-types and functions.
array(natural range <> ) of AlgoTriggerObject AlgoTriggerObjects
Algorithm OUTPUT port.
std_logic_vector( OUT_TOB_WIDTH- 1 downto 0) AlgoTriggerObject
Algorithm Trigger Object TOB.
Serial sorter module.
Serial sorter module.
Serial sorter Cell.
Definition: SortingCell.vhd:17