16 memset( HTthr,0,
sizeof(HTthr));
17 memset( TPthr,0,
sizeof(TPthr));
27 EEdsm0::setYear(
int y,
int*HTth,
int*TPth ) {
29 assert(type==1 || type==2);
41 memset(value,0,
sizeof(value));
42 memset(outHT2bit,0,
sizeof(outHT2bit));
43 memset(outTP2bit,0,
sizeof(outTP2bit));
44 memset(outHTTP2bit,0,
sizeof(outHTTP2bit));
45 memset(outTPsum,0,
sizeof(outTPsum));
46 memset(out16bit,0,
sizeof(out16bit));
52 EEdsm0::setBite(
int b,
unsigned char val){
60 EEdsm0::setInp12bit(
int ch,
short val){
61 assert(ch>=0 && ch<nc);
68 EEdsm0::getInp12bit(
int ch)
const {
69 assert(ch>=0 && ch<nc);
79 for(ch=0;ch<nc;ch++) {
81 unsigned int val=99999;
86 val = ((
data[k+1] & 0xf) <<8) +
data[k];
92 val =(
data[k+1] <<4) + (
data[k]>>4);
105 EEdsm0::print(
int k)
const {
106 printf(
"EEdsm0 type=%d year=%d \n",type,mYear);
109 printf(
"thresholds HT=");
for(i=0;i<mxTh;i++) printf(
" %2d ", HTthr[i]);
110 printf(
" TP=");
for(i=0;i<mxTh;i++) printf(
" %2d ", TPthr[i]);printf(
"\n");
113 for(i=0;i<nw;i++) printf(
" %2d ",nw-i-1);
115 for(i=0;i<nw;i++) printf(
"x%2.2x ",
data[nw-i-1]);
119 for(i=nc-1;i>=0;i--) printf(
" %3d ",i);
120 printf(
"\nTP+HT = ");
121 for(i=nc-1;i>=0;i--) printf(
" x%3.3x ", getInp12bit(i) );
122 printf(
"\n[dec] = ");
123 for(i=nc-1;i>=0;i--) printf(
"%2d+%2d ", getInpTP6bit(i), getInpHT6bit(i) );
125 printf(
"\n output(s) TPsum=%d HT2b=%d HTTP2b=%d",outTPsum[0],outHT2bit[0],outHTTP2bit[0]);
126 if(type==1) printf(
"\n");
127 else printf(
" AND TPsum=%d HT2b=%d HTTP2b=%d\n",outTPsum[1],outHT2bit[1],outHTTP2bit[1]);
183 if(type==2 && i>=5) iOu=1;
184 outTPsum[iOu]+=getInpTP6bit(i);
186 for(k=0;k<mxTh; k++) {
188 if( getInpHT6bit(i)>HTthr[k] && outHT2bit[iOu]<lev) outHT2bit[iOu]=lev;
189 if( getInpTP6bit(i)>TPthr[k] && outTP2bit[iOu]<lev) outTP2bit[iOu]=lev;
190 if( getInpHT6bit(i)>HTthr[k] && getInpTP6bit(i)>TPthr[k] && outHTTP2bit[iOu]<lev) outHTTP2bit[iOu]=lev;
193 out16bit[iOu] = outTPsum[iOu] + ( outHT2bit[iOu] << 10 ) + ( outTP2bit[iOu] << 12 ) + ( outHTTP2bit[iOu] << 14 );
202 probably wrong,
do not account
for type 1 & 2
205 int EEdsm0 :: maxHT() {
208 unsigned int max=getHT(k);
210 unsigned int val=getHT(i);
211 if(val<=max)
continue;
222 int EEdsm0 :: maxTP() {
225 unsigned int max=getTP(k);
227 unsigned int val=getTP(i);
228 if(val<=max)
continue;