Line 32... |
Line 32... |
char *initialheader;
|
char *initialheader;
|
char *end;
|
char *end;
|
int R;
|
int R;
|
|
|
int offset;
|
int offset;
|
|
int addressoffset;
|
|
|
|
|
}memparam={0,0,0,australia,canada,0,1};
|
}memparam={0,0,0,australia,canada,0,1,0};
|
|
|
//mpx memparam={0,0,australia};
|
//mpx memparam={0,0,australia};
|
|
|
void optParser(int argc, char ** argv){
|
void optParser(int argc, char ** argv){
|
|
|
char a=0;
|
char a=0;
|
int e=0,d=0,t=0,s=0,i=0;
|
int e=0,d=0,t=0,s=0,i=0;
|
/*memparam.initialheader=australia;
|
/*memparam.initialheader=australia;
|
memparam.width=0;
|
memparam.width=0;
|
memparam.depth=0;*/
|
memparam.depth=0;*/
|
while ((a=getopt(argc,argv,"o:t:e:d:Rr"))!=-1){
|
while ((a=getopt(argc,argv,"a:o:t:e:d:Rr"))!=-1){
|
switch(a){
|
switch(a){
|
|
case 'a':
|
|
memparam.addressoffset=atoi(optarg);
|
|
break;
|
case 'o':
|
case 'o':
|
memparam.offset=atoi(optarg);
|
memparam.offset=atoi(optarg);
|
break;
|
break;
|
case 'R': //Raiz Cuadrada
|
case 'R': //Raiz Cuadrada
|
memparam.R=1;
|
memparam.R=1;
|
Line 139... |
Line 143... |
int widthpfw=((int)(memparam.width/4))+(memparam.width%4?1:0);
|
int widthpfw=((int)(memparam.width/4))+(memparam.width%4?1:0);
|
srandom(time(0));
|
srandom(time(0));
|
epsilon=1/(float)memparam.depth;
|
epsilon=1/(float)memparam.depth;
|
|
|
fprintf(stdout,"-- epsilon: %f\n",epsilon);
|
fprintf(stdout,"-- epsilon: %f\n",epsilon);
|
for(index=0;index<memparam.depth ;index++){
|
for(index=memparam.addressoffset;index<memparam.depth+memparam.addressoffset;index++){
|
factor=xf[memparam.R](memparam.offset*(1+index*epsilon));
|
factor=xf[memparam.R](memparam.offset*(1+(index-memparam.addressoffset)*epsilon));
|
sign=memparam.R==2?((factor&(1<<memparam.width))?'-':'+'):'+';
|
sign=memparam.R==2?((factor&(1<<memparam.width))?'-':'+'):'+';
|
ffactor=(factor&(1<<memparam.width))?(factor^(int)(pow(2,memparam.width+1)-1))+1:factor;
|
ffactor=(factor&(1<<memparam.width))?(factor^(int)(pow(2,memparam.width+1)-1))+1:factor;
|
ffactor/=pow(2,memparam.dec);
|
ffactor/=pow(2,memparam.dec);
|
memset(buff,0,1024);
|
memset(buff,0,1024);
|
sprintf(buff,"%c0%dx : %c0%dx; -- FIXED => %x . %x (%d . %d) FLOAT %c%f\n",
|
sprintf(buff,"%c0%dx : %c0%dx; -- FIXED => %x . %x (%d . %d) FLOAT %c%f\n",
|