2 #include "fms_fm103_2017_a.hh"
3 #include "fms_fm005_2017_a.hh"
4 #include "fms_fm006_2017_a.hh"
9 void fms_fm103_2017_a(
Board& fm103,
int t,
int simdat){
10 const int BSThr1=fm103.registers[0];
11 const int BSThr2=fm103.registers[1];
12 const int BSThr3=fm103.registers[2];
21 if(simdat==0) {in=(
int*)fm103.channels[t];}
22 else {in=(
int*)fm103.dsmdata[t];}
29 int JJ=getFM005_2017a_J23(T1) + getFM005_2017a_J23(B1);
30 fm103.userdata[t][0]=JJ;
33 int BS3 = getFM005_2017a_BS3(T1) | getFM006_2017a_BS3(T2) | getFM005_2017a_BS3(B1) | getFM006_2017a_BS3(B2) | (JJ>BSThr3);
34 int BS2 = getFM005_2017a_BS2(T1) | getFM006_2017a_BS2(T2) | getFM005_2017a_BS2(B1) | getFM006_2017a_BS2(B2) | (JJ>BSThr2);
35 int BS1JJ=(JJ>BSThr1);
36 int BS1T=getFM006_2017a_BS1EF(T2) | getFM005_2017a_BS1GH(T1);
37 int BS1M=getFM005_2017a_BS1IJ(T1) | BS1JJ | getFM005_2017a_BS1IJ(B1);
38 int BS1B=getFM006_2017a_BS1EF(B2) | getFM005_2017a_BS1GH(B1);
39 fm103.userdata[t][7]=(JJ>BSThr3);
40 fm103.userdata[t][8]=(JJ>BSThr2);
41 fm103.userdata[t][9]=BS1JJ;
45 int JpT=getFM006_2017a_JpEF(T2)+getFM005_2017a_JpGH(T1)+getFM005_2017a_JpIJ(T1);
46 int JpM=getFM005_2017a_JpIJ(T1)+getFM005_2017a_JpIJ(B1);
47 int JpB=getFM006_2017a_JpEF(B2)+getFM005_2017a_JpGH(B1)+getFM005_2017a_JpIJ(B1);
48 if(JpT >0xFF) JpT =0xFF;
49 if(JpM >0xFF) JpM =0xFF;
50 if(JpB >0xFF) JpB =0xFF;
52 fm103.output[t] = BS3 | BS2 << 1
53 | BS1T << 2 | BS1M << 3 | BS1B <<4
54 | JpT << 5 | JpM << 16 | JpB <<24;
57 printf(
"%s input T1=%08x T2=%08x B1=%08x B2=%08x\n",fm103.name,T1,T2,B1,B2);
58 printf(
"%s out=%08x BS3=%1d BS2=%1d BS1T/M/B=%1d %1d %1d JpT/M/B %3d %3d %3d\n",
59 fm103.name,fm103.output[t],
60 BS3,BS2,BS1T,BS1M,BS1B,JpT,JpM,JpB);
64 int getFM103_2017a_BS3(
int out) {
return getbits(out, 0, 1);}
65 int getFM103_2017a_BS2(
int out) {
return getbits(out, 1, 1);}
66 int getFM103_2017a_BS1T(
int out) {
return getbits(out, 2, 1);}
67 int getFM103_2017a_BS1M(
int out) {
return getbits(out, 3, 1);}
68 int getFM103_2017a_BS1B(
int out) {
return getbits(out, 4, 1);}
69 int getFM103_2017a_JpT(
int out) {
return getbits(out, 5, 8);}
70 int getFM103_2017a_JpM(
int out) {
return getbits(out,16, 8);}
71 int getFM103_2017a_JpB(
int out) {
return getbits(out,24, 8);}