18 uint8_t tmp_d = ((d << 4) & 0xF0);
19 uint8_t tmp_d0 = (tmp_d & 0x80) >> 3;
20 uint8_t tmp_d1 = (tmp_d & 0x40) >> 1;
21 uint8_t tmp_d2 = (tmp_d & 0x20) << 1;
22 uint8_t tmp_d3 = (tmp_d & 0x10) << 3;
23 tmp_d = tmp_d0 + tmp_d1 + tmp_d2 + tmp_d3;
25 unsigned long chn_reg =
26 (tmp_d & 0xF0) + ((pcsr & 0x01) << 3) + ((pdsr & 0x01) << 2) + ((slp & 0x01) << 1) + ((tstin & 0x01) << 0);
28 std::bitset<8> bits(chn_reg);
29 size_t start_pos = (8 * 16 + 16) * chip + (16 - chn) * 8;
30 for (
size_t iBit = 0; iBit < 8; iBit++) {
31 BITS[iBit + start_pos - 8] = bits[iBit];
66 bits[12] = engr & 0x1;
67 bits[13] = frqc & 0x1;
68 bits[14] = clk1 & 0x1;
69 bits[15] = clk0 & 0x1;
71 size_t start_pos = (8 * 16 + 16) * chip + 16 * 8;
72 for (
size_t iBit = 0; iBit < 16; iBit++) {
73 BITS[iBit + start_pos] = bits[iBit];
100 for (
size_t chn = 0; chn < 16; chn++) {
101 set_ch(chip, chn, d, pcsr, pdsr, slp, tstin);
104 set_global(chip, f4, f5, slsb, res4, res3, res2, res1, res0, clk0, clk1, frqc, engr, f0, f1, f2, f3);
131 for (
size_t chip = 0; chip < 8; chip++) {
166 std::cout <<
"ADC_ASIC_reg_mapping (binary):" << std::endl;
167 std::string bitString =
BITS.to_string<char, std::string::traits_type, std::string::allocator_type>();
168 for (
size_t iLine = 0; iLine < 36; iLine++) {
169 for (
size_t iByte = 0; iByte < 4; iByte++) {
170 for (
size_t iBit = 0; iBit < 8; iBit++) {
171 std::cout << bitString[iLine * 32 + iByte * 8 + iBit];
175 std::cout << std::endl;
void set_global(uint8_t chip, uint8_t f4=0, uint8_t f5=0, uint8_t slsb=0, uint8_t res4=0, uint8_t res3=0, uint8_t res2=0, uint8_t res1=0, uint8_t res0=0, uint8_t clk0=0, uint8_t clk1=0, uint8_t frqc=0, uint8_t engr=0, uint8_t f0=0, uint8_t f1=0, uint8_t f2=0, uint8_t f3=0)
std::bitset< 1152 > get_bits() const
void set_board(uint8_t d=0, uint8_t pcsr=0, uint8_t pdsr=0, uint8_t slp=0, uint8_t tstin=0, uint8_t f4=0, uint8_t f5=0, uint8_t slsb=0, uint8_t res4=0, uint8_t res3=0, uint8_t res2=0, uint8_t res1=0, uint8_t res0=0, uint8_t clk0=0, uint8_t clk1=0, uint8_t frqc=0, uint8_t engr=0, uint8_t f0=0, uint8_t f1=0, uint8_t f2=0, uint8_t f3=0)
void set_chip(uint8_t chip=0, uint8_t d=0, uint8_t pcsr=0, uint8_t pdsr=0, uint8_t slp=0, uint8_t tstin=0, uint8_t f4=0, uint8_t f5=0, uint8_t slsb=0, uint8_t res4=0, uint8_t res3=0, uint8_t res2=0, uint8_t res1=0, uint8_t res0=0, uint8_t clk0=0, uint8_t clk1=0, uint8_t frqc=0, uint8_t engr=0, uint8_t f0=0, uint8_t f1=0, uint8_t f2=0, uint8_t f3=0)
void set_ch(uint8_t chip=0, uint8_t chn=0, uint8_t d=0, uint8_t pcsr=0, uint8_t pdsr=0, uint8_t slp=0, uint8_t tstin=0)