示例#1
0
/*--------------------------------------------------------------------------*/ 
SCICOS_BLOCKS_IMPEXP void shift_32_LC(scicos_block *block,int flag)
{
	int mu = GetInPortRows(block,1);
	int nu = GetInPortCols(block,1);
	long *u = Getint32InPortPtrs(block,1);
	long *y = Getint32OutPortPtrs(block,1);
	int *ipar = GetIparPtrs(block);
	unsigned long k = (unsigned long)pow(2,32-1);

	int i = 0;
	for (i=0;i<mu*nu;i++)
	{ 
		int j = 0;
		long v=u[i];
		for(j=0;j<ipar[0];j++)
		{
			y[i]=v&k;
			if (y[i]==0)  y[i]=v<<1;
			else 
			{
				y[i]=v<<1;
				y[i]=(y[i])|(1);
			}
			v=y[i];
		}
	}
}
示例#2
0
/*--------------------------------------------------------------------------*/
SCICOS_BLOCKS_IMPEXP void delay4_i32(scicos_block *block, int flag)
{
    /* Copyright INRIA

       Scicos block simulator
       Ouputs nx*dt delayed input */

    SCSINT32_COP *y = NULL, *u = NULL, *oz = NULL;
    int nz = 0, mz = 0;


    u = Getint32InPortPtrs(block, 1);
    y = Getint32OutPortPtrs(block, 1);
    oz = Getint32OzPtrs(block, 1);
    nz = GetOzSize(block, 1, 2);
    mz = GetOzSize(block, 1, 1);

    if ((flag == 1) || (flag == 6) || (flag == 4))
    {
        y[0] = oz[0];
    }
    else if (flag == 2)
    {
        /*  shift buffer */
        int i = 0;
        for (i = 0; i <= (mz * nz) - 2; i++)
        {
            oz[i] = oz[i + 1];
        }
        /* add new point to the buffer */
        oz[(mz * nz) - 1] = u[0];
    }
}
示例#3
0
/*--------------------------------------------------------------------------*/
SCICOS_BLOCKS_IMPEXP void shift_32_RC(scicos_block *block, int flag)
{
    int i = 0, j = 0;

    int mu = GetInPortRows(block, 1);
    int nu = GetInPortCols(block, 1);
    SCSINT32_COP *u = Getint32InPortPtrs(block, 1);
    SCSINT32_COP *y = Getint32OutPortPtrs(block, 1);
    int *ipar = GetIparPtrs(block);
    unsigned long k = (unsigned long)pow(2, 32 - 1);

    for (i = 0; i < mu * nu; i++)
    {
         SCSINT32_COP v = u[i];
        for (j = 0; j < -ipar[0]; j++)
        {
            y[i] = v & 1;
            if (y[i] == 0)
            {
                y[i] = v >> 1;
                y[i] = y[i] & (k - 1);
            }
            else
            {
                y[i] = v >> 1;
                y[i] = (y[i]) | (k);
            }
            v = y[i];
        }
示例#4
0
/*--------------------------------------------------------------------------*/ 
SCICOS_BLOCKS_IMPEXP void shift_32_LA(scicos_block *block,int flag)
{
	int i = 0;
	int mu = GetInPortRows(block,1);
	int nu = GetInPortCols(block,1);
	long *u = Getint32InPortPtrs(block,1);
	long *y = Getint32OutPortPtrs(block,1);
	int *ipar = GetIparPtrs(block);
	for (i=0;i<mu*nu;i++) y[i]=u[i]<<ipar[0];
}
示例#5
0
/*--------------------------------------------------------------------------*/ 
SCICOS_BLOCKS_IMPEXP void summation_i32s(scicos_block *block,int flag)
{
	if((flag==1)|(flag==6)) 
	{
		int j = 0,k = 0;
		int nu = 0,mu = 0,nin = 0;
		long *y = NULL;
		int *ipar = NULL;
		double v = 0.,l = 0.;
		double *rpar = NULL;
		long *u = NULL;

		y = Getint32OutPortPtrs(block,1);
		nu = GetInPortRows(block,1);
		mu = GetInPortCols(block,1);
		ipar = GetIparPtrs(block);
		rpar = GetRparPtrs(block);
		nin = GetNin(block);
		l = pow(2,32)/2;

		if (nin==1)
		{
			v=0;
			u=Getint32InPortPtrs(block,1);
			for (j=0;j<nu*mu;j++) 
			{
				v=v+(double)u[j];
			}
			if (v>=l)  v=l-1;
			else if (v<-l) v=-l;
			y[0]=(long)v; 
		}
		else 
		{
			for (j=0;j<nu*mu;j++) 
			{
				v=0;
				for (k=0;k<nin;k++) 
				{
					u=Getint32InPortPtrs(block,k+1);
					if(ipar[k]>0)
					{
						v=v+(double)u[j];
					}
					else
					{
						v=v-(double)u[j];}
				}
				if (v>=l)  v=l-1;
				else if (v<-l) v=-l;
				y[j]=(long)v;
			}
		}
	}
}
示例#6
0
/*--------------------------------------------------------------------------*/
SCICOS_BLOCKS_IMPEXP void bit_set_32(scicos_block *block, int flag)
{
    int n, m, i;
    SCSINT32_COP *opar;
    SCSINT32_COP *u, *y;
    opar = Getint32OparPtrs(block, 1);
    u = Getint32InPortPtrs(block, 1);
    y = Getint32OutPortPtrs(block, 1);
    n = GetInPortCols(block, 1);
    m = GetInPortRows(block, 1);
    for (i = 0; i < m * n; i++)
    {
        *(y + i) = ((*(u + i)) | (*opar));
    }
}
示例#7
0
/*--------------------------------------------------------------------------*/
SCICOS_BLOCKS_IMPEXP void bit_clear_32(scicos_block *block, int flag)
{
    int n = 0, m = 0, i = 0;
    SCSINT32_COP *opar = NULL;
    SCSINT32_COP *u = NULL, *y = NULL;
    opar = Getint32OparPtrs(block, 1);
    u = Getint32InPortPtrs(block, 1);
    y = Getint32OutPortPtrs(block, 1);
    m = GetInPortRows(block, 1);
    n = GetInPortCols(block, 1);
    for (i = 0; i < m * n; i++)
    {
        *(y + i) = ((*(u + i)) & (*opar));
    }
}
示例#8
0
/*--------------------------------------------------------------------------*/
SCICOS_BLOCKS_IMPEXP void extract_bit_32_LH(scicos_block *block, int flag)
{
    int i = 0, maxim = 0;
    long *y = NULL, *u = NULL, ref = 0, n = 0;
    y = Getint32OutPortPtrs(block, 1);
    u = Getint32InPortPtrs(block, 1);
    maxim = 32;
    ref = 0;
    for (i = 0; i < maxim / 2; i++)
    {
        n = (long)pow(2, (double)i);
        ref = ref + n;
    }
    *y = (*u) & (ref);
}
示例#9
0
/*--------------------------------------------------------------------------*/
SCICOS_BLOCKS_IMPEXP void extract_bit_32_UH0(scicos_block *block, int flag)
{
    int i = 0, maxim = 0;
    SCSINT32_COP *y = NULL, *u = NULL, ref = 0, n = 0;
    y = Getint32OutPortPtrs(block, 1);
    u = Getint32InPortPtrs(block, 1);
    maxim = 32;
    ref = 0;
    for (i = 0; i < maxim / 2; i++)
    {
        n = (SCSINT32_COP)pow(2, maxim / 2 + i);
        ref = ref + n;
    }
    *y = (*u) & (ref);
}
示例#10
0
/*--------------------------------------------------------------------------*/ 
SCICOS_BLOCKS_IMPEXP void extract_bit_32_MSB0(scicos_block *block,int flag)
{
   int i = 0,maxim = 0;
   long *y = NULL,*u = NULL,ref = 0,n = 0;
   int *ipar = NULL;
   y=Getint32OutPortPtrs(block,1);
   u=Getint32InPortPtrs(block,1);
   ipar=GetIparPtrs(block);
   maxim=32;
   ref=0;
   for(i=0;i<*ipar;i++)
       {n=(long)pow(2,maxim-1-i);
        ref=ref+n;}
   *y=(*u)&(ref);
}
示例#11
0
/*--------------------------------------------------------------------------*/
SCICOS_BLOCKS_IMPEXP void extract_bit_32_LSB(scicos_block *block, int flag)
{
    int i = 0, maxim = 0;
    long *y, *u, ref, n;
    int *ipar;
    y = Getint32OutPortPtrs(block, 1);
    u = Getint32InPortPtrs(block, 1);
    ipar = GetIparPtrs(block);
    maxim = 32;
    ref = 0;
    for (i = 0; i < *ipar; i++)
    {
        n = (long)pow(2, (double)i);
        ref = ref + n;
    }
    *y = (*u) & (ref);
}
示例#12
0
/*--------------------------------------------------------------------------*/ 
SCICOS_BLOCKS_IMPEXP void gainblk_i32s(scicos_block *block,int flag)
{
 if ((flag==1)|(flag==6)){
  int i = 0,j = 0,l = 0,ji = 0,jl = 0,il = 0;
  long *u = NULL,*y = NULL;
  int mu = 0,ny = 0,my = 0,mo = 0,no = 0;
  long *opar = NULL;
  double k = 0.,D = 0.,C = 0.;

  mo=GetOparSize(block,1,1);
  no=GetOparSize(block,1,2);
  mu=GetInPortRows(block,1);
  my=GetOutPortRows(block,1);
  ny=GetOutPortCols(block,1);
  u=Getint32InPortPtrs(block,1);
  y=Getint32OutPortPtrs(block,1);
  opar=Getint32OparPtrs(block,1);

  k=pow(2,32)/2;
  if (mo*no==1){
    for (i=0;i<ny*mu;++i){
     D=(double)(opar[0])*(double)(u[i]);
     if (D>=k)  D=k-1;
     else if (D<-k) D=-k;
     y[i]=(long)D;
    }
  }else{
     for (l=0;l<ny;l++)
	 {for (j=0;j<my;j++)
	      {D=0;
	       jl=j+l*my;
	       for (i=0;i<mu;i++)
		   {ji=j+i*my;
		    
		    il=i+l*mu;
		    C=(double)(opar[ji])*(double)(u[il]);
		    D=D + C;}
		    if (D>=k)  D=k-1;
		    else if (D<-k) D=-k;
		    y[jl]=(long)D;
		  }
	     }
  }
 }
}
示例#13
0
/*--------------------------------------------------------------------------*/
SCICOS_BLOCKS_IMPEXP void matmul_i32e(scicos_block *block, int flag)
{
    if ((flag == 1) | (flag == 6))
    {
        int mu1 = GetInPortRows(block, 1);
        int nu1 = GetInPortCols(block, 1);
        int nu2 = GetInPortCols(block, 2);
        SCSINT32_COP *u1 = Getint32InPortPtrs(block, 1);
        SCSINT32_COP *u2 = Getint32InPortPtrs(block, 2);
        SCSINT32_COP *y = Getint32OutPortPtrs(block, 1);

        double k = pow(2, 32);
        int l = 0;
        for (l = 0; l < nu2; l++)
        {
            int j = 0;
            for (j = 0; j < mu1; j++)
            {
                double D = 0.;
                int i = 0;
                int jl = j + l * mu1;

                for (i = 0; i < nu1; i++)
                {
                    int ji = j + i * mu1;
                    int il = i + l * nu1;
                    double C = (double)(u1[ji]) * (double)(u2[il]);
                    D = D + C;
                }

                if ((D > ((k / 2) - 1)) | (D < -((k / 2))))
                {
                    sciprint(_("overflow error"));
                    set_block_error(-4);
                    return;
                }
                else
                {
                    y[jl] = (SCSINT32_COP)(D);
                }
            }
        }
    }
}
示例#14
0
/*--------------------------------------------------------------------------*/ 
SCICOS_BLOCKS_IMPEXP void convert(scicos_block *block,int flag)
{
 int m = 0,n = 0,i = 0;
 int *ipar = NULL;
 double v = 0.,w = 0.,k = 0.;
 
 m=GetInPortRows(block,1);
 n=GetInPortCols(block,1);
 ipar=GetIparPtrs(block);
 
 if ((flag==1)|(flag==6))
    {
     switch (*ipar){
	    case 1:{ 
		   void *u = NULL,*y = NULL;
		   int so;
		   so=GetSizeOfOut(block,1);
     	   u=GetInPortPtrs(block,1);
     	   y=GetOutPortPtrs(block,1);
     	   memcpy(y,u,m*n*so);
     	  break;
			   }
	    case 2:{
		   double *u = NULL;
		   long *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getint32OutPortPtrs(block,1);
		   k=pow(2,32);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         if (fabs(w)>k/2-1)
			     {if (w>=0) w=(-k/2+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     else w=-(-(k/2)+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     }
		         y[i]=(long)w;}
		   break;}
	    case 3:{
		   double *u = NULL;
		   short *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         if (fabs(w)>k/2-1)
			     {if (w>=0) w=(-k/2+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     else w=-(-(k/2)+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     }
		         y[i]=(short)w;}
		   break;}
	    case 4:{
		   double *u = NULL;
		   char *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         if (fabs(w)>k/2-1)
			     {if (w>=0) w=(-k/2+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     else w=-(-(k/2)+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     }
		         y[i]=(char)w;}
		   break;}
	    case 5:{
		   double *u = NULL;
		   unsigned long *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getuint32OutPortPtrs(block,1);
		   k=pow(2,32);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         y[i]=(unsigned long)w;}
		   break;}
	    case 6:{
		   double *u = NULL;
		   unsigned short *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         y[i]=(unsigned short)w;}
		   break;}
	    case 7:{
		   double *u = NULL;
		   unsigned char *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         y[i]=(unsigned char)w;}
		   break;}
	    case 8:{
		   long *u = NULL;
		   double *y = NULL;
		   u=Getint32InPortPtrs(block,1);
		   y=GetRealOutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) y[i]=(double) u[i];
		   break;}
	    case 9:{
		   long *u = NULL;
		   short *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         if (fabs(w)>k/2-1)
			     {if (w>=0) w=(-k/2+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     else w=-(-(k/2)+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     }
		         y[i]=(short)w;}
		   break;}
	    case 10:{
		   long *u = NULL;
		   char *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         if (fabs(w)>k/2-1)
			     {if (w>=0) w=(-k/2+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     else w=-(-(k/2)+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     }
		         y[i]=(char)w;}
		   break;}
	    case 11:{
		   long *u = NULL;
		   unsigned short *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         y[i]=(unsigned short)w;}
		   break;}
	    case 12:{
		   long *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         y[i]=(unsigned char)w;}
		   break;}
	    case 13:{
		   short *u = NULL;
		   double *y = NULL;
		   u=Getint16InPortPtrs(block,1);
		   y=GetRealOutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) y[i]=(double) u[i];
		   break;}
	    case 14:{
		   short *u = NULL;
		   long *y = NULL;
	  	   u=Getint16InPortPtrs(block,1);
	           y=Getint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {y[i]=(long)u[i];}
		   break;}
	    case 15:{
		   short *u = NULL;
		   char *y = NULL;
	  	   u=Getint16InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         if (fabs(w)>k/2-1)
			     {if (w>=0) w=(-k/2+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     else w=-(-(k/2)+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     }
		         y[i]=(char)w;}
		   break;}
	    case 16:{
		   short *u = NULL;
		   unsigned long *y = NULL;
	  	   u=Getint16InPortPtrs(block,1);
	           y=Getuint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {y[i]=(unsigned long)u[i];}
		   break;}
	    case 17:{
		   short *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getint16InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         y[i]=(unsigned char)w;}
		   break;}
	    case 18:{
		   char *u = NULL;
		   double *y = NULL;
		   u=Getint8InPortPtrs(block,1);
		   y=GetRealOutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) y[i]=(double) u[i];
		   break;}
	    case 19:{
		   char *u = NULL;
		   long *y = NULL;
	  	   u=Getint8InPortPtrs(block,1);
	           y=Getint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {y[i]=(long)u[i];}
		   break;}
	    case 20:{
		   char *u = NULL;
		   short *y = NULL;
	  	   u=Getint8InPortPtrs(block,1);
	           y=Getint16OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {y[i]=(short)u[i];}
		   break;}
	    case 21:{
		   char *u = NULL;
		   unsigned long *y = NULL;
	  	   u=Getint8InPortPtrs(block,1);
	           y=Getuint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {y[i]=(unsigned long)u[i];}
		   break;}
	    case 22:{
		   char *u = NULL;
		   unsigned short *y = NULL;
	  	   u=Getint8InPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {y[i]=(unsigned short)u[i];}
		   break;}
	    case 23:{
		   unsigned long *u = NULL;
		   double *y = NULL;
		   u=Getuint32InPortPtrs(block,1);
		   y=GetRealOutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) y[i]=(double) u[i];
		   break;}
	    case 24:{
		   unsigned long *u = NULL;
		   short *y = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	           y=Getint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         if ((w)>k/2-1)
			     { w=(-k/2+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     }
		         y[i]=(short)w;}
		   break;}
	    case 25:{
		   unsigned long *u = NULL;
		   char *y = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         if ((w)>k/2-1)
			     {w=(-k/2+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     }
		         y[i]=(char)w;}
		   break;}
	    case 26:{
		   unsigned long *u = NULL;
		   unsigned short *y = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         y[i]=(unsigned short)w;}
		   break;}
	    case 27:{
		   unsigned long *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         y[i]=(unsigned char)w;}
		   break;}
	    case 28:{
		   unsigned short *u = NULL;
		   double *y = NULL;
		   u=Getuint16InPortPtrs(block,1);
		   y=GetRealOutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) y[i]=(double) u[i];
		   break;}
	    case 29:{
		   unsigned short *u = NULL;
		   long *y = NULL;
	  	   u=Getuint16InPortPtrs(block,1);
	           y=Getint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {y[i]=(long)u[i];}
		   break;}
	    case 30:{
		   unsigned short *u = NULL;
		   char *y = NULL;
	  	   u=Getuint16InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         if (w>k/2-1)
			     {w=(-k/2+fabs(w-(double)((int)(w/(k/2)))*(k/2)));
			     }
		         y[i]=(char)w;}
		   break;}
	    case 31:{
		   unsigned short *u = NULL;
		   unsigned long *y = NULL;
	  	   u=Getuint16InPortPtrs(block,1);
	           y=Getuint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {y[i]=(unsigned long)u[i];}
		   break;}
	    case 32:{
		   unsigned short *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getuint16InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {v=(double)u[i];
		         w=v-(double)((int)(v/k))*k;
		         y[i]=(unsigned char)w;}
		   break;}
	    case 33:{
		   unsigned char *u = NULL;
		   double *y = NULL;
		   u=Getuint8InPortPtrs(block,1);
		   y=GetRealOutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) y[i]=(double) u[i];
		   break;}
	    case 34:{
		   unsigned char *u = NULL;
		   long *y = NULL;
	  	   u=Getuint8InPortPtrs(block,1);
	           y=Getint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {y[i]=(long)u[i];}
		   break;}
	    case 35:{
		   unsigned char *u = NULL;
		   short *y = NULL;
	  	   u=Getuint8InPortPtrs(block,1);
	           y=Getint16OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {y[i]=(short)u[i];}
		   break;}
	    case 36:{
		   unsigned char *u = NULL;
		   unsigned long *y = NULL;
	  	   u=Getuint8InPortPtrs(block,1);
	           y=Getuint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {y[i]=(unsigned long)u[i];}
		   break;}
	    case 37:{
		   unsigned char *u = NULL;
		   unsigned short *y = NULL;
	  	   u=Getuint8InPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {y[i]=(unsigned short)u[i];}
		   break;}
	    case 38:{
		   double *u = NULL;
		   long *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getint32OutPortPtrs(block,1);
		   k=pow(2,32);
		   for (i=0;i<m*n;i++)
		       {if (u[i]>k/2-1)
		           {y[i]=(long)(k/2-1);}
		        else if (u[i]<-(k/2))
			   {y[i]=-(long)(k/2);}
		        else {y[i]=(long)(u[i]);}
		       }
		   break;}
	    case 39:{
		   double *u = NULL;
		   short *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>k/2-1)
		           {y[i]=(short)(k/2-1);}
		        else if (u[i]<-(k/2))
			   {y[i]=-(short)(k/2);}
		        else {y[i]=(short)(u[i]);}
		       }
		   break;}
	    case 40:{
		   double *u = NULL;
		   char *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>k/2-1)
		           {y[i]=(char)(k/2-1);}
		        else if (u[i]<-(k/2))
			   {y[i]=-(char)(k/2);}
		        else {y[i]=(char)(u[i]);}
		       }
		   break;}
	    case 41:{
		   double *u = NULL;
		   unsigned long *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getuint32OutPortPtrs(block,1);
		   k=pow(2,32);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>=k)
		       	     {y[i]=(unsigned long)(k-1);}
		   	else if (u[i]<0)
			     {y[i]=0;}
		   	else {y[i]=(unsigned long)(u[i]);}
		   	}
		   break;}
	    case 42:{
		   double *u = NULL;
		   unsigned short *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>=k)
		       	     {y[i]=(unsigned short)(k-1);}
		   	else if (u[i]<0)
			     {y[i]=0;}
		   	else {y[i]=(unsigned short)(u[i]);}
		   	}
		   break;}
	    case 43:{
		   double *u = NULL;
		   unsigned char *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>=k)
		       	     {y[i]=(unsigned char)(k-1);}
		   	else if (u[i]<0)
			     {y[i]=0;}
		   	else {y[i]=(unsigned char)(u[i]);}
		   	}
		   break;}
	    case 44:{
		   long *u = NULL;
		   short *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(long)(k/2-1))
		           {y[i]=(short)(k/2-1);}
		        else if (u[i]<-(long)(k/2))
			   {y[i]=-(short)(k/2);}
		        else {y[i]=(short)(u[i]);}
		       }
		   break;}
	    case 45:{
		   long *u = NULL;
		   char *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(long)(k/2-1))
		           {y[i]=(char)(k/2-1);}
		        else if (u[i]<-(long)(k/2))
			   {y[i]=-(char)(k/2);}
		        else {y[i]=(char)(u[i]);}
		       }
		   break;}
	    case 46:{
		   long *u = NULL;
		   unsigned long *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getuint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		   	{if (u[i]<0)
			     {y[i]=0;}
		   	else {y[i]=(unsigned long)(u[i]);}
		   	}
		   break;}
	    case 47:{
		   long *u = NULL;
		   unsigned short *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>=(long)(k))
		       	     {y[i]=(unsigned short)(k-1);}
		   	else if (u[i]<0)
			     {y[i]=0;}
		   	else {y[i]=(unsigned short)(u[i]);}
		   	}
		   break;}
	    case 48:{
		   long *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>=(long)k)
		       	     {y[i]=(unsigned char)(k-1);}
		   	else if (u[i]<0)
			     {y[i]=0;}
		   	else {y[i]=(unsigned char)(u[i]);}
		   	}
		   break;}
	    case 49:{
		   short *u = NULL;
		   char *y = NULL;
	  	   u=Getint16InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(short)(k/2-1))
		           {y[i]=(char)(k/2-1);}
		        else if (u[i]<-(short)(k/2))
			   {y[i]=-(char)(k/2);}
		        else {y[i]=(char)(u[i]);}
		       }
		   break;}
	    case 50:{
		   short *u = NULL;
		   unsigned long *y = NULL;
	  	   u=Getint16InPortPtrs(block,1);
	           y=Getuint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]<0)  y[i]=0;
			 else y[i]=(unsigned long)u[i];}
		   break;}
	    case 51:{
		   short *u = NULL;
		   unsigned short *y = NULL;
	  	   u=Getint16InPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		   	{if (u[i]<0)
			     {y[i]=0;}
		   	else {y[i]=(unsigned short)(u[i]);}
		   	}
		   break;}
	    case 52:{
		   short *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getint16InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>=(short)k)
		       	     {y[i]=(unsigned char)(k-1);}
		   	else if (u[i]<0)
			     {y[i]=0;}
		   	else {y[i]=(unsigned char)(u[i]);}
		   	}
		   break;}
	    case 53:{
		   char *u = NULL;
		   unsigned long *y = NULL;
	  	   u=Getint8InPortPtrs(block,1);
	           y=Getuint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
			{if (u[i]<0)  y[i]=0;
			 else y[i]=(unsigned long)u[i];}
		   break;}
	    case 54:{
		   char *u = NULL;
		   unsigned short *y = NULL;
	  	   u=Getint8InPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]<0)
			     {y[i]=0;}
		   	else {y[i]=(unsigned short)(u[i]);}
		   	}
		   break;}
	    case 55:{
		   char *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getint8InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		   	{if (u[i]<0)
			     {y[i]=0;}
		   	else {y[i]=(unsigned char)(u[i]);}
		   	}
		   break;}
	    case 56:{
		   long *y = NULL;
		   unsigned long *u = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	           y=Getint32OutPortPtrs(block,1);
		   k=pow(2,32);
		   for (i=0;i<m*n;i++) 
		   	{if (u[i]>(unsigned long)(k/2-1))
			     {y[i]=(long)(k/2-1);}
		   	else {y[i]=(long)(u[i]);}
		   	}
		   break;}
	    case 57:{
		   unsigned long *u = NULL;
		   short *y = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	           y=Getint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(unsigned long)(k/2-1))
			     {y[i]=(short)(k/2-1);}
		   	else {y[i]=(short)(u[i]);}
		   	}
		   break;}
	    case 58:{
		   unsigned long *u = NULL;
		   char *y = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(unsigned long)(k/2-1))
			     {y[i]=(char)(k/2-1);}
		   	else {y[i]=(char)(u[i]);}
		   	}
		   break;}
	    case 59:{
		   unsigned long *u = NULL;
		   unsigned short *y = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(unsigned long)(k/2-1))
			     {y[i]=(unsigned short)(k/2-1);}
		   	else {y[i]=(unsigned short)(u[i]);}
		   	}
		   break;}
	    case 60:{
		   unsigned long *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(unsigned long)(k/2-1))
			     {y[i]=(unsigned char)(k/2-1);}
		   	else {y[i]=(unsigned char)(u[i]);}
		   	}
		   break;}
	    case 61:{
		   unsigned short *u = NULL;
		   short *y = NULL;
	  	   u=Getuint16InPortPtrs(block,1);
	           y=Getint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(unsigned short)(k/2-1))
			     {y[i]=(short)(k/2-1);}
		   	else {y[i]=(short)(u[i]);}
		   	}
		   break;}
	    case 62:{
		   unsigned short *u = NULL;
		   char *y = NULL;
	  	   u=Getuint16InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(unsigned short)(k/2-1))
			     {y[i]=(char)(k/2-1);}
		   	else {y[i]=(char)(u[i]);}
		   	}
		   break;}
	    case 63:{
		   unsigned short *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getuint16InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(unsigned short)(k/2-1))
			     {y[i]=(unsigned char)k/2-1;}
		   	else {y[i]=(unsigned char)(u[i]);}
		   	}
		   break;}
	    case 64:{
		   unsigned char *u = NULL;
		   char *y = NULL;
	  	   u=Getuint8InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(unsigned char)(k/2-1))
			     {y[i]=(char)(k/2-1);}
		   	else {y[i]=(char)(u[i]);}
		   	}
		   break;}
	    case 65:{
		   double *u = NULL;
		   long *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getint32OutPortPtrs(block,1);
		   k=pow(2,32);
		   for (i=0;i<m*n;i++)
		   {if ((u[i]>k/2-1) | (u[i]<-(k/2)))
		           {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		        else {y[i]=(long)(u[i]);}
		       }
		   break;}
	    case 66:{
		   double *u = NULL;
		   short *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if ((u[i]>k/2-1) | (u[i]<-(k/2)))
		           {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		        else {y[i]=(short)(u[i]);}
		       }
		   break;}
	    case 67:{
		   double *u = NULL;
		   char *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if ((u[i]>k/2-1) | (u[i]<-(k/2)))
		           {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		        else {y[i]=(char)(u[i]);}
		       }
		   break;}
	    case 68:{
		   double *u = NULL;
		   unsigned long *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getuint32OutPortPtrs(block,1);
		   k=pow(2,32);
		   for (i=0;i<m*n;i++) 
		        {if ((u[i]>=k) | (u[i]<0))
		           {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(unsigned long)(u[i]);}
		   	}
		   break;}
	    case 69:{
		   double *u = NULL;
		   unsigned short *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if ((u[i]>=k) | (u[i]<0))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(unsigned short)(u[i]);}
		   	}
		   break;}
	    case 70:{
		   double *u = NULL;
		   unsigned char *y = NULL;
	  	   u=GetRealInPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if ((u[i]>=k) | (u[i]<0))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(unsigned char)(u[i]);}
		   	}
		   break;}
	    case 71:{
		   long *u = NULL;
		   short *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if ((u[i]>k/2-1) | (u[i]<-(k/2)))
		            {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		        else {y[i]=(short)(u[i]);}
		       }
		   break;}
	    case 72:{
		   long *u = NULL;
		   char *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if ((u[i]>k/2-1) | (u[i]<-(k/2)))
		            {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		        else {y[i]=(char)(u[i]);}
		       }
		   break;}
	    case 73:{
		   long *u = NULL;
		   unsigned long *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getuint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		   	{if (u[i]<0)
			    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(unsigned long)(u[i]);}
		   	}
		   break;}
	    case 74:{
		   long *u = NULL;
		   unsigned short *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if ((u[i]>=k) | (u[i]<0))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(unsigned short)(u[i]);}
		   	}
		   break;}
	    case 75:{
		   long *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getint32InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if ((u[i]>=k) | (u[i]<0))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(unsigned char)(u[i]);}
		   	}
		   break;}
	    case 76:{
		   short *u = NULL;
		   char *y = NULL;
	  	   u=Getint16InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if ((u[i]>k/2-1) | (u[i]<-(k/2)))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		        else {y[i]=(char)(u[i]);}
		       }
		   break;}
	    case 77:{
		   short *u = NULL;
		   unsigned long *y = NULL;
	  	   u=Getint16InPortPtrs(block,1);
	           y=Getuint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]<0)  
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
			 else y[i]=(unsigned long)u[i];}
		   break;}
	    case 78:{
		   short *u = NULL;
		   unsigned short *y = NULL;
	  	   u=Getint16InPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		   	{if (u[i]<0)
			    {if (flag==1) 
                                {sciprint(_("overflow error"));
			         set_block_error(-4);
			         return;}}
		   	else {y[i]=(unsigned short)(u[i]);}
		   	}
		   break;}
	    case 79:{
		   short *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getint16InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (((u[i]>=k) | (u[i]<0))& (flag==1))
		       	    {if (flag==1) 
                                 {sciprint(_("overflow error"));
			          set_block_error(-4);
			          return;}}
		   	else {y[i]=(unsigned char)(u[i]);}
		   	}
		   break;}
	    case 80:{
		   char *u = NULL;
		   unsigned long *y = NULL;
	  	   u=Getint8InPortPtrs(block,1);
	           y=Getuint32OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
			{if (u[i]<0)
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
			 else y[i]=(unsigned long)u[i];}
		   break;}
	    case 81:{
		   char *u = NULL;
		   unsigned short *y = NULL;
	  	   u=Getint8InPortPtrs(block,1);
	           y=Getuint16OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]<0)
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(unsigned short)(u[i]);}
		   	}
		   break;}
	    case 82:{
		   char *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getint8InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   for (i=0;i<m*n;i++) 
		   	{if (u[i]<0)
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(unsigned char)(u[i]);}
		   	}
		   break;}
	    case 83:{
		   long *y = NULL;
		   unsigned long *u = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	           y=Getint32OutPortPtrs(block,1);
		   k=pow(2,32);
		   for (i=0;i<m*n;i++) 
		   	{if (u[i]>(k/2-1))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(long)(u[i]);}
		   	}
		   break;}
	    case 84:{
		   unsigned long *u = NULL;
		   short *y = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	           y=Getint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(k/2-1))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(short)(u[i]);}
		   	}
		   break;}
	    case 85:{
		   unsigned long *u = NULL;
		   char *y = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(k/2-1))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(char)(u[i]);}
		   	}
		   break;}
	    case 86:{
		   unsigned long *u = NULL;
		   unsigned short *y = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	       y=Getuint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(k/2-1))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(unsigned short)(u[i]);}
		   	}
		   break;}
	    case 87:{
		   unsigned long *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getuint32InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(k/2-1))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(unsigned char)(u[i]);}
		   	}
		   break;}
	    case 88:{
		   unsigned short *u = NULL;
		   short *y = NULL;
	  	   u=Getuint16InPortPtrs(block,1);
	           y=Getint16OutPortPtrs(block,1);
		   k=pow(2,16);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(k/2-1))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(short)(u[i]);}
		   	}
		   break;}
	    case 89:{
		   unsigned short *u = NULL;
		   char *y = NULL;
	  	   u=Getuint16InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(k/2-1))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(char)(u[i]);}
		   	}
		   break;}
	    case 90:{
		   unsigned short *u = NULL;
		   unsigned char *y = NULL;
	  	   u=Getuint16InPortPtrs(block,1);
	           y=Getuint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(k/2-1))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(unsigned char)(u[i]);}
		   	}
		   break;}
	    case 91:{
		   unsigned char *u = NULL;
		   char *y = NULL;
	  	   u=Getuint8InPortPtrs(block,1);
	           y=Getint8OutPortPtrs(block,1);
		   k=pow(2,8);
		   for (i=0;i<m*n;i++) 
		        {if (u[i]>(k/2-1))
		       	    {if (flag==1)
                               {sciprint(_("overflow error"));
			        set_block_error(-4);
			        return;}}
		   	else {y[i]=(char)(u[i]);}
		   	}
		   break;}
	   }
	}
 }
