@@ -33,6 +33,8 @@ namespace l1gt {
33
33
34
34
// tau fields
35
35
typedef ap_ufixed<10 , 8 > tauseed_pt_t ;
36
+ typedef ap_uint<10 > tau_rawid_t ;
37
+ typedef std::array<uint64_t , 2 > PackedTau;
36
38
37
39
namespace Scales {
38
40
const int INTPHI_PI = 1 << (phi_t ::width - 1 );
@@ -183,12 +185,12 @@ namespace l1gt {
183
185
z0_t seed_z0;
184
186
ap_uint<1 > charge;
185
187
ap_uint<2 > type;
186
- iso_t isolation;
188
+ tau_rawid_t isolation;
187
189
ap_uint<2 > id0;
188
190
ap_uint<2 > id1;
189
191
190
192
static const int BITWIDTH = 128 ;
191
- inline ap_uint<BITWIDTH> pack () const {
193
+ inline ap_uint<BITWIDTH> pack_ap () const {
192
194
ap_uint<BITWIDTH> ret;
193
195
unsigned int start = 0 ;
194
196
pack_into_bits (ret, start, valid);
@@ -202,6 +204,44 @@ namespace l1gt {
202
204
pack_into_bits (ret, start, id1);
203
205
return ret;
204
206
}
207
+
208
+ inline PackedTau pack () const {
209
+ PackedTau packed;
210
+ ap_uint<BITWIDTH> bits = this ->pack_ap ();
211
+ packed[0 ] = bits (63 , 0 );
212
+ packed[1 ] = bits (127 , 64 );
213
+ return packed;
214
+ }
215
+
216
+ inline static Tau unpack_ap (const ap_uint<BITWIDTH> &src) {
217
+ Tau ret;
218
+ ret.initFromBits (src);
219
+ return ret;
220
+ }
221
+
222
+ inline static Tau unpack (const PackedTau &src) {
223
+ ap_uint<BITWIDTH> bits;
224
+ bits (63 , 0 ) = src[0 ];
225
+ bits (127 , 64 ) = src[1 ];
226
+
227
+ return unpack_ap (bits);
228
+ }
229
+
230
+ inline void initFromBits (const ap_uint<BITWIDTH> &src) {
231
+ unsigned int start = 0 ;
232
+ unpack_from_bits (src, start, valid);
233
+ unpack_from_bits (src, start, v3.pt );
234
+ unpack_from_bits (src, start, v3.phi );
235
+ unpack_from_bits (src, start, v3.eta );
236
+ unpack_from_bits (src, start, seed_pt);
237
+ unpack_from_bits (src, start, seed_z0);
238
+ unpack_from_bits (src, start, charge);
239
+ unpack_from_bits (src, start, type);
240
+ unpack_from_bits (src, start, isolation);
241
+ unpack_from_bits (src, start, id0);
242
+ unpack_from_bits (src, start, id1);
243
+ }
244
+
205
245
}; // struct Tau
206
246
207
247
struct Electron {
0 commit comments