2 #include "fms_fm101_2017_a.hh"
3 #include "fms_fm001_2017_a.hh"
8 void fms_fm101_2017_a(
Board& fm101,
int t,
int simdat){
9 const int BSThr1=fm101.registers[0];
10 const int BSThr2=fm101.registers[1];
11 const int BSThr3=fm101.registers[2];
20 if(simdat==0) {in=(
int*)fm101.channels[t];}
21 else {in=(
int*)fm101.dsmdata[t];}
28 int DD=getFM001_2017a_D23(T) + getFM001_2017a_D23(B);
29 fm101.userdata[t][0]=DD;
32 int BS3 = getFM001_2017a_BS3(T) | getFM001_2017a_BS3(B) | (DD>BSThr3);
33 int BS2 = getFM001_2017a_BS2(T) | getFM001_2017a_BS2(B) | (DD>BSThr2);
34 int BS1DD=(DD>BSThr1);
35 fm101.userdata[t][7]=(DD>BSThr3);
36 fm101.userdata[t][8]=(DD>BSThr2);
37 fm101.userdata[t][9]=BS1DD;
40 int BS1T=getFM001_2017a_BS1ABC(T);
41 int BS1M=getFM001_2017a_BS1CD(T) | getFM001_2017a_BS1CD(B) | BS1DD;
42 int BS1B=getFM001_2017a_BS1ABC(B);
45 int JpT=getFM001_2017a_JpAB(T)+getFM001_2017a_JpCD(T);
46 int JpM=getFM001_2017a_JpCD(T)+getFM001_2017a_JpCD(B);
47 int JpB=getFM001_2017a_JpAB(B)+getFM001_2017a_JpCD(B);
48 if(JpT>0xff) JpT=0xff;
49 if(JpM>0xff) JpM=0xff;
50 if(JpB>0xff) JpB=0xff;
52 fm101.output[t] = BS3 <<13 | BS2 << 1
53 | BS1T << 2 | BS1M << 3 | BS1B <<4
54 | JpT << 5 | JpM << 16 | JpB <<24;
57 printf(
"%s input T=%08x B=%08x\n",fm101.name,T,B);
58 printf(
"%s out=%08x BS3=%1d BS2=%1d BS1T/M/B=%1d %1d %1d JpT/M/B %3d %3d %3d\n",
59 fm101.name,fm101.output[t],
60 BS3,BS2,BS1T,BS1M,BS1B,JpT,JpM,JpB);
64 int getFM101_2017a_BS3(
int out) {
return getbits(out,13, 1);}
65 int getFM101_2017a_BS2(
int out) {
return getbits(out, 1, 1);}
66 int getFM101_2017a_BS1T(
int out) {
return getbits(out, 2, 1);}
67 int getFM101_2017a_BS1M(
int out) {
return getbits(out, 3, 1);}
68 int getFM101_2017a_BS1B(
int out) {
return getbits(out, 4, 1);}
69 int getFM101_2017a_JpT(
int out) {
return getbits(out, 5, 8);}
70 int getFM101_2017a_JpM(
int out) {
return getbits(out,16, 8);}
71 int getFM101_2017a_JpB(
int out) {
return getbits(out,24, 8);}