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