Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Static Private Attributes | List of all members
dune::FelixReorder Class Reference

#include <FelixReorder.hh>

Static Public Member Functions

static bool do_reorder (uint8_t *dst, const uint8_t *src, const unsigned &num_frames, unsigned *num_faulty) noexcept
 METHODS ///. More...
 
static bool do_avx_reorder (uint8_t *dst, const uint8_t *src, const unsigned &num_frames, unsigned *num_faulty) noexcept
 
static bool do_avx512_reorder (uint8_t *dst, const uint8_t *src, const unsigned &num_frames, unsigned *num_faulty) noexcept
 
static bool do_reorder_part (uint8_t *dst, const uint8_t *src, const unsigned frames_start, const unsigned frames_stop, const unsigned &num_frames, unsigned *num_faulty) noexcept
 
static bool do_avx_reorder_part (uint8_t *dst, const uint8_t *src, const unsigned frames_start, const unsigned frames_stop, const unsigned &num_frames, unsigned *num_faulty) noexcept
 
static bool do_avx512_reorder_part (uint8_t *dst, const uint8_t *src, const unsigned frames_start, const unsigned frames_stop, const unsigned &num_frames, unsigned *num_faulty) noexcept
 
static unsigned calculate_reordered_size (unsigned num_frames, unsigned num_faulty)
 

Static Public Attributes

static constexpr size_t m_num_bytes_per_frame
 Framesize public constants. More...
 
static constexpr size_t m_num_bytes_per_reord_frame
 
static const bool avx_available = false
 
static const bool avx512_available = false
 

Static Private Member Functions

static void copy_headers (uint8_t *dst, const uint8_t *src)
 
static void handle_headers (uint8_t *dst, const uint8_t *src, const unsigned frame_index, const unsigned &num_frames, unsigned *num_faulty)
 
static void baseline_handle_frames (uint8_t *dst, const uint8_t *src, const unsigned frames_start, const unsigned frames_stop, const unsigned &num_frames, unsigned *num_faulty)
 BASELINE REORDERING ///. More...
 

Static Private Attributes

static constexpr size_t m_num_blocks_per_frame = 4
 SIZE CONSTANTS ///. More...
 
static constexpr size_t m_num_ch_per_frame = 256
 
static constexpr size_t m_num_ch_per_block = 64
 
static constexpr size_t m_num_seg_per_block = 8
 
static constexpr size_t m_num_ch_per_seg = 8
 
static constexpr size_t m_num_bytes_per_seg = 12
 
static constexpr size_t m_num_bytes_per_reord_seg = 16
 
static constexpr size_t m_num_bytes_per_block
 
static constexpr size_t m_coldata_header_size = 4 * 4
 
static constexpr size_t m_wib_header_size = 4 * 4
 
static constexpr size_t m_num_bytes_per_data = m_num_ch_per_frame * 2
 
static constexpr size_t m_adc_size = 2
 
static const unsigned b_seg_0 = 0
 BIT OFFSET CONSTANTS ///. More...
 
static const unsigned b_seg_1 = 12
 
static const unsigned b_seg_2 = 24
 
static const unsigned b_seg_3 = 36
 
static const uint8_t b_adc0_ch0_p0 = 0
 
static const uint8_t b_adc0_ch0_p1 = 2
 
static const uint8_t b_adc0_ch1_p0 = 2
 
static const uint8_t b_adc0_ch1_p1 = 4
 
static const uint8_t b_adc0_ch2_p0 = 6
 
static const uint8_t b_adc0_ch2_p1 = 8
 
static const uint8_t b_adc0_ch3_p0 = 8
 
static const uint8_t b_adc0_ch3_p1 = 10
 
static const uint8_t b_adc1_ch0_p0 = 1
 
static const uint8_t b_adc1_ch0_p1 = 3
 
static const uint8_t b_adc1_ch1_p0 = 3
 
static const uint8_t b_adc1_ch1_p1 = 5
 
static const uint8_t b_adc1_ch2_p0 = 7
 
static const uint8_t b_adc1_ch2_p1 = 9
 
static const uint8_t b_adc1_ch3_p0 = 9
 
static const uint8_t b_adc1_ch3_p1 = 11
 
