
#include <math.h>

#define fdat stdout

static rsa_dat(n,cin,cout,over,overn,not,csa,sub,addsub,
                deci,stretch,stretch2,name,msb0)
int n,cin,cout,over,overn,not,csa,sub,addsub,
    deci,stretch,stretch2,msb0;
char  *name ;
{
 int  d=msb0?0:n-1;
 int  f=msb0?n-1:0;
 int  l=n-1;
 int  height;
 int  width;
/* FILE *fdat; */
 int  j;
 char *updown;


   if ( stretch || stretch2 || deci )
      printf("Warning : options deci, stretch, stretch2 are not taken into account for vhdl view\n");

   mbkenv() ;

/*   fdat = (FILE *)mbkfopen( name, "pat", "w" ) ; */

   updown=msb0?NAME("to"):NAME("downto");

   height=n*HEIGHT("gae0_c")+addsub*HEIGHT("gaxr2b_c");
   width=csa*WIDTH("gacsa_c")+sub*WIDTH("gasub_c")+addsub*WIDTH("gaxr2_c");
   width+=WIDTH("gae0_c")+WIDTH("gas0_c")+cout*WIDTH("gaco_c");
   width+=WIDTH("gapg2_c")*rsa_puiss(n)+WIDTH("gapg2_c")*(rsa_restp(n,rsa_puiss(n))==0?0:1);

               fprintf( fdat,"\nName : %s\n\n",name);
               fprintf( fdat,"Function : ");
   if(csa)     fprintf( fdat,"Three input adder\n");
   else
   if(sub)     fprintf( fdat,"Two input subtractor\n");
   else
   if(addsub)  fprintf( fdat,"Two input adder/subtractor\n");
   else        fprintf( fdat,"Two input adder\n");
               fprintf( fdat,"           %d bit wide\n",n);
   if(cin)     fprintf( fdat,"           with a carry input\n");
   if(cout)    fprintf( fdat,"           with intermediate carries output\n");
   if(overn)   fprintf( fdat,"           with over connector to generate overflow\n");
   if(not)     fprintf( fdat,"           The sum output is complemented\n");
   if(msb0)    fprintf( fdat,"           The most significant bit is indexed with 0\n");
   else        fprintf( fdat,"           The least significant bit is indexed with 0\n");
               fprintf( fdat,"\nTechnology : 1.0 micron\n\n");
               fprintf( fdat,"Dimensions :\n");
               fprintf( fdat,"              Height  Width      Area\n");
               fprintf( fdat,"Lambdas        %5d  %5d%10d\n",height,width,width*height);
               fprintf( fdat,"Microns        %5.0f  %5.0f%10.0f\n\n",(double)(height*.875),(double)(width*.875),(double)(width*height*0.875*0.875));
               fprintf( fdat,"Number of transistors: %d\n\n",-162+54*n);
               fprintf( fdat,"Input capacitances :\n");
               fprintf( fdat,"    - a    = 0.071 pF.\n");
               fprintf( fdat,"    - b    = 0.068 pF.\n");
   if(csa)     fprintf( fdat,"    - c    = 0.068 pF.\n");
   if(addsub)  fprintf( fdat,"    - sub  = 0.141 pF.\n");
   if(cin)     fprintf( fdat,"    - cin  = %.3f pF.\n",(double)(n*60*.00023));
               fprintf( fdat,"\nTiming (worst case) for a two input adder with cin :\n");
               fprintf( fdat,"    - cout = %.2f + 2.91E-09 * CLOAD ns\n",
                      (double)(1E+9*(-7.9557E-10+2.45471E-09*log((double)n))));
               fprintf( fdat,"    - s    = %.2f + 1.84E-09 * CLOAD ns\n",
                      (double)(1E+9*(5.38412E-10+2.34606E-09*log((double)n))));
   fclose(fdat);
}

#undef fdat