示例#15
0
/*--------------------------------------------------------------------------*/
SCICOS_BLOCKS_IMPEXP void matbyscal_e(scicos_block *block, int flag)
{
    if (flag == 1)
    {
        int i = 0;
        double v = 0.;
        int ut = GetInType(block, 1);
        int mu = GetOutPortRows(block, 1);
        int nu = GetOutPortCols(block, 1);
        double *rpar = GetRparPtrs(block);

        switch (ut)
        {
            case SCSINT32_N :
            {

                long *u1 = Getint32InPortPtrs(block, 1);
                long *u2 = Getint32InPortPtrs(block, 2);
                long *y1 = Getint32OutPortPtrs(block, 1);
                for (i = 0; i < mu * nu; i++)
                {
                    v = (double)u1[i] * (double)u2[0];
                    if ((v < rpar[0]) | (v > rpar[1]))
                    {
                        sciprint(_("overflow error"));
                        set_block_error(-4);
                        return;
                    }
                    else
                    {
                        y1[i] = (long)v;
                    }
                }
                break;
            }

            case SCSINT16_N :
            {

                short *u1 = Getint16InPortPtrs(block, 1);
                short *u2 = Getint16InPortPtrs(block, 2);
                short *y1 = Getint16OutPortPtrs(block, 1);
                for (i = 0; i < mu * nu; i++)
                {
                    v = (double)u1[i] * (double)u2[0];
                    if ((v < rpar[0]) | (v > rpar[1]))
                    {
                        sciprint(_("overflow error"));
                        set_block_error(-4);
                        return;
                    }
                    else
                    {
                        y1[i] = (short)v;
                    }
                }
                break;
            }

            case SCSINT8_N :
            {

                char *u1 = Getint8InPortPtrs(block, 1);
                char *u2 = Getint8InPortPtrs(block, 2);
                char *y1 = Getint8OutPortPtrs(block, 1);
                for (i = 0; i < mu * nu; i++)
                {
                    v = (double)u1[i] * (double)u2[0];
                    if ((v < rpar[0]) | (v > rpar[1]))
                    {
                        sciprint(_("overflow error"));
                        set_block_error(-4);
                        return;
                    }
                    else
                    {
                        y1[i] = (char)v;
                    }
                }
                break;
            }

            case SCSUINT32_N :
            {

                unsigned long *u1 = Getuint32InPortPtrs(block, 1);
                unsigned long *u2 = Getuint32InPortPtrs(block, 2);
                unsigned long *y1 = Getuint32OutPortPtrs(block, 1);
                for (i = 0; i < mu * nu; i++)
                {
                    v = (double)u1[i] * (double)u2[0];
                    if ((v < rpar[0]) | (v > rpar[1]))
                    {
                        sciprint(_("overflow error"));
                        set_block_error(-4);
                        return;
                    }
                    else
                    {
                        y1[i] = (unsigned long)v;
                    }
                }
                break;
            }

            case SCSUINT16_N :
            {

                unsigned short *u1 = Getuint16InPortPtrs(block, 1);
                unsigned short *u2 = Getuint16InPortPtrs(block, 2);
                unsigned short *y1 = Getuint16OutPortPtrs(block, 1);
                for (i = 0; i < mu * nu; i++)
                {
                    v = (double)u1[i] * (double)u2[0];
                    if ((v < rpar[0]) | (v > rpar[1]))
                    {
                        sciprint(_("overflow error"));
                        set_block_error(-4);
                        return;
                    }
                    else
                    {
                        y1[i] = (unsigned short)v;
                    }
                }
                break;
            }

            case SCSUINT8_N :
            {

                unsigned char *u1 = Getuint8InPortPtrs(block, 1);
                unsigned char *u2 = Getuint8InPortPtrs(block, 2);
                unsigned char *y1 = Getuint8OutPortPtrs(block, 1);
                for (i = 0; i < mu * nu; i++)
                {
                    v = (double)u1[i] * (double)u2[0];
                    if ((v < rpar[0]) | (v > rpar[1]))
                    {
                        sciprint(_("overflow error"));
                        set_block_error(-4);
                        return;
                    }
                    else
                    {
                        y1[i] = (unsigned char)v;
                    }
                }
                break;
            }

            default :
            {
                set_block_error(-4);
                return;
            }
        }
    }

}
示例#16
0
/*--------------------------------------------------------------------------*/ 
SCICOS_BLOCKS_IMPEXP void matmul2_m(scicos_block *block,int flag)
{
	if (flag==1){
		int i = 0;
		int ut=GetInType(block,1);
		int mu=GetOutPortRows(block,1);
		int nu=GetOutPortCols(block,1);
		switch (ut)
		{
		case SCSREAL_N :{
			
			double *u1=GetRealInPortPtrs(block,1);
			double *u2=GetRealInPortPtrs(block,2);
			double *y1=GetRealOutPortPtrs(block,1);
			matmul2(y1,u1,u2,mu,nu);
			break;}

		case SCSINT32_N :{
			long *u1=Getint32InPortPtrs(block,1);
			long *u2=Getint32InPortPtrs(block,2);
			long *y1=Getint32OutPortPtrs(block,1);
			matmul2(y1,u1,u2,mu,nu);
			break;}

		case SCSINT16_N :{
			
			short *u1=Getint16InPortPtrs(block,1);
			short *u2=Getint16InPortPtrs(block,2);
			short *y1=Getint16OutPortPtrs(block,1);
			matmul2(y1,u1,u2,mu,nu);
			break;}

		case SCSINT8_N :{
			
			char *u1=Getint8InPortPtrs(block,1);
			char *u2=Getint8InPortPtrs(block,2);
			char *y1=Getint8OutPortPtrs(block,1);
			matmul2(y1,u1,u2,mu,nu);
			break;}

		case SCSUINT32_N :{
			
			unsigned long *u1=Getuint32InPortPtrs(block,1);
			unsigned long *u2=Getuint32InPortPtrs(block,2);
			unsigned long *y1=Getuint32OutPortPtrs(block,1);
			matmul2(y1,u1,u2,mu,nu);
			break;}

		case SCSUINT16_N :{
			
			unsigned short *u1=Getuint16InPortPtrs(block,1);
			unsigned short *u2=Getuint16InPortPtrs(block,2);
			unsigned short *y1=Getuint16OutPortPtrs(block,1);
			matmul2(y1,u1,u2,mu,nu);
			break;}

		case SCSUINT8_N :{
			
			unsigned char *u1=Getuint8InPortPtrs(block,1);
			unsigned char *u2=Getuint8InPortPtrs(block,2);
			unsigned char *y1=Getuint8OutPortPtrs(block,1);
			matmul2(y1,u1,u2,mu,nu);
			break;}

		case SCSCOMPLEX_N :{
			double *u1r=GetRealInPortPtrs(block,1);
			double *u2r=GetRealInPortPtrs(block,2);
			double *y1r=GetRealOutPortPtrs(block,1);
			double *u1i=GetImagInPortPtrs(block,1);
			double *u2i=GetImagInPortPtrs(block,2);
			double *y1i=GetImagOutPortPtrs(block,1);
			for (i=0;i<mu*nu;i++) 
			{y1r[i]=(u1r[i]*u2r[i])-(u1i[i]*u2i[i]);
			y1i[i]=(u1r[i]*u2i[i])+(u1i[i]*u2r[i]);}
			break;}

		default :{
			set_block_error(-4); 
			return;} 
		} 
	}

}
示例#17
0
/*--------------------------------------------------------------------------*/
SCICOS_BLOCKS_IMPEXP void relational_op_i32(scicos_block *block, int flag)
{
    int k = 0, i = 0;

    int m = GetInPortRows(block, 1);
    int n = GetInPortCols(block, 1);
    long *u1 = Getint32InPortPtrs(block, 1);
    long *u2 = Getint32InPortPtrs(block, 2);
    long *y = Getint32OutPortPtrs(block, 1);
    int *ipar = GetIparPtrs(block);

    if (flag == 1)
    {
        if ((block->ng != 0) & (get_phase_simulation() == 2))
        {
            for (i = 0; i < m * n; i++)
            {
                *(y + i) = block->mode[i] - 1;
            }
        }
        else
        {
            for (i = 0; i < m * n; i++)
            {
                y[i] = 0;
            }
            k = ipar[0];
            switch (k)
            {
                case 0:
                    for (i = 0; i < m * n; i++)
                    {
                        if (u1[i] == u2[i])
                        {
                            y[i] = 1;
                        }
                    }
                    break;
                case 1:
                    for (i = 0; i < m * n; i++)
                    {
                        if (u1[i] != u2[i])
                        {
                            y[i] = 1;
                        }
                    }
                    break;
                case 2:
                    for (i = 0; i < m * n; i++)
                    {
                        if (u1[i] < u2[i])
                        {
                            y[i] = 1;
                        }
                    }
                    break;
                case 3:
                    for (i = 0; i < m * n; i++)
                    {
                        if (u1[i] <= u2[i])
                        {
                            y[i] = 1;
                        }
                    }
                    break;
                case 4:
                    for (i = 0; i < m * n; i++)
                    {
                        if (u1[i] > u2[i])
                        {
                            y[i] = 1;
                        }
                    }
                    break;
                case 5:
                    for (i = 0; i < m * n; i++)
                    {
                        if (u1[i] >= u2[i])
                        {
                            y[i] = 1;
                        }
                    }
                    break;
            }
        }
    }
    else if (flag == 9)
    {
        for (i = 0; i < (m * n); i++)
        {
            block->g[i] = (double)(*(u1 + i) - * (u2 + i));
        }
        if (get_phase_simulation() == 1)
        {
            for (i = 0; i < m * n; i++)
            {
                block->mode[i] = (int)1;
            }
            k = ipar[0];
            switch (k)
            {
                case 0:
                    for (i = 0; i < m * n; i++)
                    {
                        if (u1[i] == u2[i])
                        {
                            block->mode[i] = (int)2;
                        }
                    }
                    break;
                case 1:
                    for (i = 0; i < m * n; i++)
                    {
                        if (u1[i] != u2[i])
                        {
                            block->mode[i] = (int)2;
                        }
                    }
                    break;
                case 2:
                    for (i = 0; i < m * n; i++)
                    {
                        if (u1[i] < u2[i])
                        {
                            block->mode[i] = (int)2;
                        }
                    }
                    break;
                case 3:
                    for (i = 0; i < m * n; i++)
                    {
                        if (u1[i] <= u2[i])
                        {
                            block->mode[i] = (int)2;
                        }
                    }
                    break;
                case 4:
                    for (i = 0; i < m * n; i++)
                    {
                        if (u1[i] > u2[i])
                        {
                            block->mode[i] = (int)2;
                        }
                    }
                    break;
                case 5:
                    for (i = 0; i < m * n; i++)
                    {
                        if (u1[i] >= u2[i])
                        {
                            block->mode[i] = (int)2;
                        }
                    }
                    break;
            }
        }
    }

}
示例#18
0
/*--------------------------------------------------------------------------*/
SCICOS_BLOCKS_IMPEXP void matmul2_e(scicos_block *block, int flag)
{
    if (flag == 1)
    {
        int i = 0;
        double v = 0.;
        int ut = GetInType(block, 1);
        int mu = GetOutPortRows(block, 1);
        int nu = GetOutPortCols(block, 1);
        double *rpar = GetRparPtrs(block);

        switch (ut)
        {
            case SCSINT32_N :
            {

                SCSINT32_COP *u1 = Getint32InPortPtrs(block, 1);
                SCSINT32_COP *u2 = Getint32InPortPtrs(block, 2);
                SCSINT32_COP *y1 = Getint32OutPortPtrs(block, 1);
                for (i = 0; i < mu * nu; i++)
                {
                    v = (double)u1[i] * (double)u2[i];
                    if ((v < rpar[0]) | (v > rpar[1]))
                    {
                        sciprint(_("overflow error"));
                        set_block_error(-4);
                        return;
                    }
                    else
                    {
                        y1[i] = (SCSUINT32_COP)v;
                    }
                }
                break;
            }

            case SCSINT16_N :
            {

                SCSINT16_COP *u1 = Getint16InPortPtrs(block, 1);
                SCSINT16_COP *u2 = Getint16InPortPtrs(block, 2);
                SCSINT16_COP *y1 = Getint16OutPortPtrs(block, 1);
                for (i = 0; i < mu * nu; i++)
                {
                    v = (double)u1[i] * (double)u2[i];
                    if ((v < rpar[0]) | (v > rpar[1]))
                    {
                        sciprint(_("overflow error"));
                        set_block_error(-4);
                        return;
                    }
                    else
                    {
                        y1[i] = (SCSINT16_COP)v;
                    }
                }
                break;
            }

            case SCSINT8_N :
            {

                SCSINT8_COP *u1 = Getint8InPortPtrs(block, 1);
                SCSINT8_COP *u2 = Getint8InPortPtrs(block, 2);
                SCSINT8_COP *y1 = Getint8OutPortPtrs(block, 1);
                for (i = 0; i < mu * nu; i++)
                {
                    v = (double)u1[i] * (double)u2[i];
                    if ((v < rpar[0]) | (v > rpar[1]))
                    {
                        sciprint(_("overflow error"));
                        set_block_error(-4);
                        return;
                    }
                    else
                    {
                        y1[i] = (SCSINT8_COP)v;
                    }
                }
                break;
            }

            case SCSUINT32_N :
            {

                SCSUINT32_COP *u1 = Getuint32InPortPtrs(block, 1);
                SCSUINT32_COP *u2 = Getuint32InPortPtrs(block, 2);
                SCSUINT32_COP *y1 = Getuint32OutPortPtrs(block, 1);
                for (i = 0; i < mu * nu; i++)
                {
                    v = (double)u1[i] * (double)u2[i];
                    if ((v < rpar[0]) | (v > rpar[1]))
                    {
                        sciprint(_("overflow error"));
                        set_block_error(-4);
                        return;
                    }
                    else
                    {
                        y1[i] = (SCSUINT32_COP)v;
                    }
                }
                break;
            }

            case SCSUINT16_N :
            {

                SCSUINT16_COP *u1 = Getuint16InPortPtrs(block, 1);
                SCSUINT16_COP *u2 = Getuint16InPortPtrs(block, 2);
                SCSUINT16_COP *y1 = Getuint16OutPortPtrs(block, 1);
                for (i = 0; i < mu * nu; i++)
                {
                    v = (double)u1[i] * (double)u2[i];
                    if ((v < rpar[0]) | (v > rpar[1]))
                    {
                        sciprint(_("overflow error"));
                        set_block_error(-4);
                        return;
                    }
                    else
                    {
                        y1[i] = (SCSUINT16_COP)v;
                    }
                }
                break;
            }

            case SCSUINT8_N :
            {

                SCSUINT8_COP *u1 = Getuint8InPortPtrs(block, 1);
                SCSUINT8_COP *u2 = Getuint8InPortPtrs(block, 2);
                SCSUINT8_COP *y1 = Getuint8OutPortPtrs(block, 1);
                for (i = 0; i < mu * nu; i++)
                {
                    v = (double)u1[i] * (double)u2[i];
                    if ((v < rpar[0]) | (v > rpar[1]))
                    {
                        sciprint(_("overflow error"));
                        set_block_error(-4);
                        return;
                    }
                    else
                    {
                        y1[i] = (SCSUINT8_COP)v;
                    }
                }
                break;
            }

            default :
            {
                set_block_error(-4);
                return;
            }
        }
    }
}