static constexpr unsigned m_frame0 = 0 * m_num_bytes_per_frame
 FRAME OFFSETS ///. More...
 
static constexpr unsigned m_frame1 = 1 * m_num_bytes_per_frame
 
static constexpr unsigned m_frame2 = 2 * m_num_bytes_per_frame
 
static constexpr unsigned m_frame3 = 3 * m_num_bytes_per_frame
 

Detailed Description

Definition at line 21 of file FelixReorder.hh.

Member Function Documentation

void dune::FelixReorder::baseline_handle_frames ( uint8_t *  dst,
const uint8_t *  src,
const unsigned  frames_start,
const unsigned  frames_stop,
const unsigned &  num_frames,
unsigned *  num_faulty 
)
staticprivate

BASELINE REORDERING ///.

Definition at line 88 of file FelixReorder.cc.

92  {
93  // Store all ADC values in uint16_t.
94  const FelixFrame *src = reinterpret_cast<FelixFrame const *>(psrc);
95  uint8_t *end = dst + num_frames * m_num_bytes_per_data;
96 
97  for (unsigned fr = frames_start; fr < frames_stop; ++fr) {
98  handle_headers(end, psrc + m_num_bytes_per_frame * (fr - frames_start), fr,
99  num_frames, num_faulty);
100 
101  for (unsigned ch = 0; ch < m_num_ch_per_frame; ++ch) {
102  adc_t curr_val = (src + fr - frames_start)->channel(ch);
103  memcpy(dst + (ch * num_frames + fr) * m_adc_size, &curr_val, m_adc_size);
104  }
105  }
106 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
uint16_t adc_t
Definition: FelixFormat.hh:18
static constexpr size_t m_num_bytes_per_frame
Framesize public constants.
Definition: FelixReorder.hh:66
uint8_t channel
Definition: CRTFragment.hh:201
static constexpr size_t m_adc_size
Definition: FelixReorder.hh:37
static constexpr size_t m_num_ch_per_frame
Definition: FelixReorder.hh:25
static constexpr size_t m_num_bytes_per_data
Definition: FelixReorder.hh:36
static void handle_headers(uint8_t *dst, const uint8_t *src, const unsigned frame_index, const unsigned &num_frames, unsigned *num_faulty)
Definition: FelixReorder.cc:23
static unsigned dune::FelixReorder::calculate_reordered_size ( unsigned  num_frames,
unsigned  num_faulty 
)
inlinestatic

Definition at line 100 of file FelixReorder.hh.

101  {
102  return m_num_bytes_per_data * num_frames +
105  (num_faulty + 1) +
106  (num_frames + 7) / 8;
107  }
static constexpr size_t m_coldata_header_size
Definition: FelixReorder.hh:34
static constexpr size_t m_wib_header_size
Definition: FelixReorder.hh:35
static constexpr size_t m_num_blocks_per_frame
SIZE CONSTANTS ///.
Definition: FelixReorder.hh:24
static constexpr size_t m_num_bytes_per_data
Definition: FelixReorder.hh:36
void dune::FelixReorder::copy_headers ( uint8_t *  dst,
const uint8_t *  src 
)
staticprivate

WIB

ColData

Definition at line 10 of file FelixReorder.cc.

10  {
11  /// WIB
12  memcpy(dst, src, m_wib_header_size);
13 
14  /// ColData
15  for (unsigned i = 0; i < m_num_blocks_per_frame; ++i) {
16  memcpy(dst + m_wib_header_size + i * m_coldata_header_size,
17  src + m_wib_header_size +
18  i * (m_num_bytes_per_block + m_coldata_header_size),
19  m_coldata_header_size);
20  }
21 }
static constexpr size_t m_coldata_header_size
Definition: FelixReorder.hh:34
static constexpr size_t m_wib_header_size
Definition: FelixReorder.hh:35
static constexpr size_t m_num_blocks_per_frame
SIZE CONSTANTS ///.
Definition: FelixReorder.hh:24
static constexpr size_t m_num_bytes_per_block
Definition: FelixReorder.hh:32
bool dune::FelixReorder::do_avx512_reorder ( uint8_t *  dst,
const uint8_t *  src,
const unsigned &  num_frames,
unsigned *  num_faulty 
)
staticnoexcept

Definition at line 519 of file FelixReorder.cc.

521  {
522  UNUSED(dst);
523  UNUSED(src);
524  UNUSED(num_frames);
525  UNUSED(num_faulty);
526 
527  return false;
528 }
#define UNUSED(x)
Thijs Miedema, last edit 2018-08-30.
Definition: FelixReorder.cc:6
bool dune::FelixReorder::do_avx512_reorder_part ( uint8_t *  dst,
const uint8_t *  src,
const unsigned  frames_start,
const unsigned  frames_stop,
const unsigned &  num_frames,
unsigned *  num_faulty 
)
staticnoexcept

Definition at line 530 of file FelixReorder.cc.

534  {
535  UNUSED(dst);
536  UNUSED(src);
537  UNUSED(num_frames);
538  UNUSED(frames_start);
539  UNUSED(frames_stop);
540  UNUSED(num_faulty);
541 
542  return false;
543 }
#define UNUSED(x)
Thijs Miedema, last edit 2018-08-30.
Definition: FelixReorder.cc:6
bool dune::FelixReorder::do_avx_reorder ( uint8_t *  dst,
const uint8_t *  src,
const unsigned &  num_frames,
unsigned *  num_faulty 
)
staticnoexcept

Definition at line 255 of file FelixReorder.cc.

257  {
258  UNUSED(dst);
259  UNUSED(src);
260  UNUSED(num_frames);
261  UNUSED(num_faulty);
262  return false;
263 }
#define UNUSED(x)
Thijs Miedema, last edit 2018-08-30.
Definition: FelixReorder.cc:6
bool dune::FelixReorder::do_avx_reorder_part ( uint8_t *  dst,
const uint8_t *  src,
const unsigned  frames_start,
const unsigned  frames_stop,
const unsigned &  num_frames,
unsigned *  num_faulty 
)
staticnoexcept

Definition at line 265 of file FelixReorder.cc.

269  {
270  UNUSED(dst);
271  UNUSED(src);
272  UNUSED(num_frames);
273  UNUSED(frames_start);
274  UNUSED(frames_stop);
275  UNUSED(num_faulty);
276 
277  return false;
278 }
#define UNUSED(x)
Thijs Miedema, last edit 2018-08-30.
Definition: FelixReorder.cc:6
bool dune::FelixReorder::do_reorder ( uint8_t *  dst,
const uint8_t *  src,
const unsigned &  num_frames,
unsigned *  num_faulty 
)
staticnoexcept

METHODS ///.

Definition at line 108 of file FelixReorder.cc.

110  {
111  try {
112  baseline_handle_frames(dst, src, 0, num_frames, num_frames, num_faulty);
113  } catch (...) {
114  return false;
115  }
116  return true;
117 }
static void baseline_handle_frames(uint8_t *dst, const uint8_t *src, const unsigned frames_start, const unsigned frames_stop, const unsigned &num_frames, unsigned *num_faulty)
BASELINE REORDERING ///.
Definition: FelixReorder.cc:88
bool dune::FelixReorder::do_reorder_part ( uint8_t *  dst,
const uint8_t *  src,
const unsigned  frames_start,
const unsigned  frames_stop,
const unsigned &  num_frames,
unsigned *  num_faulty 
)
staticnoexcept

Definition at line 119 of file FelixReorder.cc.

123  {
124  try {
125  baseline_handle_frames(dst, src, frames_start, frames_stop, num_frames,
126  num_faulty);
127  } catch (...) {
128  return false;
129  }
130  return true;
131 }
static void baseline_handle_frames(uint8_t *dst, const uint8_t *src, const unsigned frames_start, const unsigned frames_stop, const unsigned &num_frames, unsigned *num_faulty)
BASELINE REORDERING ///.
Definition: FelixReorder.cc:88
void dune::FelixReorder::handle_headers ( uint8_t *  dst,
const uint8_t *  src,
const unsigned  frame_index,
const unsigned &  num_frames,
unsigned *  num_faulty 
)
staticprivate

Definition at line 23 of file FelixReorder.cc.

26  {
27  size_t bitfield_size = (num_frames + 7) / 8;
28 
29  if (frame_index == 0) {
30  for (unsigned i = 0; i < bitfield_size; i++) dst[i] = 0;
31  copy_headers(dst + bitfield_size, src);
32  return;
33  }
34 
35  const WIBHeader *wib_frame_0 =
36  reinterpret_cast<WIBHeader const *>(dst + bitfield_size);
37  const WIBHeader *wib_frame_n = reinterpret_cast<WIBHeader const *>(src);
38 
39  bool check_failed = false;
40 
41  // WIB header checks.
42  check_failed |= wib_frame_0->sof ^ wib_frame_n->sof;
43  check_failed |= wib_frame_0->version ^ wib_frame_n->version;
44  check_failed |= wib_frame_0->fiber_no ^ wib_frame_n->fiber_no;
45  check_failed |= wib_frame_0->crate_no ^ wib_frame_n->crate_no;
46  check_failed |= wib_frame_0->slot_no ^ wib_frame_n->slot_no;
47  check_failed |= wib_frame_0->mm ^ wib_frame_n->mm;
48  check_failed |= wib_frame_0->oos ^ wib_frame_n->oos;
49  check_failed |= wib_frame_0->wib_errors ^ wib_frame_n->wib_errors;
50  check_failed |= wib_frame_0->z ^ wib_frame_n->z;
51  check_failed |= (uint64_t)(wib_frame_0->timestamp() + 25 * frame_index) ^
52  wib_frame_n->timestamp();
53 
54  // COLDATA header checks.
55  for (unsigned j = 0; j < 4; ++j) {
56  const ColdataHeader *col_frame_0 = reinterpret_cast<ColdataHeader const *>(
57  dst + bitfield_size + m_wib_header_size + j * m_coldata_header_size);
58  const ColdataHeader *col_frame_n = reinterpret_cast<ColdataHeader const *>(
59  src + m_wib_header_size +
61 
62  check_failed |= col_frame_0->s1_error ^ col_frame_n->s1_error;
63  check_failed |= col_frame_0->s2_error ^ col_frame_n->s2_error;
64  check_failed |= col_frame_0->checksum_a() ^ col_frame_n->checksum_a();
65  check_failed |= col_frame_0->checksum_b() ^ col_frame_n->checksum_b();
66  check_failed |= col_frame_0->error_register ^ col_frame_n->error_register;
67 
68  for (unsigned h = 0; h < 8; ++h) {
69  check_failed |= col_frame_0->hdr(h) ^ col_frame_n->hdr(h);
70  }
71  check_failed |=
72  (uint16_t)(col_frame_0->coldata_convert_count + 1 * frame_index) ^
73  col_frame_n->coldata_convert_count;
74  }
75 
76  if (check_failed) {
78  dst + bitfield_size +
79  (*num_faulty + 1) * (m_wib_header_size + m_num_blocks_per_frame *
81  src);
82 
83  (*num_faulty)++;
84  dst[frame_index / 8] |= 1 << (frame_index % 8);
85  }
86 }
static constexpr size_t m_coldata_header_size
Definition: FelixReorder.hh:34
static constexpr size_t m_wib_header_size
Definition: FelixReorder.hh:35
static void copy_headers(uint8_t *dst, const uint8_t *src)
Definition: FelixReorder.cc:10
static constexpr size_t m_num_blocks_per_frame
SIZE CONSTANTS ///.
Definition: FelixReorder.hh:24
static constexpr size_t m_num_bytes_per_block
Definition: FelixReorder.hh:32

Member Data Documentation

const bool dune::FelixReorder::avx512_available = false
static

Definition at line 118 of file FelixReorder.hh.

const bool dune::FelixReorder::avx_available = false
static

Definition at line 112 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc0_ch0_p0 = 0
staticprivate

Definition at line 47 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc0_ch0_p1 = 2
staticprivate

Definition at line 48 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc0_ch1_p0 = 2
staticprivate

Definition at line 49 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc0_ch1_p1 = 4
staticprivate

Definition at line 50 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc0_ch2_p0 = 6
staticprivate

Definition at line 51 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc0_ch2_p1 = 8
staticprivate

Definition at line 52 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc0_ch3_p0 = 8
staticprivate

Definition at line 53 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc0_ch3_p1 = 10
staticprivate

Definition at line 54 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc1_ch0_p0 = 1
staticprivate

Definition at line 55 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc1_ch0_p1 = 3
staticprivate

Definition at line 56 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc1_ch1_p0 = 3
staticprivate

Definition at line 57 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc1_ch1_p1 = 5
staticprivate

Definition at line 58 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc1_ch2_p0 = 7
staticprivate

Definition at line 59 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc1_ch2_p1 = 9
staticprivate

Definition at line 60 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc1_ch3_p0 = 9
staticprivate

Definition at line 61 of file FelixReorder.hh.

const uint8_t dune::FelixReorder::b_adc1_ch3_p1 = 11
staticprivate

Definition at line 62 of file FelixReorder.hh.

const unsigned dune::FelixReorder::b_seg_0 = 0
staticprivate

BIT OFFSET CONSTANTS ///.

Definition at line 41 of file FelixReorder.hh.

const unsigned dune::FelixReorder::b_seg_1 = 12
staticprivate

Definition at line 42 of file FelixReorder.hh.

const unsigned dune::FelixReorder::b_seg_2 = 24
staticprivate

Definition at line 43 of file FelixReorder.hh.

const unsigned dune::FelixReorder::b_seg_3 = 36
staticprivate

Definition at line 44 of file FelixReorder.hh.

constexpr size_t dune::FelixReorder::m_adc_size = 2
staticprivate

Definition at line 37 of file FelixReorder.hh.

constexpr size_t dune::FelixReorder::m_coldata_header_size = 4 * 4
staticprivate

Definition at line 34 of file FelixReorder.hh.

constexpr unsigned dune::FelixReorder::m_frame0 = 0 * m_num_bytes_per_frame
staticprivate

FRAME OFFSETS ///.

Definition at line 123 of file FelixReorder.hh.

constexpr unsigned dune::FelixReorder::m_frame1 = 1 * m_num_bytes_per_frame
staticprivate

Definition at line 124 of file FelixReorder.hh.

constexpr unsigned dune::FelixReorder::m_frame2 = 2 * m_num_bytes_per_frame
staticprivate

Definition at line 125 of file FelixReorder.hh.

constexpr unsigned dune::FelixReorder::m_frame3 = 3 * m_num_bytes_per_frame
staticprivate

Definition at line 126 of file FelixReorder.hh.

constexpr size_t dune::FelixReorder::m_num_blocks_per_frame = 4
staticprivate

SIZE CONSTANTS ///.

Definition at line 24 of file FelixReorder.hh.

constexpr size_t dune::FelixReorder::m_num_bytes_per_block
staticprivate
Initial value:

Definition at line 32 of file FelixReorder.hh.

constexpr size_t dune::FelixReorder::m_num_bytes_per_data = m_num_ch_per_frame * 2
staticprivate

Definition at line 36 of file FelixReorder.hh.

constexpr size_t dune::FelixReorder::m_num_bytes_per_frame
static
Initial value:

Framesize public constants.

Definition at line 66 of file FelixReorder.hh.

constexpr size_t dune::FelixReorder::m_num_bytes_per_reord_frame
static
constexpr size_t dune::FelixReorder::m_num_bytes_per_reord_seg = 16
staticprivate

Definition at line 31 of file FelixReorder.hh.

constexpr size_t dune::FelixReorder::m_num_bytes_per_seg = 12
staticprivate

Definition at line 30 of file FelixReorder.hh.

constexpr size_t dune::FelixReorder::m_num_ch_per_block = 64
staticprivate

Definition at line 26 of file FelixReorder.hh.

constexpr size_t dune::FelixReorder::m_num_ch_per_frame = 256
staticprivate

Definition at line 25 of file FelixReorder.hh.

constexpr size_t dune::FelixReorder::m_num_ch_per_seg = 8
staticprivate

Definition at line 28 of file FelixReorder.hh.

constexpr size_t dune::FelixReorder::m_num_seg_per_block = 8
staticprivate

Definition at line 27 of file FelixReorder.hh.

constexpr size_t dune::FelixReorder::m_wib_header_size = 4 * 4
staticprivate

Definition at line 35 of file FelixReorder.hh.


The documentation for this class was generated from the following files: