2 #include "l1_fp201_2015_a.hh"
3 #include "fms_fm101_2015_a.hh"
4 #include "fms_fm103_2015_a.hh"
9 static const int NBITBS=12;
10 static int DBS[NBITBS][NBITBS];
11 static const int tableBS[NBITBS][NBITBS]={
12 {0,0,0,0,0,0,0,0,0,0,0,0},
13 {0,0,0,0,0,0,0,0,0,0,0,0},
14 {1,0,0,0,0,0,0,0,0,0,0,0},
15 {1,1,0,0,0,0,0,0,0,0,0,0},
16 {1,1,1,0,0,0,0,0,0,0,0,0},
17 {0,1,1,1,0,0,0,0,0,0,0,0},
18 {0,0,1,1,1,0,0,0,0,0,0,0},
19 {0,0,0,1,1,1,0,0,0,0,0,0},
20 {1,0,0,0,1,1,1,0,0,0,0,0},
21 {1,1,0,0,0,1,1,1,0,0,0,0},
22 {1,1,1,0,0,0,1,1,1,0,0,0},
23 {0,1,1,1,0,0,0,1,1,1,0,0}};
28 static const int NBITJp=6;
29 static int DJp[NBITJp][NBITJp];
30 static const int tableJp[NBITJp][NBITJp]={
40 void l1_fp201_2015_a(
Board& fp201,
int t,
int simdat){
41 const int JpThr0=fp201.registers[0];
42 const int JpThr1=fp201.registers[1];
43 const int JpThr2=fp201.registers[2];
51 if(simdat==0) {in=(
int*)fp201.channels[t];}
52 else {in=(
int*)fp201.dsmdata[t];}
59 int smBS3 = getFM101_2015a_BS3(fm101) | getFM101_2015a_BS3(fm102);
60 int lgBS3 = getFM103_2015a_BS3(fm103) | getFM103_2015a_BS3(fm104);
61 int smBS2 = getFM101_2015a_BS2(fm101) | getFM101_2015a_BS2(fm102);
62 int lgBS2 = getFM103_2015a_BS2(fm103) | getFM103_2015a_BS2(fm104);
63 int smBS1 = getFM101_2015a_BS1T(fm101) | getFM101_2015a_BS1M(fm101) | getFM101_2015a_BS1B(fm101)
64 | getFM101_2015a_BS1T(fm102) | getFM101_2015a_BS1M(fm102) | getFM101_2015a_BS1B(fm102);
65 int lgBS1 = getFM103_2015a_BS1T(fm103) | getFM103_2015a_BS1M(fm103) | getFM103_2015a_BS1B(fm103)
66 | getFM103_2015a_BS1T(fm104) | getFM103_2015a_BS1M(fm104) | getFM103_2015a_BS1B(fm104);
70 memset(DBS,0,
sizeof(DBS));
72 = (getFM101_2015a_BS1T(fm101)<<0) | (getFM101_2015a_BS1M(fm101)<<1) | (getFM101_2015a_BS1B(fm101)<<2)
73 | (getFM101_2015a_BS1B(fm102)<<3) | (getFM101_2015a_BS1M(fm102)<<4) | (getFM101_2015a_BS1T(fm102)<<5)
74 | (getFM103_2015a_BS1T(fm103)<<6) | (getFM103_2015a_BS1M(fm103)<<7) | (getFM103_2015a_BS1B(fm103)<<8)
75 | (getFM103_2015a_BS1B(fm104)<<9) | (getFM103_2015a_BS1M(fm104)<<10)| (getFM103_2015a_BS1T(fm104)<<12);
76 fp201.userdata[t][0]=bs1;
77 for(
int i=0; i<NBITBS; i++){
79 for(
int j=i+1; j<NBITBS; j++){
80 if(tableBS[j][i] & btest(bs1,j)) {DBS[j][i]=1; DiBS=1;}
87 jp[0] = getFM101_2015a_JpT(fm101) + getFM103_2015a_JpT(fm103);
88 jp[1] = getFM101_2015a_JpM(fm101) + getFM103_2015a_JpM(fm103);
89 jp[2] = getFM101_2015a_JpB(fm101) + getFM103_2015a_JpB(fm103);
90 jp[3] = getFM101_2015a_JpB(fm102) + getFM103_2015a_JpB(fm104);
91 jp[4] = getFM101_2015a_JpM(fm102) + getFM103_2015a_JpM(fm104);
92 jp[5] = getFM101_2015a_JpT(fm102) + getFM103_2015a_JpT(fm104);
93 int JP2=0, JP1=0, JP0=0, jp0=0;
94 for(
int i=0; i<NBITJp; i++){
95 if(jp[i]>JpThr2) JP2=1;
96 if(jp[i]>JpThr1) JP1=1;
97 if(jp[i]>JpThr0) {JP0=1; jp0+=(1<<i);}
99 fp201.userdata[t][1]=jp0;
103 memset(DJp,0,
sizeof(DJp));
104 for(
int i=0; i<NBITJp-1; i++){
106 for(
int j=i+1; j<NBITJp; j++){
107 if(tableJp[j][i] & btest(jp0,j)) {DJp[j][i]=1; DiJp=1;}
113 = smBS3<<0 | smBS2<<1 | smBS1<<2
114 | lgBS3<<3 | lgBS2<<4 | lgBS1<<5
116 | JP2<<7 | JP1<<8 | JP0<<9
121 printf(
"%s input FM101=%08x FM102=%08x FM103=%08x FM104=%08x\n",fp201.name,fm101,fm102,fm103,fm104);
122 printf(
"%s out=%08x smBS3/2/1=%1d %1d %1d lgBS3/2/1=%1d %1d %1d DiBS=%1d JP=%1d %1d %1d DiJp=%1d\n",
123 fp201.name,fp201.output[t],
130 printf(
"%s DiBS bs1=%03x=",fp201.name,bs1);
131 for(
int i=NBITBS-1; i>=0; i--) printf(
"%1x",btest(bs1,i));
133 for(
int j=0; j<NBITBS; j++){
135 for(
int i=0; i<=j; i++){
136 printf(
" %1d", DBS[j][i]);
141 printf(
"%s DiJp jp1=%02x=",fp201.name,jp0);
142 for(
int i=NBITJp-1; i>=0; i--) printf(
"%1x",btest(jp0,i));
144 for(
int j=0; j<NBITJp; j++){
146 for(
int i=0; i<NBITJp; i++){
147 printf(
" %1d", DJp[j][i]);
154 int getFP201_2015a_bs0bits(
Board& fp201,
int t) {
return fp201.userdata[t][0];}
155 int getFP201_2015a_jp1bits(
Board& fp201,
int t) {
return fp201.userdata[t][1];}