![]() |
|
|||
File indexing completed on 2025-08-05 08:19:55
0001 // @file GBTWord.h 0002 // @brief Classes for creation/interpretation of MVTX GBT data 0003 // @sa 0004 // <O2/Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/GBTWord.h> 0005 // <d03b22564> 0006 0007 #ifndef MVTXDECODER_GBTWORD_H 0008 #define MVTXDECODER_GBTWORD_H 0009 0010 #include <cstdint> 0011 #include <string> 0012 0013 namespace mvtx 0014 { 0015 0016 constexpr uint64_t LANESMask = (0x1 << 9) - 1; // at most 9 lanes 0017 0018 /// GBT payload header flag 0019 constexpr uint8_t GBTFlagIHW = 0xe0; 0020 /// GBT trigger status word flag 0021 constexpr uint8_t GBTFlagTDH = 0xe8; 0022 /// GBT calibration status word flag 0023 constexpr uint8_t GBTFlagCDW = 0xf8; 0024 /// GBT payload trailer flag 0025 constexpr uint8_t GBTFlagTDT = 0xf0; 0026 /// GBT diagnostic status word flag 0027 constexpr uint8_t GBTFlagDDW = 0xe4; 0028 0029 // GBT header flag in the RDH 0030 constexpr uint8_t GBTFlagRDH = 0x00; 0031 0032 // GBT header flag for the ITS IB: 001 bbbbb with bbbbb -> Lane Number (0-8) 0033 constexpr uint8_t GBTFlagDataIB = 0x20; 0034 0035 // GBT header flag for the ITS IB idagnostic : 101 bbbbb with bbbbb -> Lane 0036 // Number (0-8) 0037 constexpr uint8_t GBTFlagDiagnosticIB = 0xa0; 0038 0039 constexpr int GBTWordLength = 10; // lentgh in bytes 0040 0041 struct GBTWord 0042 { 0043 #pragma GCC diagnostic push 0044 #pragma GCC diagnostic ignored "-Wpedantic" 0045 /// GBT word of 80 bits, bits 72:79 are reserver for GBT Header flag, the rest 0046 /// depends on specifications 0047 union 0048 { 0049 struct 0050 { 0051 uint64_t activeLanes : 28; /// 0:27 Bit map of lanes active and eligible 0052 /// for readout 0053 uint64_t na0hn : 36; /// 28:71 reserved 0054 uint64_t na1hn : 8; /// 28:71 reserved 0055 uint64_t id : 8; /// 72:79 0xe0; Header Status Word (HSW) identifier 0056 }; // ITS HEADER WWORD (IHW) 0057 0058 // RS: packing will be needed only if some of the members cross 64 bit 0059 // boundary 0060 struct __attribute__((packed)) 0061 { 0062 uint64_t triggerType : 12; /// 0:11 12 lowest bits of trigger type 0063 /// received from CTP 0064 uint64_t internal : 1; /// 12 Used in Continuous Mode for internally 0065 /// generated trigger 0066 uint64_t noData : 1; /// 13 No data expected (too close to previous 0067 /// trigger or error) 0068 uint64_t continuation : 1; /// 14 following data is continuation of 0069 /// the trigger from the previous CRU page 0070 uint64_t na1tr : 1; /// 15 reserved 0071 uint64_t bc : 12; /// 16:27 Trigger LHC BC (40MHz) from RU 0072 uint64_t na2tr : 4; /// 28:31 reserved 0073 uint64_t bco : 40; /// 32:71 sPHENIX GTM BCO 0074 // uint8_t id : 8; /// = 0xe8; Trigger Data Header (TDH) 0075 // identifier 0076 }; // TRIGGER DATA HEADER (TDH) 0077 0078 struct __attribute__((packed)) 0079 { 0080 uint64_t calibUserField : 48; /// 0:47 user field 0081 uint64_t calibCounter : 24; /// 48:71 elf-incrementing counter of 0082 // uint64_t id : 8; /// 72:79 0xf8; Calibration Status 0083 // Word (HSW) identifier 0084 }; /// Calibration Data Word 0085 0086 struct 0087 { 0088 uint64_t lanesStatus : 56; /// 0:55 Bit map of “Valid Lane stops 0089 /// received”, 1 bit per lane, NOT USED 0090 uint64_t na0t : 5; /// 56:60 reserved 0091 uint64_t timeout_in_idle : 1; /// 61 = 1 if timeout waiting for a valid 0092 /// word from lanes 0093 uint64_t timeout_start_stop : 1; /// 62 = 1 if timeout waiting for 0094 /// end-of-packet from all lanes 0095 uint64_t timeout_to_start : 1; /// 63 = 1 if timeout waiting for first 0096 /// word from first lane 0097 uint64_t packet_done : 1; /// 64 = 1 when current trigger packets 0098 /// transmission done 0099 uint64_t transmission_timeout : 1; /// 65 = 1 if timeout while waiting 0100 /// for data on lanes 0101 uint64_t na1t : 1; /// 66 reserved 0102 uint64_t 0103 lane_starts_violation : 1; /// 67 = 1 if at least 1 lane (eligible 0104 /// for readout) had a “start violation” 0105 uint64_t lane_timeouts : 1; /// 68 = 1 if at least 1 lane (eligible for 0106 /// readout) timed out 0107 uint64_t na2t : 3; /// 69:71 reserved 0108 // uint8_t id : 8; /// = 0xf0; Trigger Data 0109 // Trailer (TDT) identifier 0110 }; // TRIGGER DATA TRAILER 0111 0112 struct 0113 { 0114 uint64_t lane_status : 56; /// 0:55 Readout status of the lanes for the 0115 /// current HBF. 0116 /// Higher status level achieved for each 0117 /// lane taken from each TDT. 0118 uint64_t na3tr : 8; /// 56:63 reserved 0119 uint64_t na4tr : 1; /// 64 reserved 0120 uint64_t transmission_timeouts : 1; /// 65 = 1 One or more lanes had a 0121 /// timeout in this HBF. 0122 /// Cummulative logic OR of 0123 /// transmission_timeout field 0124 /// of the TDTs. 0125 uint64_t na5tr : 1; /// 66 reserved 0126 uint64_t lane_starts_violations : 1; /// 67 = 1 One or more lanes had a 0127 /// protocol violation in this HBF. 0128 /// Cummulative logic OR of 0129 /// transmission_timeout field 0130 /// of the TDTs. 0131 uint64_t index : 4; /// 68:71 Must be = 0 DDW0 0132 // uint64_t id : 8; /// 72:79 0xe4; Status Word (HSW) 0133 // identifier 0134 }; // DIAGNOSTIC DATA WORD 0135 0136 struct 0137 { 0138 uint64_t diagnostic_data : 64; /// 0:63 Error specific diagnostic data 0139 uint8_t lane_error_id : 8; /// 64:71 Identifier of the specific error 0140 /// condition 0141 // uint8_t id : 8; /// 72:79 0xa0 - 0xa8; Diagnostic IB 0142 // lane 0143 }; // DIAGNOSTIC IB LANE 0144 0145 uint8_t data8[GBTWordLength]; // 80 bits GBT word 0146 }; 0147 #pragma GCC diagnostic pop 0148 0149 GBTWord() = default; 0150 0151 /// check if the GBT Header corresponds to GBT payload header 0152 bool isIHW() const { return id == GBTFlagIHW; } 0153 0154 /// check if the GBT Header corresponds to GBT payload trailer 0155 bool isTDH() const { return id == GBTFlagTDH; } 0156 0157 /// check if the GBT Header corresponds to Calibration word 0158 bool isCDW() const { return id == GBTFlagCDW; } 0159 0160 /// check if the GBT Header corresponds to GBT trigger word 0161 bool isTDT() const { return id == GBTFlagTDT; } 0162 0163 /// check if the GBT Header corresponds to Diagnostic data 0164 bool isDDW() const { return id == GBTFlagDDW; } 0165 0166 /// check if the GBT Header corresponds to ITS IB diagnostics data (header is 0167 /// combined with lanes info) 0168 bool isDiagnosticIB() const { return (id & 0xe0) == GBTFlagDiagnosticIB; } 0169 0170 /// check if the GBT Header corresponds to ITS IB data (header is combined 0171 /// with lanes info) 0172 bool isData() const { return (id & 0xe0) == GBTFlagDataIB; } 0173 0174 const uint8_t *getW8() const { return data8; } 0175 0176 uint8_t getHeader() const { return id; } 0177 0178 void printX() const; 0179 0180 std::string asString() const; 0181 0182 // ClassDefNV(GBTWord, 1); 0183 }; 0184 0185 struct GBTCalibDataWord : public GBTWord 0186 { // calibration data word 0187 /// bits 0 : 47, user-written tagging fields 0188 /// bits 48 : 71, self-incrementing counter of CDW words 0189 /// bits 72 : 79, calibration indicator 0190 0191 GBTCalibDataWord() { id = GBTFlagCDW; } 0192 GBTCalibDataWord(uint64_t userData, uint16_t counter = 0) 0193 { 0194 id = GBTFlagCDW; 0195 calibUserField = userData & ((0x1UL << 48) - 1); 0196 calibCounter = counter & ((0x1 << 24) - 1); 0197 } 0198 // ClassDefNV(GBTCalibration, 1); 0199 }; 0200 0201 } // namespace mvtx 0202 0203 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |