DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ASIC_reg_mapping.cpp
Go to the documentation of this file.
2#include <iomanip>
3#include <iostream>
4#include <limits>
5
10
11void
13{
14 const std::bitset<1152> fe_bits = fe_map.get_bits();
15 const std::bitset<1152> adc_bits = adc_map.get_bits();
16 const size_t chip_bits_len = 144;
17 for (size_t iChip = 0; iChip < 8; iChip++) {
18 std::bitset<chip_bits_len * 2> chip_bits;
19 for (size_t iBit = 0; iBit < chip_bits_len; iBit++) {
20 chip_bits[iBit] = adc_bits[iChip * chip_bits_len + iBit];
21 chip_bits[iBit + chip_bits_len] = fe_bits[iChip * chip_bits_len + iBit];
22 }
23 for (size_t iReg = 0; iReg < 9; iReg++) {
24 std::bitset<32> regBits;
25 for (size_t iBit = 0; iBit < 32; iBit++) {
26 regBits[iBit] = chip_bits[iBit + iReg * 32];
27 }
28 uint32_t regUInt = regBits.to_ulong();
29 REGS[iChip * 9 + iReg] = regUInt;
30 } // for iReg
31 } // for iChip
32} // set_board
33
34std::vector<uint32_t>
36{
37 return REGS;
38}
39
40void
42{
43 std::cout << "ASIC_reg_mapping (hex):" << std::endl;
44
45 for (uint32_t i = 0; i < REGS.size(); ++i) {
46 uint32_t reg = REGS[i];
47 std::cout << std::hex << std::setfill('0') << std::setw(8) << reg << std::endl;
48 // std::cout << reg << std::endl;
49 }
50}
std::bitset< 1152 > get_bits() const
std::vector< uint32_t > REGS
std::vector< uint32_t > get_regs() const
void set_board(const FE_ASIC_reg_mapping &fe_map, const ADC_ASIC_reg_mapping &adc_map)
std::bitset< 1152 > get_bits() const