7 use IEEE.STD_LOGIC_1164.
ALL;
8 use IEEE.NUMERIC_STD.
ALL;
28 subtype T_SLV2 is (1 downto 0);
29 subtype T_SLV3 is (2 downto 0);
30 subtype T_SLV4 is (3 downto 0);
31 subtype T_SLV12 is (11 downto 0);
32 subtype T_SLV13 is (12 downto 0);
33 subtype T_SLV24 is (23 downto 0);
34 subtype T_SLV25 is (24 downto 0);
35 subtype T_SLV30 is (29 downto 0);
36 subtype T_SLV32 is (31 downto 0);
37 subtype T_SLV16 is (15 downto 0);
38 subtype T_SLV60 is (59 downto 0);
39 subtype T_SLV61 is (60 downto 0);
40 subtype T_SLV62 is (61 downto 0);
41 subtype T_SLV65 is (64 downto 0);
42 subtype T_SLV75 is (74 downto 0);
60 --This defines if the JEM at a given position is in the upper or lower half
61 --bit set to true means that JEM is in the upper half
64 function quad_rest(arg : ; quadrant : ; restricted_SUMET : ; restricted_MISSET : ; iterator : )
return ;
69 --function sqrt32( d : unsigned ) return unsigned;
70 --function sqrt( d : unsigned ) return unsigned;
71 --function divide(a : unsigned; b : unsigned) return unsigned;
73 end CMX_flavor_package;
79 function quad_rest(arg : ; quadrant : ; restricted_SUMET : ; restricted_MISSET : ; iterator : )
return is
80 variable tmp :
(arg'
range);
81 variable result :
(19 downto 0);
83 if (quadrant = '
1'
) and (iterator =
0 or iterator =
2 or iterator =
4) then
84 --upper no res --ex u ey u et
86 elsif (quadrant = '
0'
) and (iterator =
1 or iterator =
3 or iterator =
4) then
87 --lower no res --ex l ex l
89 elsif ((quadrant = '
1'
) and (iterator =
5 or iterator =
7)) and restricted_MISSET = '
1'
then
92 elsif ((quadrant = '
0'
) and (iterator =
6 or iterator =
8)) and restricted_MISSET = '
1'
then
95 elsif ((iterator =
9) and restricted_SUMET = '
1'
) then
98 tmp :=
(others => '
0'
);
105 variable Upper, Lower : ;
107 variable BUS_int :
( arg'length -
1 downto 0 );
110 if (arg'LENGTH <
1) then -- In the case of a NULL range
113 BUS_int := to_ux01
(arg
);
114 if ( BUS_int'length =
1 ) then
115 Result := BUS_int
( BUS_int'left
);
116 elsif ( BUS_int'length =
2 ) then
117 Result := BUS_int
( BUS_int'right
) xor BUS_int
( BUS_int'left
);
119 Half :=
( BUS_int'length +
1 ) /
2 + BUS_int'right;
120 Upper :=
xor_reduce ( BUS_int
( BUS_int'left
downto Half
));
121 Lower :=
xor_reduce ( BUS_int
( Half -
1 downto BUS_int'right
));
122 Result := Upper
xor Lower;
129 variable result :
(127 downto 0) :=
(others => '
0'
);
131 result
(13 downto 0) := arg
(13 downto 0);
132 result
(22 downto 14) :=
(others => '
0'
);
133 result
(23) := arg
(42);
134 result
(37 downto 24) := arg
(27 downto 14);
135 result
(46 downto 38) :=
(others => '
0'
);
136 result
(47) := arg
(43);
137 result
(61 downto 48) := arg
(41 downto 28);
138 result
(70 downto 62) :=
(others => '
0'
);
139 result
(71) := arg
(44);
140 result
(94 downto 72) :=
(others => '
0'
);
141 result
(95) := arg
(45);
143 result
(127 downto 97) :=
(others => '
0'
);
148 variable result :
(26*
4-
1 downto 0) :=
(others => '
0'
);
149 variable c0m0_parity, c0m1_parity :
(25 downto 0) :=
(others => '
0'
);
150 variable c1m0_parity, c1m1_parity :
(25 downto 0) :=
(others => '
0'
);
152 -- c0m0_parity := arg(arg'HIGH-5) & arg(2*15+9 downto 2*15) & arg(14 downto 0);
153 c0m0_parity := '
0' & arg
(2*
15+
9 downto 2*
15) & arg
(14 downto 0);
154 result
(25 downto 0) := c0m0_parity;
156 -- c0m1_parity := arg(arg'HIGH-3) & arg(5*15+9 downto 5*15) & arg(3*15+14 downto 3*15);
157 c0m1_parity := '
0' & arg
(5*
15+
9 downto 5*
15) & arg
(3*
15+
14 downto 3*
15);
158 result
(51 downto 26) :=c0m1_parity;
160 -- c1m0_parity := arg(arg'HIGH-4) & x"0" & "00" & arg(2*15+13 downto 2*15+10) & arg(1*15+14 downto 15);
161 c1m0_parity := '
0' &
"00" & arg
(arg'HIGH-
1)& arg
(arg'HIGH-
2) & arg
(arg'HIGH-
4) & arg
(arg'HIGH-
5) & arg
(2*
15+
13 downto 2*
15+
10) & arg
(1*
15+
14 downto 15);
162 result
(77 downto 52) := c1m0_parity;
164 -- c1m1_parity := x"0" & "000" & arg(5*15+13 downto 5*15+10) & arg(4*15+14 downto 4*15);
165 c1m1_parity := '
0' & x"0" & arg
(arg'HIGH
) & arg
(arg'HIGH-
3) & arg
(5*
15+
13 downto 5*
15+
10) & arg
(4*
15+
14 downto 4*
15);
166 result
(103 downto 78) := c1m1_parity;
171 variable result :
(6*
15+
6-
1 downto 0) :=
(others => '
0'
);
174 result
(1*
15-
1 downto 0*
15) := arg
(14 downto 0);
176 result
(2*
15-
1 downto 1*
15) := arg
(2*
26+
14 downto 2*
26);
178 result
(3*
15-
1 downto 2*
15) := '
0' & arg
(2*
26+
18 downto 2*
26+
15) & arg
(24 downto 15);
180 result
(4*
15-
1 downto 3*
15) := arg
(26+
14 downto 26);
181 result
(5*
15-
1 downto 4*
15) := arg
(3*
26+
14 downto 3*
26);
182 result
(6*
15-
1 downto 5*
15) := '
0' & arg
(3*
26+
18 downto 3*
26+
15) & arg
(26+
24 downto 26+
15);
183 -- result(6*15+2 downto 6*15) := arg(26+25) & arg(25) & arg(2*26+25) ;
184 result
(6*
15+
5 downto 6*
15) := arg
(98) & arg
(74) &arg
(73) & arg
(97) & arg
(72) & arg
(71) ;
188 --function sqrt ( arg : unsigned ) return unsigned is
189 -- variable tmp : unsigned(15 downto 0):= '0' & arg;
190 -- variable result : unsigned(7 downto 0):=(others => '0');
191 -- variable left, right, r : unsigned(9 downto 0):=(others => '0'); --input to adder/sub.r-remainder.
192 -- variable i : integer:=0;
194 -- for i in 0 to 7 loop
197 -- right(9 downto 2) := result;
198 -- left(1 downto 0) := tmp (15 downto 14);
199 -- left(9 downto 2) := r (7 downto 0);
200 -- tmp(15 downto 2) := tmp(13 downto 0); --shifting by 2 bit.
201 -- if ( r(9) = '1') then
202 -- r := left + right;
204 -- r := left - right;
206 -- result(7 downto 1) := result(6 downto 0);
207 -- result(0) := not r(9);
212 --function sqrt32 ( d : UNSIGNED ) return UNSIGNED is
213 -- variable a : unsigned(31 downto 0):=d; --original input.
214 -- variable q : unsigned(15 downto 0):=(others => '0'); --result.
215 -- variable left,right,r : unsigned(17 downto 0):=(others => '0'); --input to adder/sub.r-remainder.
216 -- variable i : integer:=0;
218 -- for i in 0 to 15 loop
221 -- right(17 downto 2):=q;
222 -- left(1 downto 0):=a(31 downto 30);
223 -- left(17 downto 2):=r(15 downto 0);
224 -- a(31 downto 2):=a(29 downto 0); --shifting by 2 bit.
225 -- if ( r(17) = '1') then
226 -- r := left + right;
228 -- r := left - right;
230 -- q(15 downto 1) := q(14 downto 0);
231 -- q(0) := not r(17);
237 --function divide (a : UNSIGNED; b : UNSIGNED) return UNSIGNED is
238 -- variable a1 : unsigned(a'length-1 downto 0):=a;
239 -- variable b1 : unsigned(b'length-1 downto 0):=b;
240 -- variable p1 : unsigned(b'length downto 0):= (others => '0');
241 -- variable i : integer:=0;
243 -- for i in 0 to b'length-1 loop
244 -- p1(b'length-1 downto 1) := p1(b'length-2 downto 0);
245 -- p1(0) := a1(a'length-1);
246 -- a1(a'length-1 downto 1) := a1(a'length-2 downto 0);
248 -- if(p1(b'length-1) ='1') then
261 end CMX_flavor_package;
std_logic_vector (3 downto 0) T_SLV4
std_logic_vector (12 downto 0) T_SLV13
std_logic_vector (59 downto 0) T_SLV60
std_logic_vector crate_cable_outarg,
std_logic_vector (15 downto 0) T_SLV16
array ( integer range<> ) of std_logic calc_parity_typa_a
std_logic_vector (15 downto 0) :=x"F0A5" version_flavor_common
std_logic_vector crate_cable_inarg,
array (0 to 7 ) of std_logic_vector (31 downto 0) xs_thr_param_array
array (0 to 15 ) of std_logic_vector (41 downto 0) energy_array
std_logic_vector (2 downto 0) T_SLV3
std_logic_vector (60 downto 0) T_SLV61
integer :=8 num_thresholds
std_logic_vector (31 downto 0) T_SLV32
std_logic_vector (120 downto 0) T_SLV121
std_logic_vector (11 downto 0) T_SLV12
std_logic_vector crate_cable_outarg,
array ( integer range<> ) of std_logic_vector (31 downto 0) cnt_mult_arr
std_logic_vector (23 downto 0) T_SLV24
std_logic_vector (24 downto 0) T_SLV25
std_logic_vector (119 downto 0) T_SLV120
unsigned quad_restarg,quadrant,restricted_SUMET,restricted_MISSET,iterator,
arr_ctr_15bit (9 downto 0) sum_array
std_logic_vector (64 downto 0) T_SLV65
std_logic_vector (61 downto 0) T_SLV62
std_logic_vector raw_encoderarg,
std_logic_vector crate_cable_inarg,
std_logic_vector raw_encoderarg,
std_logic_vector (15 downto 0) :=x"00FF" BACKPLANE_MAP
array (0 to 15 ) of std_logic_vector (31 downto 0) thr_array
integer :=15 max_bits_ExEy
integer :=max_bits_ExEy * 2 + 1 max_bits_XE2
array ( integer range<> ) of calc_parity_typa_a (3 downto 0) calc_parity_type
std_logic_vector (74 downto 0) T_SLV75
std_logic_vector (1 downto 0) T_SLV2
array ( integer range<> ) of std_logic_vector (15 downto 0) cnt_mult_arr_2x16
std_logic_vector (29 downto 0) T_SLV30
std_logic_vector (1935 downto 0) T_SLV1936