9 uint8_t sg, uint8_t st, uint8_t smn, uint8_t sdf)
11 unsigned long chn_reg = ((sts&0x01)<<7) + ((snc&0x01)<<6) + ((sg&0x03)<<4)
12 + ((st&0x03)<<2) + ((smn&0x01)<<1) + ((sdf&0x01)<<0);
13 std::bitset<8> bits(chn_reg);
14 size_t start_pos = (8*16+16)*chip + (16-chn)*8;
15 for(
size_t iBit=0; iBit < 8; iBit++)
17 BITS[iBit+start_pos-8] = bits[iBit];
21 uint8_t stb, uint8_t s16, uint8_t slk1,
22 uint8_t sdc, uint8_t swdac, uint8_t dac)
24 unsigned long global_reg = ((slk0&0x01)<<0) + ((stb1&0x01)<<1) + ((stb&0x01)<<2)
25 + ((s16&0x01)<<3) + ((slk1&0x01)<<4) + ((sdc&0x01)<<5) +((0&0x03)<<6);
27 unsigned long dac_reg = (((dac&0x01)/0x01)<<7)+(((dac&0x02)/0x02)<<6)
28 +(((dac&0x04)/0x04)<<5)+(((dac&0x08)/0x08)<<4)
29 +(((dac&0x10)/0x10)<<3)+(((dac&0x20)/0x20)<<2)
32 std::bitset<8> global_bits(global_reg);
33 std::bitset<8> dac_bits(dac_reg);
36 for(
size_t iBit=0; iBit < 8; iBit++)
38 bits[iBit] = global_bits[iBit];
39 bits[iBit+8] = dac_bits[iBit];
42 size_t start_pos = (8*16+16)*chip + 16*8;
43 for(
size_t iBit=0; iBit < 16; iBit++)
45 BITS[iBit+start_pos] = bits[iBit];
50 uint8_t sts, uint8_t snc, uint8_t sg, uint8_t st,
51 uint8_t smn, uint8_t sdf, uint8_t slk0,
52 uint8_t stb1, uint8_t stb, uint8_t s16,
53 uint8_t slk1, uint8_t sdc, uint8_t swdac, uint8_t dac)
55 for (
size_t chn=0; chn<16; chn++)
57 set_ch(chip, chn, sts, snc, sg, st, smn, sdf);
59 set_global (chip, slk0, stb1, stb, s16, slk1, sdc, swdac, dac);
63 uint8_t smn, uint8_t sdf, uint8_t slk0,
64 uint8_t stb1, uint8_t stb, uint8_t s16,
65 uint8_t slk1, uint8_t sdc, uint8_t swdac, uint8_t dac)
67 for (
size_t chip=0; chip<8; chip++)
69 set_chip( chip, sts, snc, sg, st, smn, sdf, slk0, stb1, stb, s16, slk1, sdc, swdac, dac);
81 for (
size_t chip=0; chip<8; chip++)
83 for (
size_t chn=0; chn<16; chn++)
86 size_t start_pos = (8*16+16)*chip + (16-chn)*8;
89 BITS[6+start_pos-8] = snc & 0x1;
97 std::cout <<
"FE_ASIC_reg_mapping (binary):" << std::endl;
98 std::string bitString =
BITS.to_string<char,std::string::traits_type,std::string::allocator_type>();
99 for(
size_t iLine=0; iLine < 36; iLine++)
101 for(
size_t iByte=0; iByte < 4; iByte++)
103 for(
size_t iBit=0; iBit < 8; iBit++)
105 std::cout << bitString[iLine*32+iByte*8+iBit];
109 std::cout << std::endl;
117 {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2},
118 {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2},
119 {2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
120 {2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
121 {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2},
122 {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2},
123 {2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
124 {2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
void set_chip(uint8_t chip=0, uint8_t sts=0, uint8_t snc=0, uint8_t sg=0, uint8_t st=0, uint8_t smn=0, uint8_t sdf=0, uint8_t slk0=0, uint8_t stb1=0, uint8_t stb=0, uint8_t s16=0, uint8_t slk1=0, uint8_t sdc=0, uint8_t swdac=0, uint8_t dac=0)
std::bitset< 1152 > get_bits() const
void set_collection_baseline(uint8_t snc)
static const uint8_t channel_wire_plane[8][16]
void set_global(uint8_t chip=0, uint8_t slk0=0, uint8_t stb1=0, uint8_t stb=0, uint8_t s16=0, uint8_t slk1=0, uint8_t sdc=0, uint8_t swdac=0, uint8_t dac=0)
void set_board(uint8_t sts=0, uint8_t snc=0, uint8_t sg=0, uint8_t st=0, uint8_t smn=0, uint8_t sdf=0, uint8_t slk0=0, uint8_t stb1=0, uint8_t stb=0, uint8_t s16=0, uint8_t slk1=0, uint8_t sdc=0, uint8_t swdac=0, uint8_t dac=0)
void set_ch(uint8_t chip=0, uint8_t chn=0, uint8_t sts=0, uint8_t snc=0, uint8_t sg=0, uint8_t st=0, uint8_t smn=0, uint8_t sdf=0)