= TQDC16VS-E Data Format = Hardware [[TQDC16VS-E]] TQDC16VS-E payload data is encapsulated in [[MStream_2_2|M-Stream 2.2]] protocol using Data Subtype 0. ||<-32 rowclass="bits">M-Stream Header|| ||<:>word #||<:>byte offset||<:>bits||<:>description|| ||<:|4> 0 ||<:|4> 0 || 31:24 || [[DeviceId|Device ID]] || || 23:18 || Flags || || 17:16 || Subtype || || 15:0 || Fragment length || ||<:|2> 1 ||<:|2> 4 || 31:16 || Fragment ID bits [15:0] || ||15:0||Fragment offset code|| ||<-32 rowclass="bits">M-Stream Subtype 0, first fragment|| ||<:> 2 ||<:> 8 || 31:0 || Device Serial || ||<:|3> 3 ||<:|3> 12 || 31:28 || reserved || || 27:24 || trig_pos || || 23:0 || Event number || ||<:> 4 ||<:> 16 || 31:0 || Event timestamp, TAI seconds || ||<:|2> 5 ||<:|2> 20 || 31:2 || Event timestamp, TAI nanoseconds || || 1:0 || Event timestamp, TAI flags || ||<:> 6 ||<:> 24 || 31:0 ||<|3> Event Data || ||<:-3> ... || ||<:> N-1 ||<:> 4*(N-1) || 31:0 || ||<-32 rowclass="bits">M-Stream Subtype 0, next fragments|| ||<:> 2 ||<:> 8 || 31:0 ||<|3> Event Data || ||<:-3> ... || ||<:> N-1 ||<:> 4*(N-1) || 31:0 || == TQDC16VS-E Event Data == ||<:>word # ||<:>byte offset||<:>bits||<:>description|| ||<:> 0 ||<:> 0 || 31:0 ||<|3> TDC Data Block (S,,1,, bytes) || ||<:-3> ... || ||<:> S,,1,,/4-1 ||<:> S,,1,,-4 || 31:0 || ||<:> S,,1,,/4 ||<:> 0 || 31:0 ||<|3> ADC Data Block (S,,2,, bytes) || ||<:-3> ... || ||<:> (S,,1,,+S,,2,,)/4-1 ||<:> S,,1,,+S,,2,,-4 || 31:0 || === TDC Data Block === ||<:>word #||<:>byte offset||<:>bits||<:>description|| ||<:|3> 0 ||<:|3> 0 || 31:28 || TDC Data Type || || 27:16 || reserved || || 15:0 || Data length (in bytes) || ||<:> 1 ||<:> 4 || 31:0 ||<|3> TDC Data Payload || ||<:-3> ... || ||<:> N-1 ||<:> 4*(N-1) || 31:0 || TDC data type is 0x0. === TDC Data Payload === ||<-32 rowclass="bits">2 - TDC event header|| ||31||30||29||28||27||26||25||24||23||22||21||20||19||18||17||16||15||14||13||12||11||10||9||8||7||6||5||4||3||2||1||0|| ||<:-4>2||<:-4>reserved||<:-12>Event number||<:-12>TDC timestamp|| TDC timestamp in number of 25 ns time intervals since global trigger timestamp found in event header. ||<-32 rowclass="bits">3 - TDC event trailer|| ||31||30||29||28||27||26||25||24||23||22||21||20||19||18||17||16||15||14||13||12||11||10||9||8||7||6||5||4||3||2||1||0|| ||<:-4>3||<:-4>reserved||<:-12>Event number||<:-12>TDC word count|| ||<-32 rowclass="bits">4, mode=0 - TDC data|| ||31||30||29||28||27||26||25||24||23||22||21||20||19||18||17||16||15||14||13||12||11||10||9||8||7||6||5||4||3||2||1||0|| ||<:-4>4||<:-2>reserved||<:-5>channel||<:-19>data||<:-2>rcdata|| ||<-32 rowclass="bits">5 - TDC and ADC data, select by mode field|| ||31||30||29||28||27||26||25||24||23||22||21||20||19||18||17||16||15||14||13||12||11||10||9||8||7||6||5||4||3||2||1||0|| ||<:-4>5||<:-2>reserved||<:-5>channel||<:-19>data||<:-2>rcdata|| Channels 16-31 are reserved. TDC time measurement . data bits 18:0 = number of 100 ps time intervals since global trigger timestamp found in event header. When 25 ps mode is active, use rcdata[1:0] for 2 LSB bits of time measurement. ||<-32 rowclass="bits">6 - TDC error|| ||31||30||29||28||27||26||25||24||23||22||21||20||19||18||17||16||15||14||13||12||11||10||9||8||7||6||5||4||3||2||1||0|| ||<:-4>6||<:-13>reserved||<:-15>TDC error flags|| TDC error flags bits: . [0] Hit lost in group 0 from read-out fifo overflow . [1] Hit lost in group 0 from L1 buffer overflow . [2] Hit error have been detected in group 0 . [3] Hit lost in group 1 from read-out fifo overflow . [4] Hit lost in group 1 from L1 buffer overflow . [5] Hit error have been detected in group 1 . [6] Hit lost in group 2 from read-out fifo overflow . [7] Hit lost in group 2 from L1 buffer overflow . [8] Hit error have been detected in group 2 . [9] Hit lost in group 3 from read-out fifo overflow . [10] Hit lost in group 3 from L1 buffer overflow . [11] Hit error have been detected in group 3 . [12] Hits rejected because of programmed event size limit . [13] Event lost (trigger FIFO ovefrlow) . [14] Internal fatal chip error has been detected Most important error bits are 12 and 13. Error bit 14 should be ignored. For detailed description of TDC please refer to [[http://tdc.web.cern.ch/tdc/hptdc/docs/hptdc_manual_ver2.2.pdf|HPTDC manual]]. === ADC Data Block === ||<:>word #||<:>byte offset||<:>bits||<:>description|| ||<:|3> 0 ||<:|3> 0 || 31:28 || ADC Data Type || || 27:16 || Channel number || || 15:0 || Data length (in bytes) || ||<:> 1 ||<:> 4 || 31:0 ||<|3> ADC Data Payload || ||<:-3> ... || ||<:> N-1 ||<:> 4*(N-1) || 31:0 || ADC data type is 0x1. === ADC Data Payload ===