OpenCores
URL https://opencores.org/ocsvn/dblclockfft/dblclockfft/trunk

Subversion Repositories dblclockfft

[/] [dblclockfft/] [trunk/] [sw/] [fftgen.cpp] - Diff between revs 30 and 31

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 30 Rev 31
Line 18... Line 18...
//              One is in the usage() function below.  The second is in the
//              One is in the usage() function below.  The second is in the
//              'doc'uments directory that comes with this package, 
//              'doc'uments directory that comes with this package, 
//              specifically in the spec.pdf file.  If it's not there, type
//              specifically in the spec.pdf file.  If it's not there, type
//              make in the documents directory to build it.
//              make in the documents directory to build it.
//
//
 
//      20160123 - Thanks to Lesha Birukov, adjusted for MS Visual Studio 2012.
 
//              (Adjustments are at the top of the file ...)
 
//
// Creator:     Dan Gisselquist, Ph.D.
// Creator:     Dan Gisselquist, Ph.D.
//              Gisselquist Technology, LLC
//              Gisselquist Technology, LLC
//
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
Line 47... Line 50...
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
 
#define _CRT_SECURE_NO_WARNINGS   //  ms vs 2012 doesn't like fopen
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <unistd.h>
 
 
#ifdef _MSC_VER //  added for ms vs compatibility
 
 
 
#include <io.h>
 
#include <direct.h>
 
#define _USE_MATH_DEFINES
 
#define R_OK    4       /* Test for read permission.  */
 
#define W_OK    2       /* Test for write permission.  */
 
#define X_OK    0       /* !!!!!! execute permission - unsupported in windows*/
 
#define F_OK    0       /* Test for existence.  */
 
 
 
#if _MSC_VER <= 1700
 
 
 
long long llround(double d) {
 
        if (d<0) return -(long long)(-d+0.5);
 
        else    return (long long)(d+0.5); }
 
int lstat(const char *filename, struct stat *buf) { return 1; };
 
#define S_ISDIR(A)      0
 
 
 
#else
 
 
 
#define lstat   _stat
 
#define S_ISDIR _S_IFDIR
 
 
 
#endif
 
 
 
#define mkdir(A,B)      _mkdir(A)
 
 
 
#define access _access
 
 
 
#else
 
// And for G++/Linux environment
 
 
 
#include <unistd.h>     // Defines the R_OK/W_OK/etc. macros
#include <sys/stat.h>
#include <sys/stat.h>
 
#endif
 
 
#include <string.h>
#include <string.h>
#include <string>
#include <string>
#include <math.h>
#include <math.h>
#include <ctype.h>
#include <ctype.h>
#include <assert.h>
#include <assert.h>
Line 2065... Line 2104...
                        double  W = ((inv)?1:-1)*2.0*M_PI*k/(double)(2*stage);
                        double  W = ((inv)?1:-1)*2.0*M_PI*k/(double)(2*stage);
                        double  c, s;
                        double  c, s;
                        long long ic, is, vl;
                        long long ic, is, vl;
 
 
                        c = cos(W); s = sin(W);
                        c = cos(W); s = sin(W);
                        ic = (long long)round((1ll<<(cbits-2)) * c);
                        ic = (long long)llround((1ll<<(cbits-2)) * c);
                        is = (long long)round((1ll<<(cbits-2)) * s);
                        is = (long long)llround((1ll<<(cbits-2)) * s);
                        vl = (ic & (~(-1ll << (cbits))));
                        vl = (ic & (~(-1ll << (cbits))));
                        vl <<= (cbits);
                        vl <<= (cbits);
                        vl |= (is & (~(-1ll << (cbits))));
                        vl |= (is & (~(-1ll << (cbits))));
                        fprintf(cmem, "%0*llx\n", ((cbits*2+3)/4), vl);
                        fprintf(cmem, "%0*llx\n", ((cbits*2+3)/4), vl);
                        /*
                        /*
Line 2975... Line 3014...
                }
                }
 
 
        }
        }
}
}
 
 
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.