Project
Loading...
Searching...
No Matches
SampaHeader.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13
14#include <stdexcept>
15#include <fmt/format.h>
16#include <fmt/printf.h>
17#include <iostream>
18#include <vector>
19#include <algorithm>
20#include "NofBits.h"
21#include <array>
22#include <sstream>
23
24namespace
25{
26constexpr uint64_t HAMMING_CODE_OFFSET = 0;
27constexpr uint64_t HEADER_PARITY_OFFSET = 6;
28constexpr uint64_t PACKET_TYPE_OFFSET = 7;
29constexpr uint64_t NUMBER_OF_1OBITS_WORDS_OFFSET = 10;
30constexpr uint64_t CHIP_ADDRESS_OFFSET = 20;
31constexpr uint64_t CHANNEL_ADDRESS_OFFSET = 24;
32constexpr uint64_t BUNCH_CROSSING_OFFSET = 29;
33constexpr uint64_t PARITY_OFFSET = 49;
34
35constexpr uint64_t HAMMING_CODE_NOFBITS = HEADER_PARITY_OFFSET - HAMMING_CODE_OFFSET;
36constexpr uint64_t HEADER_PARITY_NOFBITS = PACKET_TYPE_OFFSET - HEADER_PARITY_OFFSET;
37constexpr uint64_t PACKET_TYPE_NOFBITS = NUMBER_OF_1OBITS_WORDS_OFFSET - PACKET_TYPE_OFFSET;
38constexpr uint64_t NUMBER_OF_1OBITS_WORDS_NOFBITS = CHIP_ADDRESS_OFFSET - NUMBER_OF_1OBITS_WORDS_OFFSET;
39constexpr uint64_t CHIP_ADDRESS_NOFBITS = CHANNEL_ADDRESS_OFFSET - CHIP_ADDRESS_OFFSET;
40constexpr uint64_t CHANNEL_ADDRESS_NOFBITS = BUNCH_CROSSING_OFFSET - CHANNEL_ADDRESS_OFFSET;
41constexpr uint64_t BUNCH_CROSSING_NOFBITS = PARITY_OFFSET - BUNCH_CROSSING_OFFSET;
42constexpr uint64_t PARITY_NOFBITS = 50 - PARITY_OFFSET;
43
44struct CHECKNOFBITS {
45
46 CHECKNOFBITS()
47 {
48 if (HAMMING_CODE_NOFBITS != 6) {
49 throw std::invalid_argument(fmt::format("HAMMING_CODE_NOFBITS is {0}. Should be 6", HAMMING_CODE_NOFBITS));
50 }
51 if (HEADER_PARITY_NOFBITS != 1) {
52 throw std::invalid_argument(fmt::format("HEADER_PARITY_NOFBITS is {0}. Should be 1", HEADER_PARITY_NOFBITS));
53 }
54 if (PACKET_TYPE_NOFBITS != 3) {
55 throw std::invalid_argument(fmt::format("PACKET_TYPE_NOFBITS is {0}. Should be 3", PACKET_TYPE_NOFBITS));
56 }
57 if (NUMBER_OF_1OBITS_WORDS_NOFBITS != 10) {
58 throw std::invalid_argument(fmt::format("NUMBER_OF_1OBITS_WORDS_NOFBITS is {0}. Should be 10", NUMBER_OF_1OBITS_WORDS_NOFBITS));
59 }
60 if (CHIP_ADDRESS_NOFBITS != 4) {
61 throw std::invalid_argument(fmt::format("CHIP_ADDRESS_NOFBITS is {0}. Should be 4", CHIP_ADDRESS_NOFBITS));
62 }
63 if (CHANNEL_ADDRESS_NOFBITS != 5) {
64 throw std::invalid_argument(fmt::format("CHANNEL_ADDRESS_NOFBITS is {0}. Should be 5", CHANNEL_ADDRESS_NOFBITS));
65 }
66 if (BUNCH_CROSSING_NOFBITS != 20) {
67 throw std::invalid_argument(fmt::format("BUNCH_CROSSING_NOFBITS is {0}. Should be 20", BUNCH_CROSSING_NOFBITS));
68 }
69 if (PARITY_NOFBITS != 1) {
70 throw std::invalid_argument(fmt::format("PARITY_NOFBITS is {0}. Should be 1", PARITY_NOFBITS));
71 }
72 }
73};
74
75CHECKNOFBITS checknofbits;
76
77constexpr uint64_t HAMMING_CODE_MASK = 0x000000000003F;
78constexpr uint64_t HEADER_PARITY_MASK = 0x0000000000040;
79constexpr uint64_t PACKET_TYPE_MASK = 0x0000000000380;
80constexpr uint64_t NUMBER_OF_1OBITS_WORDS_MASK = 0x00000000FFC00;
81constexpr uint64_t CHIP_ADDRESS_MASK = 0x0000000F00000;
82constexpr uint64_t CHANNEL_ADDRESS_MASK = 0x000001F000000;
83constexpr uint64_t BUNCH_CROSSING_MASK = 0x1FFFFE0000000;
84constexpr uint64_t PARITY_MASK = 0x2000000000000;
85
86constexpr uint64_t hammingCode(uint64_t header)
87{
88 return ((header & HAMMING_CODE_MASK) >> HAMMING_CODE_OFFSET);
89}
90
91constexpr uint64_t headerParity(uint64_t header)
92{
93 return ((header & HEADER_PARITY_MASK) >> HEADER_PARITY_OFFSET);
94}
95constexpr uint64_t packetType(uint64_t header)
96{
97 return ((header & PACKET_TYPE_MASK) >> PACKET_TYPE_OFFSET);
98}
99
100constexpr uint64_t nof10BitWords(uint64_t header)
101{
102 return ((header & NUMBER_OF_1OBITS_WORDS_MASK) >> NUMBER_OF_1OBITS_WORDS_OFFSET);
103}
104
105constexpr uint64_t chipAddress(uint64_t header)
106{
107 return ((header & CHIP_ADDRESS_MASK) >> CHIP_ADDRESS_OFFSET);
108}
109constexpr uint64_t channelAddress(uint64_t header)
110{
111 return ((header & CHANNEL_ADDRESS_MASK) >> CHANNEL_ADDRESS_OFFSET);
112}
113
114constexpr uint64_t bunchCrossingCounter(uint64_t header)
115{
116 return ((header & BUNCH_CROSSING_MASK) >> BUNCH_CROSSING_OFFSET);
117}
118
119constexpr uint64_t payloadParity(uint64_t header)
120{
121 return ((header & PARITY_MASK) >> PARITY_OFFSET);
122}
123
124bool checkBit(uint64_t value, int i, bool bitStatus)
125{
126 return (value >> i & 1) == static_cast<int>(bitStatus);
127}
128
129bool isHeartbeat(uint64_t header)
130{
131 // - bits 7-9 must be zero
132 // - bits 10-19 must be zero
133 // - bits 24,26,28 must be one
134 // - bits 25,27 must be zero
135 // - bit 49 must be zero
136 for (int i = 7; i <= 9; i++) {
137 if (!checkBit(header, i, false)) {
138 return false;
139 }
140 }
141 for (int i = 10; i <= 19; i++) {
142 if (!checkBit(header, i, false)) {
143 return false;
144 }
145 }
146 if (!checkBit(header, 24, true) || !checkBit(header, 26, true) || !checkBit(header, 28, true) || !checkBit(header, 25, false) || !checkBit(header, 27, false) || !checkBit(header, 49, false)) {
147 return false;
148 }
149 return true;
150}
151
152} // namespace
153
154namespace o2
155{
156namespace mch
157{
158namespace raw
159{
160
162{
164 return "HeartBeat";
165 }
167 return "DataTruncated";
168 }
170 return "Sync";
171 }
173 return "DataTruncatedTriggerTooEarly";
174 }
176 return "Data";
177 }
179 return "DataNumWords";
180 }
182 return "DataTriggerTooEarl";
183 }
185 return "DataTriggerTooEarlyNumWords";
186 }
187 throw std::out_of_range("should not happen");
188}
189
190SampaHeader::SampaHeader(uint64_t value) : mValue(0)
191{
192 uint64(value);
193}
194
196{
197 return computeHammingCode(mValue) != hammingCode();
198}
199
201{
202 return hasHammingError() || hasParityError();
203}
204
206{
207 return computeHeaderParity(mValue) != headerParity();
208}
209
211{
212 impl::assertNofBits("sampa header", value, 50);
213 mValue = value;
214}
215
217 bool p,
218 SampaPacketType pkt,
219 uint16_t numWords,
220 uint8_t h,
221 uint8_t ch,
222 uint32_t bx,
223 bool dp) : mValue{0}
224{
225 hammingCode(hamming);
226 headerParity(p);
227 packetType(pkt);
228 nof10BitWords(numWords);
229 chipAddress(h);
230 channelAddress(ch);
232 payloadParity(dp);
233}
234
236{
237 mValue &= ~HEADER_PARITY_MASK;
238 mValue += (static_cast<uint64_t>(p) << HEADER_PARITY_OFFSET) & HEADER_PARITY_MASK;
239}
240
242{
243 mValue &= ~PARITY_MASK;
244 mValue += (static_cast<uint64_t>(dp) << PARITY_OFFSET) & PARITY_MASK;
245}
246
248{
249 mValue &= ~CHIP_ADDRESS_MASK;
250 mValue += (static_cast<uint64_t>(h) << CHIP_ADDRESS_OFFSET) & CHIP_ADDRESS_MASK;
251}
252
254{
255 mValue &= ~CHANNEL_ADDRESS_MASK;
256 mValue += (static_cast<uint64_t>(ch) << CHANNEL_ADDRESS_OFFSET) & CHANNEL_ADDRESS_MASK;
257}
258
260{
261 mValue &= ~BUNCH_CROSSING_MASK;
262 mValue += (static_cast<uint64_t>(bx) << BUNCH_CROSSING_OFFSET) & BUNCH_CROSSING_MASK;
263}
264
265void SampaHeader::hammingCode(uint8_t hamming)
266{
267 mValue &= ~HAMMING_CODE_MASK;
268 mValue += (static_cast<uint64_t>(hamming) << HAMMING_CODE_OFFSET) & HAMMING_CODE_MASK;
269}
270
271void SampaHeader::nof10BitWords(uint16_t nofwords)
272{
273 mValue &= ~NUMBER_OF_1OBITS_WORDS_MASK;
274 mValue += (static_cast<uint64_t>(nofwords) << NUMBER_OF_1OBITS_WORDS_OFFSET) & NUMBER_OF_1OBITS_WORDS_MASK;
275}
276
278{
279 mValue &= ~PACKET_TYPE_MASK;
280 mValue += (static_cast<uint64_t>(pkt) << PACKET_TYPE_OFFSET) & PACKET_TYPE_MASK;
281}
282
284{
285 return bunchCrossingCounter() < rhs.bunchCrossingCounter();
286}
287
289{
290 return bunchCrossingCounter() > rhs.bunchCrossingCounter();
291}
292
294{
295 return bunchCrossingCounter() <= rhs.bunchCrossingCounter();
296}
297
299{
300 return bunchCrossingCounter() >= rhs.bunchCrossingCounter();
301}
302
304{
305 return mValue == rhs.mValue;
306}
307
309{
310 return !(*this == rhs);
311}
312
314{
315 return ::isHeartbeat(mValue);
316}
318{
319 // 6 bits
320 return ::hammingCode(mValue) & 0X3F;
321}
322
324{
325 return ::headerParity(mValue) == 1;
326}
327
329{
330 // 3 bits
331 return static_cast<SampaPacketType>(::packetType(mValue) & 0x7);
332}
333
335{
336 // 10 bits
337 return ::nof10BitWords(mValue) & 0x3FF;
338}
339
341{
342 // 4 bits
343 return ::chipAddress(mValue) & 0xF;
344}
345
347{
348 // 5 bits
349 return ::channelAddress(mValue) & 0x1F;
350}
351
353{
354 // 20 bits
355 return ::bunchCrossingCounter(mValue) & 0x1FFFFF;
356}
357
359{
360 return ::payloadParity(mValue) == 1;
361}
362
364{
365 return SampaHeader(
366 0x13,
367 0,
369 0,
370 0xf,
371 0,
372 0xAAAAA,
373 0);
374}
375
376SampaHeader sampaHeartbeat(uint8_t chipAddress, uint20_t bunchCrossing)
377{
378 SampaHeader sh;
380 sh.nof10BitWords(0);
381 sh.chipAddress(chipAddress);
382 sh.channelAddress(21);
383 sh.bunchCrossingCounter(bunchCrossing);
386 return sh;
387}
388
389std::string asString(const SampaHeader& sh)
390{
391 std::stringstream os;
392
393 uint64_t one = 1;
394 std::vector<int> sep = {5, 6, 9, 19, 23, 28, 48};
395 for (int i = 0; i < 50; i++) {
396 os << ((sh.uint64() & (one << i)) ? "1" : "0");
397 if (std::find(begin(sep), end(sep), i) != end(sep)) {
398 os << "|";
399 }
400 }
401 os << "\n";
402 os << fmt::sprintf("%6x %d %3x %10x %4x %5x %20x %d (0x%x) | HeaderType: %s %s",
403 sh.hammingCode(),
404 sh.headerParity(),
405 static_cast<uint8_t>(sh.packetType()),
406 sh.nof10BitWords(),
407 sh.chipAddress(),
408 sh.channelAddress(),
410 sh.payloadParity(),
411 sh.uint64(),
413 sh.hasHammingError() ? " | HAMMING_ERROR" : "",
414 sh.hasParityError() ? "| PARITY ERROR" : "")
415 << "\n";
416 return os.str();
417}
418
419std::ostream& operator<<(std::ostream& os, const SampaHeader& sh)
420{
421 return os << asString(sh);
422}
423
424// conv array convert a bit position in the hamming sense
425// (i.e. where parity bits are interleaved between data bits)
426// and the data bit positions in the original value (where the 6 hamming
427// bits are "grouped" in the front of the value).
428constexpr std::array<int, 49> conv = {-1, -1, 7, -1, 8, 9, 10, -1, 11, 12, 13, 14, 15, 16, 17,
429 -1, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
430 29, 30, 31, 32, -1, 33, 34, 35, 36, 37, 38, 39,
431 40, 41, 42, 43, 44, 45, 46, 47, 48, 49};
432int computeParity(uint64_t v);
433
434int partialOddParity3(uint64_t value, int pos)
435{
436 // compute the odd parity of all the bits at position x
437 // (where x & (2^pos)) are set
438 //
439
440 int n{0};
441 uint64_t one{1};
442 const uint64_t test{one << pos};
443
444 for (uint64_t i = 0; i < 49; i++) {
445 if (conv[i] < 0) {
446 continue;
447 }
448 if ((i + 1) & test) {
449 if (value & (one << conv[i])) {
450 ++n;
451 }
452 }
453 }
454 return (n + 1) % 2 == 0;
455}
456
458{
459 // value is assumed to be 50 bits, where the 43 data bits
460 // are 7-49
461 int hamming{0};
462
463 for (int i = 0; i < 6; i++) {
464 hamming += partialOddParity3(value, i) * (1 << i);
465 }
466 return hamming;
467}
468
469template <size_t N>
470int partialOddParity2(uint64_t value, const std::array<int, N>& pos)
471{
472 uint64_t one{1};
473 int n{0};
474
475 for (auto i = 0; i < pos.size(); i++) {
476 n += ((value & (one << pos[i])) > 0);
477 }
478 return (n + 1) % 2 == 0;
479}
480
481template <size_t N>
482int partialOddParity(uint64_t value, const std::array<uint64_t, N>& masks)
483{
484 int n{0};
485 for (auto i = 0; i < masks.size(); i++) {
486 n += ((value & masks[i]) > 0);
487 }
488 return (n + 1) % 2 == 0;
489}
490
491std::array<int, 24> p0{7, 8, 10, 11, 13, 15, 17, 18, 20, 22, 24, 26, 28, 30, 32, 33, 35, 37, 39, 41, 43, 45, 47, 49};
492std::array<int, 23> p1{7, 9, 10, 12, 13, 16, 17, 19, 20, 23, 24, 27, 28, 31, 32, 34, 35, 38, 39, 42, 43, 46, 47};
493std::array<int, 23> p2{8, 9, 10, 14, 15, 16, 17, 21, 22, 23, 24, 29, 30, 31, 32, 36, 37, 38, 39, 44, 45, 46, 47};
494std::array<int, 23> p3{11, 12, 13, 14, 15, 16, 17, 25, 26, 27, 28, 29, 30, 31, 32, 40, 41, 42, 43, 44, 45, 46, 47};
495std::array<int, 17> p4{18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 48, 49};
496std::array<int, 17> p5{33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49};
497
499{
500 // value is assumed to be 50 bits, where the 43 data bits
501 // are 7-49
502
503 int h0 = partialOddParity2(value, p0);
504 int h1 = partialOddParity2(value, p1);
505 int h2 = partialOddParity2(value, p2);
506 int h3 = partialOddParity2(value, p3);
507 int h4 = partialOddParity2(value, p4);
508 int h5 = partialOddParity2(value, p5);
509 return h0 + h1 * 2 + h2 * 4 + h3 * 8 + h4 * 16 + h5 * 32;
510}
511
512std::array<uint64_t, 24> m0 = {0x80, 0x100, 0x400, 0x800, 0x2000, 0x8000, 0x20000, 0x40000, 0x100000, 0x400000, 0x1000000, 0x4000000, 0x10000000, 0x40000000, 0x100000000, 0x200000000, 0x800000000, 0x2000000000, 0x8000000000, 0x20000000000, 0x80000000000, 0x200000000000, 0x800000000000, 0x2000000000000};
513std::array<uint64_t, 23> m1 = {0x80, 0x200, 0x400, 0x1000, 0x2000, 0x10000, 0x20000, 0x80000, 0x100000, 0x800000, 0x1000000, 0x8000000, 0x10000000, 0x80000000, 0x100000000, 0x400000000, 0x800000000, 0x4000000000, 0x8000000000, 0x40000000000, 0x80000000000, 0x400000000000, 0x800000000000};
514std::array<uint64_t, 23> m2 = {0x100, 0x200, 0x400, 0x4000, 0x8000, 0x10000, 0x20000, 0x200000, 0x400000, 0x800000, 0x1000000, 0x20000000, 0x40000000, 0x80000000, 0x100000000, 0x1000000000, 0x2000000000, 0x4000000000, 0x8000000000, 0x100000000000, 0x200000000000, 0x400000000000, 0x800000000000};
515std::array<uint64_t, 23> m3 = {0x800, 0x1000, 0x2000, 0x4000, 0x8000, 0x10000, 0x20000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, 0x100000000, 0x10000000000, 0x20000000000, 0x40000000000, 0x80000000000, 0x100000000000, 0x200000000000, 0x400000000000, 0x800000000000};
516std::array<uint64_t, 17> m4 = {0x40000, 0x80000, 0x100000, 0x200000, 0x400000, 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, 0x100000000, 0x1000000000000, 0x2000000000000};
517std::array<uint64_t, 17> m5 = {0x200000000, 0x400000000, 0x800000000, 0x1000000000, 0x2000000000, 0x4000000000, 0x8000000000, 0x10000000000, 0x20000000000, 0x40000000000, 0x80000000000, 0x100000000000, 0x200000000000, 0x400000000000, 0x800000000000, 0x1000000000000, 0x2000000000000};
518
520{
522}
523
525{
526 // value is assumed to be 50 bits, where the 43 data bits
527 // are 7-49
528
529 int h0 = partialOddParity(value, m0);
530 int h1 = partialOddParity(value, m1);
531 int h2 = partialOddParity(value, m2);
532 int h3 = partialOddParity(value, m3);
533 int h4 = partialOddParity(value, m4);
534 int h5 = partialOddParity(value, m5);
535 return h0 + h1 * 2 + h2 * 4 + h3 * 8 + h4 * 16 + h5 * 32;
536}
537
538template <size_t N>
539uint64_t computeMask(const std::array<uint64_t, N>& masks)
540{
541 uint64_t v{0};
542 for (auto i = 0; i < masks.size(); i++) {
543 v |= masks[i];
544 }
545 std::cout << fmt::format("0x{:X},", v);
546 return v;
547}
548
550{
551 // value is assumed to be 50 bits, where the 43 data bits
552 // are 7-49
553
554 constexpr std::array<uint64_t, 6> masks = {0x2AAAB5556AD80,
555 0xCCCD999B3680, 0xF0F1E1E3C700,
556 0xFF01FE03F800, 0x30001FFFC0000,
557 0x3FFFE00000000};
558 int h0 = computeParity(value & masks[0]);
559 int h1 = computeParity(value & masks[1]);
560 int h2 = computeParity(value & masks[2]);
561 int h3 = computeParity(value & masks[3]);
562 int h4 = computeParity(value & masks[4]);
563 int h5 = computeParity(value & masks[5]);
564 return h0 + h1 * 2 + h2 * 4 + h3 * 8 + h4 * 16 + h5 * 32;
565}
566
568{
569 return computeHeaderParity4(v);
570}
571
576{
577 int n{0};
578 constexpr uint64_t one{1};
579 for (int i = 0; i < 6; i++) {
580 if (v & (one << i)) {
581 n++;
582 }
583 }
584 for (int i = 7; i < 50; i++) {
585 if (v & (one << i)) {
586 n++;
587 }
588 }
589 return (n + 1) % 2 == 0;
590}
591
592constexpr std::array<uint64_t, 49> parityMasks = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, 0x100000000, 0x200000000, 0x400000000, 0x800000000, 0x1000000000, 0x2000000000, 0x4000000000, 0x8000000000, 0x10000000000, 0x20000000000, 0x40000000000, 0x80000000000, 0x100000000000, 0x200000000000, 0x400000000000, 0x800000000000, 0x1000000000000, 0x2000000000000};
593
595{
596 int n{0};
597
598 for (auto i = 0; i < parityMasks.size(); i++) {
599 if (v & parityMasks[i]) {
600 n++;
601 }
602 }
603 return (n + 1) % 2 == 0;
604}
605
606int computeHeaderParity3(uint64_t no)
607{
608 int result = 0;
609 no &= ~(1UL << 6); // reset bit 6
610 while (no != 0) {
611 no = no & (no - 1);
612 result ^= 1;
613 }
614
615 return (short)(result & 0x1);
616}
617
618int computeParity(uint64_t no)
619{
620 no ^= (no >> 32);
621 no ^= (no >> 16);
622 no ^= (no >> 8);
623 no ^= (no >> 4);
624 no ^= (no >> 2);
625 no ^= (no >> 1);
626 return (short)(no & 0x1);
627}
628
629int computeHeaderParity4(uint64_t no)
630{
631 constexpr uint64_t one{1};
632 no &= ~(one << 6); // reset bit 6
633 return computeParity(no);
634}
635
637{
638 return sh.channelAddress() + (sh.chipAddress() % 2) * 32;
639}
640} // namespace raw
641} // namespace mch
642} // namespace o2
int32_t i
uint16_t pos
Definition RawData.h:3
uint32_t one
Definition RawData.h:4
Class for time synchronization of RawReader instances.
SampaHeader is the 50-bits header word used in Sampa data transmission protocol.
Definition SampaHeader.h:51
bool operator<=(const SampaHeader &rhs) const
bool operator<(const SampaHeader &rhs) const
bool hasError() const
whether the header has error (according to hamming and/or parity)
SampaChannelAddress channelAddress() const
uint16_t nof10BitWords() const
bool operator==(const SampaHeader &rhs) const
bool operator>=(const SampaHeader &rhs) const
uint8_t chipAddress() const
uint32_t bunchCrossingCounter() const
SampaHeader(uint64_t value=0)
constexpr uint64_t uint64() const
return the header as a 64-bits integer
bool operator>(const SampaHeader &rhs) const
bool operator!=(const SampaHeader &rhs) const
SampaPacketType packetType() const
uint8_t hammingCode() const
GLdouble n
Definition glcorearb.h:1982
GLuint64EXT * result
Definition glcorearb.h:5662
GLuint GLuint end
Definition glcorearb.h:469
const GLdouble * v
Definition glcorearb.h:832
GLsizei const GLfloat * value
Definition glcorearb.h:819
void assertNofBits(std::string_view msg, T value, int n)
Definition NofBits.h:29
constexpr std::array< uint64_t, 49 > parityMasks
int computeHeaderParity(uint64_t value)
int computeHammingCode3(uint64_t value)
DualSampaChannelId getDualSampaChannelId(const SampaHeader &sh)
Return channel number (0..63)
std::string packetTypeName(SampaPacketType pkt)
packetTypeName returns a string representation of the given packet type.
int partialOddParity3(uint64_t value, int pos)
constexpr std::array< int, 49 > conv
int computeHeaderParity1(uint64_t value)
SampaHeader sampaHeartbeat(uint8_t elinkId, uint20_t bunchCrossing)
Heartbeat packet.
std::array< uint64_t, 24 > m0
SampaHeader sampaSync()
The 50-bits Sampa SYNC word.
int computeHammingCode2(uint64_t value)
std::array< uint64_t, 23 > m2
std::array< int, 23 > p1
int computeHeaderParity4(uint64_t value)
std::array< int, 23 > p2
int computeParity(uint64_t v)
std::array< int, 17 > p5
int computeHammingCode1(uint64_t value)
int partialOddParity(uint64_t value, const std::array< uint64_t, N > &masks)
std::array< int, 23 > p3
int computeHeaderParity2(uint64_t value)
std::array< uint64_t, 17 > m5
std::array< uint64_t, 17 > m4
uint6_t DualSampaChannelId
Definition DataFormats.h:65
uint32_t uint20_t
Definition DataFormats.h:68
int computeHeaderParity3(uint64_t value)
std::string asString(const SampaCluster &sc)
std::array< uint64_t, 23 > m3
std::array< int, 24 > p0
int computeHammingCode4(uint64_t value)
std::array< int, 17 > p4
uint64_t computeMask(const std::array< uint64_t, N > &masks)
int computeHammingCode(uint64_t value)
std::array< uint64_t, 23 > m1
int partialOddParity2(uint64_t value, const std::array< int, N > &pos)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::ostream & operator<<(std::ostream &stream, o2::InteractionRecord const &ir)
FIXME: do not use data model tables.