2 #include "l1_fp201_2017_a.hh"
3 #include "fms_fm101_2017_a.hh"
4 #include "fms_fm101_2017_a.hh"
5 #include "fms_fm103_2017_a.hh"
10 static const int NBITBS=12;
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 const int tableJp[NBITJp][NBITJp]={
39 void l1_fp201_2017_a(
Board& fp201,
int t,
int simdat){
40 const int JpThr0=fp201.registers[0];
41 const int JpThr1=fp201.registers[1];
42 const int JpThr2=fp201.registers[2];
50 if(simdat==0) {in=(
int*)fp201.channels[t];}
51 else {in=(
int*)fp201.dsmdata[t];}
58 int smBS3 = getFM101_2017a_BS3(fm101) | getFM101_2017a_BS3(fm102);
59 int lgBS3 = getFM103_2017a_BS3(fm103) | getFM103_2017a_BS3(fm104);
60 int smBS2 = getFM101_2017a_BS2(fm101) | getFM101_2017a_BS2(fm102);
61 int lgBS2 = getFM103_2017a_BS2(fm103) | getFM103_2017a_BS2(fm104);
62 int smBS1 = getFM101_2017a_BS1T(fm101) | getFM101_2017a_BS1M(fm101) | getFM101_2017a_BS1B(fm101)
63 | getFM101_2017a_BS1T(fm102) | getFM101_2017a_BS1M(fm102) | getFM101_2017a_BS1B(fm102);
64 int lgBS1 = getFM103_2017a_BS1T(fm103) | getFM103_2017a_BS1M(fm103) | getFM103_2017a_BS1B(fm103)
65 | getFM103_2017a_BS1T(fm104) | getFM103_2017a_BS1M(fm104) | getFM103_2017a_BS1B(fm104);
71 char DBS[NBITBS][NBITBS];
73 memset(u.INT,0,
sizeof(u.INT));
75 = (getFM101_2017a_BS1T(fm101)<<0) | (getFM101_2017a_BS1M(fm101)<<1) | (getFM101_2017a_BS1B(fm101)<<2)
76 | (getFM101_2017a_BS1B(fm102)<<3) | (getFM101_2017a_BS1M(fm102)<<4) | (getFM101_2017a_BS1T(fm102)<<5)
77 | (getFM103_2017a_BS1T(fm103)<<6) | (getFM103_2017a_BS1M(fm103)<<7) | (getFM103_2017a_BS1B(fm103)<<8)
78 | (getFM103_2017a_BS1B(fm104)<<9) | (getFM103_2017a_BS1M(fm104)<<10)| (getFM103_2017a_BS1T(fm104)<<11);
79 for(
int i=0; i<NBITBS; i++){
81 for(
int j=i+1; j<NBITBS; j++){
82 if(tableBS[j][i] & btest(bs1,j)) {u.DBS[j][i]=1; DiBS=1;}
86 for(
int i=0; i<36; i++) fp201.userdata[t][10+i]=u.INT[i];
90 jp[0] = getFM101_2017a_JpT(fm101) + getFM103_2017a_JpT(fm103);
91 jp[1] = getFM101_2017a_JpM(fm101) + getFM103_2017a_JpM(fm103);
92 jp[2] = getFM101_2017a_JpB(fm101) + getFM103_2017a_JpB(fm103);
93 jp[3] = getFM101_2017a_JpB(fm102) + getFM103_2017a_JpB(fm104);
94 jp[4] = getFM101_2017a_JpM(fm102) + getFM103_2017a_JpM(fm104);
95 jp[5] = getFM101_2017a_JpT(fm102) + getFM103_2017a_JpT(fm104);
96 fp201.userdata[t][0]=jp[0];
97 fp201.userdata[t][1]=jp[1];
98 fp201.userdata[t][2]=jp[2];
99 fp201.userdata[t][3]=jp[3];
100 fp201.userdata[t][4]=jp[4];
101 fp201.userdata[t][5]=jp[5];
103 int JP2=0, JP1=0, JP0=0, jp0=0;
104 fp201.userdata[t][7]=0;
105 fp201.userdata[t][8]=0;
106 fp201.userdata[t][9]=0;
107 for(
int i=0; i<NBITJp; i++){
108 if(jp[i]>JpThr2) {JP2=1; fp201.userdata[t][7]+=(1<<i); }
109 if(jp[i]>JpThr1) {JP1=1; fp201.userdata[t][8]+=(1<<i); }
110 if(jp[i]>JpThr0) {JP0=1; fp201.userdata[t][9]+=(1<<i); jp0+=(1<<i);}
117 char DJp[NBITJp][NBITJp];
119 memset(u2.INT,0,
sizeof(u2.INT));
120 for(
int i=0; i<NBITJp-1; i++){
122 for(
int j=i+1; j<NBITJp; j++){
123 if(tableJp[j][i] & btest(jp0,j)) {u2.DJp[j][i]=1; DiJp=1;}
127 for(
int i=0; i<9; i++) fp201.userdata[t][50+i]=u2.INT[i];
130 = smBS3<<0 | smBS2<<1 | smBS1<<2
131 | lgBS3<<3 | lgBS2<<4 | lgBS1<<5
133 | JP2<<7 | JP1<<8 | JP0<<9
138 printf(
"%s input FM101=%08x FM102=%08x FM103=%08x FM104=%08x\n",fp201.name,fm101,fm102,fm103,fm104);
139 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",
140 fp201.name,fp201.output[t],
150 printf(
"%s DiBS bs1=0x%03x=",fp201.name,bs1);
151 for(
int i=NBITBS-1; i>=0; i--) printf(
"%1x",btest(bs1,i));
153 for(
int j=0; j<NBITBS; j++){
154 printf(
"DiBS %2d : ",j);
155 for(
int i=0; i<=j; i++){
156 printf(
" %1s", u.DBS[j][i]?
"1":
"0");
164 printf(
"%s DiJp jp1=0x%02x=",fp201.name,jp0);
165 for(
int i=NBITJp-1; i>=0; i--) printf(
"%1x",btest(jp0,i));
167 for(
int j=0; j<NBITJp; j++){
169 for(
int i=0; i<NBITJp; i++){
170 printf(
" %1s", u2.DJp[j][i]?
"1":
"0");