11 use IEEE.STD_LOGIC_1164.
all;
12 use IEEE.NUMERIC_STD.
all;
21 constant INPUT_DATA_WIDTH : integer := 10;
23 constant INPUT_COLUMNS : integer := 6;
24 constant INPUT_ROWS : integer := 10;
25 constant INPUT_TOWERS : integer := INPUT_ROWS*INPUT_COLUMNS;
31 constant LAYER0 : integer := 1;
32 constant LAYER1 : integer := 4;
33 constant LAYER2 : integer := 4;
34 constant LAYER3 : integer := 1;
35 constant HADRON : integer := 1;
37 constant LAYERS : integer := LAYER0 + LAYER1 + LAYER2 + LAYER3 + HADRON;
43 constant OUT_XTOB_WIDTH : integer := 64;
44 constant OUT_TOB_WIDTH : integer := 32;
45 constant OUTPUT_TOBS : integer := 8;
51 subtype BCID_t is std_logic_vector(6 downto 0);
52 type BCID_array is array(59 downto 0) of BCID_t;
55 subtype AlgoWord is std_logic_vector(INPUT_DATA_WIDTH-1 downto 0);
71 constant ZERO_ALGO_WORD : AlgoWord := (others => '0');
94 Layer1 => ((others => (others => '0'))),
95 Layer2 => ((others => (others => '0'))),
96 Layer3 => ((others => (others => '0'))),
97 Hadron => ((others => (others => '0'))));
140 function to_LogicVector (Y :
AlgoInput; Z :
std_logic_vector(
11 downto 0))
return std_logic_vector;
141 function to_AlgoInput (X :
std_logic_vector)
return AlgoInput;
142 function to_BCN (X :
std_logic_vector)
return std_logic_vector;
144 function to_LogicVector (Y :
AlgoOutput)
return std_logic_vector;
145 function to_AlgoOutput (X :
std_logic_vector)
return AlgoOutput;
146 function to_AlgoXOutput (X :
std_logic_vector)
return AlgoXOutput;
162 for i
in 0 to (INPUT_COLUMNS-
1) loop
163 for j
in 0 to (INPUT_ROWS-
1) loop
175 for i
in 0 to (INPUT_COLUMNS-
1) loop
176 for j
in 0 to (INPUT_ROWS-
1) loop
208 function to_LogicVector
(Y :
AlgoInput; Z :
std_logic_vector(11 downto 0)) return std_logic_vector is
209 variable X :
std_logic_vector(128*INPUT_TOWERS-
1 downto 0);
211 for c
in 0 to (INPUT_COLUMNS-
1) loop
212 for r
in 0 to (INPUT_ROWS-
1) loop
213 X
(127 +
128*
(c*INPUT_ROWS + r
) downto 128*
(c*INPUT_ROWS + r
)) :=
"11" & Z
(9 downto 0) & Y
(c
)(r
).Hadron
(0) & Y
(c
)(r
).Layer3
(0) &
214 "10" & Y
(c
)(r
).Layer2
(3) & Y
(c
)(r
).Layer2
(2) & Y
(c
)(r
).Layer2
(1) &
215 "01" & Y
(c
)(r
).Layer2
(0) & Y
(c
)(r
).Layer1
(3) & Y
(c
)(r
).Layer1
(2) &
216 "00" & Y
(c
)(r
).Layer1
(1) & Y
(c
)(r
).Layer1
(0) & Y
(c
)(r
).Layer0
(0);
227 function to_AlgoInput
(X :
std_logic_vector) return AlgoInput is
230 for c
in 0 to (INPUT_COLUMNS-
1) loop
231 for r
in 0 to (INPUT_ROWS-
1) loop
232 Y
(c
)(r
).Layer0
(0) := X
(INPUT_DATA_WIDTH-
1 + c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
00+r*
128+
0 downto c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
00+r*
128+
0);
233 Y
(c
)(r
).Layer1
(0) := X
(INPUT_DATA_WIDTH-
1 + c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
01+r*
128+
0 downto c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
01+r*
128+
0);
234 Y
(c
)(r
).Layer1
(1) := X
(INPUT_DATA_WIDTH-
1 + c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
02+r*
128+
0 downto c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
02+r*
128+
0);
235 Y
(c
)(r
).Layer1
(2) := X
(INPUT_DATA_WIDTH-
1 + c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
03+r*
128+
2 downto c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
03+r*
128+
2);
236 Y
(c
)(r
).Layer1
(3) := X
(INPUT_DATA_WIDTH-
1 + c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
04+r*
128+
2 downto c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
04+r*
128+
2);
237 Y
(c
)(r
).Layer2
(0) := X
(INPUT_DATA_WIDTH-
1 + c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
05+r*
128+
2 downto c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
05+r*
128+
2);
238 Y
(c
)(r
).Layer2
(1) := X
(INPUT_DATA_WIDTH-
1 + c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
06+r*
128+
4 downto c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
06+r*
128+
4);
239 Y
(c
)(r
).Layer2
(2) := X
(INPUT_DATA_WIDTH-
1 + c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
07+r*
128+
4 downto c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
07+r*
128+
4);
240 Y
(c
)(r
).Layer2
(3) := X
(INPUT_DATA_WIDTH-
1 + c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
08+r*
128+
4 downto c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
8+r*
128+
4);
241 Y
(c
)(r
).Layer3
(0) := X
(INPUT_DATA_WIDTH-
1 + c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
09+r*
128+
6 downto c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
9+r*
128+
6);
242 Y
(c
)(r
).Hadron
(0) := X
(INPUT_DATA_WIDTH-
1 + c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
10+r*
128+
6 downto c*INPUT_ROWS*
128+INPUT_DATA_WIDTH*
10+r*
128+
6);
249 function to_BCN
(X :
std_logic_vector) return std_logic_vector is
250 variable Y :
std_logic_vector(11 downto 0);
252 Y :=
"00"& X
(125 downto 116);
258 function to_LogicVector
(Y :
AlgoOutput) return std_logic_vector is
259 variable X :
std_logic_vector(OUTPUT_TOBS*OUT_TOB_WIDTH-
1 downto 0);
261 for i
in 0 to (OUTPUT_TOBS-
1) loop
262 X
(i*OUT_TOB_WIDTH + OUT_TOB_WIDTH-
1 downto i*OUT_TOB_WIDTH
) := Y
(i
);
269 function to_AlgoOutput
(X :
std_logic_vector) return AlgoOutput is
272 for i
in 0 to (OUTPUT_TOBS-
1) loop
273 Y
(i
) := X
(i*OUT_TOB_WIDTH + OUT_TOB_WIDTH-
1 downto i*OUT_TOB_WIDTH
);
280 function to_AlgoXOutput
(X :
std_logic_vector) return AlgoXOutput is
283 for i
in 0 to (OUTPUT_TOBS-
1) loop
284 Y
(i
) := X
(i*OUT_TOB_WIDTH + OUT_TOB_WIDTH-
1 downto i*OUT_TOB_WIDTH
);
292 variable X :
std_logic_vector(OUT_TOB_WIDTH-
1 downto 0);
294 for i
in 0 to (OUT_TOB_WIDTH-
1) loop
303 variable X :
std_logic_vector(OUT_XTOB_WIDTH-
1 downto 0);
305 for i
in 0 to (OUT_XTOB_WIDTH-
1) loop
318 for i
in 0 to (OUT_TOB_WIDTH-
1) loop
325 function to_AlgoTriggerObjects
(
329 begin -- function to_AlgoTriggerObjects
330 for i
in 0 to (OUTPUT_TOBS-
1) loop
334 end function to_AlgoTriggerObjects;
External data-types and functions.
( LAYER2- 1 downto 0) AlgoWord AlgoLayer2
External layer 2 array: dimension 4.
( INPUT_ROWS- 1 downto 0) AlgoTower AlgoColumn
Algorithm Phi column.
array(natural range <> ) of AlgoWord AlgoWords
External arra of AlgoWord.
( HADRON- 1 downto 0) AlgoWord AlgoHadron
External hadronic layer array: dimension 1.
( LAYER1- 1 downto 0) AlgoWord AlgoLayer1
External layer 1 array: dimension 4.
( OUTPUT_TOBS- 1 downto 0) AlgoTriggerObject AlgoOutput
Algorithm OUTPUT port.
array(natural range <> ) of AlgoTriggerObject AlgoTriggerObjects
Algorithm OUTPUT port.
( INPUT_COLUMNS- 1 downto 0) AlgoColumn AlgoInput
Algorithm INPUT port.
std_logic_vector( OUT_TOB_WIDTH- 1 downto 0) AlgoTriggerObject
Algorithm Trigger Object TOB.
AlgoTower
Data-structure containing energy samples for the 4+hadronic layers.
( LAYER0- 1 downto 0) AlgoWord AlgoLayer0
External layer 0 array: dimension 1.
( LAYER3- 1 downto 0) AlgoWord AlgoLayer3
External layer 3 array: dimension 1.
AlgoTower :=( Layer0=>(( others =>( others => '0'))), Layer1=>(( others =>( others => '0'))), Layer2=>(( others =>( others => '0'))), Layer3=>(( others =>( others => '0'))), Hadron=>(( others =>( others => '0')))) ZERO_ALGO_TOWER
An AlgoTower filled with zeroes.
std_logic_vector( OUT_XTOB_WIDTH- 1 downto 0) AlgoXTriggerObject
Algorithm Extended Trigger Object XTOB.
( INPUT_COLUMNS- 1 downto 0, INPUT_ROWS- 1 downto 0) AlgoTower Algo2DInput
Algorithm 2D INPUT port.
std_logic_vector( INPUT_DATA_WIDTH- 1 downto 0) AlgoWord
External (10 bit) non-linearly encoded data word.
( OUTPUT_TOBS- 1 downto 0) AlgoXTriggerObject AlgoXOutput
Algorithm XOUTPUT port.