DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
tpglibs Namespace Reference

Classes

class  AbstractFactory
 General singleton, abstract factory. More...
 
class  AbstractProcessor
 Abstract signal processor. More...
 
class  AVXAbsRunSumProcessor
 AVX signal processor: Calculates the running sum of the signal's absolute value. More...
 
class  AVXFactory
 AVX typed abstract factory. More...
 
class  AVXFixedPedestalSubtractProcessor
 AVX signal processor: Fixes the estimated pedestal after a configured amount of time. More...
 
class  AVXFrugalPedestalSubtractProcessor
 AVX signal processor: Estimates the pedestal and subtracts. More...
 
class  AVXPipeline
 AVX typed TPG pipeline. More...
 
class  AVXProcessor
 AVX typed abstract signal processor. More...
 
class  AVXRunSumProcessor
 AVX signal processor: Calculates the running sum of the signal. More...
 
class  AVXThresholdProcessor
 AVX signal processor: Passes signals above a threshold. More...
 
class  NaiveAbsRunSumProcessor
 Naive signal processor: Calculates the running sum of the signal's absolute value. More...
 
class  NaiveFactory
 Naive typed abstract factory. More...
 
class  NaiveFrugalPedestalSubtractProcessor
 Naive signal processor: Estimates the pedestal and subtracts. More...
 
class  NaiveProcessor
 Naive typed abstract signal processor. More...
 
class  NaiveRunSumProcessor
 Naive signal processor: Calculates the running sum of the signal. More...
 
class  NaiveThresholdProcessor
 Naive signal processor: Passes signals above a threshold. More...
 
class  TPGenerator
 TPG driving class. More...
 
class  TPGPipeline
 Abstract class for the TPG pipeline. More...
 

Functions

__m256i _mm256_div_epi16 (const __m256i &va, const int16_t &b)
 Hack-ish AVX division function.
 
void _mm256_print_epi16 (const __m256i &input)
 AVX printing function.
 
int16_t _naive_div_int16 (const int16_t &a, const int16_t &b)
 Naive model of AVX division in AVXUtils.
 

Function Documentation

◆ _mm256_div_epi16()

__m256i tpglibs::_mm256_div_epi16 ( const __m256i & va,
const int16_t & b )
inline

Hack-ish AVX division function.

Derivation from https://stackoverflow.com/questions/42442325/how-to-divide-a-m256i-vector-by-an-integer-variable

Parameters
vaAVX2 register as the dividend.
bInteger as the divisor.
Returns
AVX2 register whose elements were divided by b.

Definition at line 29 of file AVXUtils.hpp.

29 {
30 // NaiveUtils.hpp has the lay version.
31 __m256i vb = _mm256_set1_epi16(32768 / b);
32 return _mm256_mulhrs_epi16(va, vb);
33}

◆ _mm256_print_epi16()

void tpglibs::_mm256_print_epi16 ( const __m256i & input)
inline

AVX printing function.

Function naming follows the format of typical AVX2 functions:

  • _mm256 -> 256-bit register.
  • epi16 -> Vector elements are 16-bit signed integers. Does not print a new line.
Parameters
inputA 256-bit register.

Definition at line 46 of file AVXUtils.hpp.

46 {
47 std::array<int16_t, 16> prints;
48 _mm256_storeu_si256(reinterpret_cast<__m256i*>(prints.begin()), input);
49
50 fmt::print("{}", prints);
51}

◆ _naive_div_int16()

int16_t tpglibs::_naive_div_int16 ( const int16_t & a,
const int16_t & b )
inline

Naive model of AVX division in AVXUtils.

This is to produce consistent results with AVX division. The rounding is unorthodox, but it is systematic.

Parameters
aThe dividend.
bThe divisor.
Returns
a / b with funky rounding.

Definition at line 26 of file NaiveUtils.hpp.

26 {
27 int16_t vb = (1 << 15) / b; // 1 / b * 2^15
28 int32_t mulhrs = a * vb; // a / b * 2^15
29 mulhrs = (mulhrs >> 14) + 1; // (a / b * 2^15) * 2^-14 + 1 ~ a / b * 2 + 1
30 mulhrs = mulhrs >> 1; //~ a / b. The +1 causes unorthodox rounding.
31 return (int16_t)(mulhrs);
32}