ATLAS Offline Software
Loading...
Searching...
No Matches
ALFA_ReadOut.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ALFAREADOUT_H
6#define ALFAREADOUT_H
7
8#include <stdint.h>
9#include <utility>
10
11// Base class for ALFA readout decoding
12
14{
15
16 public:
17
19
20 protected:
21 constexpr std::pair<uint32_t, uint16_t> getBitsWord(const uint16_t bstart, const uint16_t bstop){
22 uint32_t word = 0;
23 for (uint16_t i = bstop; i<bstart ; i++ )
24 word = ((word | 1)<<1);
25 return std::make_pair(word, bstop);
26 }
27
28 // Decode a section of a 32-bits data word
29 uint32_t getBits(std::pair<uint32_t, uint16_t> in){
30 return (m_word >> in.second) & (in.first|1);
31 }
32
33 // Encode a 32-bits data word from fragments with size < 16 bits
34 uint32_t setBits(uint16_t nData, uint16_t* inputData,
35 uint16_t* inputPos);
36
37 // Encode a 32-bits data word from fragments with size < 32 bits
38 uint32_t setBits(uint16_t nData, uint32_t* inputData, uint16_t* inputPos);
39
40 uint32_t m_word;
41
42};
43
44#endif
45
uint32_t m_word
constexpr std::pair< uint32_t, uint16_t > getBitsWord(const uint16_t bstart, const uint16_t bstop)
uint32_t setBits(uint16_t nData, uint16_t *inputData, uint16_t *inputPos)
uint32_t getBits(std::pair< uint32_t, uint16_t > in)
uint32_t setBits(uint16_t nData, uint32_t *inputData, uint16_t *inputPos)