?? cordic.h
字號:
/* Class Cordic provides interfaces to CORDIC algorithm
As we know, CORDIC algorithm is discovered and issued by J.S Volder
firstly, and then extended by Walther.As the development of computer
technology and FPGA, CORDIC was found attractive in many projects.
Thereafter, lots of derivative algorithms were developed.
However, this projects only focus on the conventional CORDIC algorithm.
And piles of thesis may be referred to in your project.
*/
#ifndef CORDIC_DECLARE
#define CORDIC_DECLARE
// pi
#ifndef PI
#define PI 3.141592653589793
#endif
#include <fstream>
using std::ostream;
#include "Dformat.h"
const Dformat DATAFORMAT; // default data format
class Cordic
{
public:
// default constructor---------------------------------------------------
Cordic( const Dformat& CDf=DATAFORMAT,int m=1,char dv_n='z',
double x0=0,double y0=0,double z0=0 );
// setting functions-----------------------------------------------------
void set( const Dformat& CDf,
const int m,const char dv_n,
const double x0,
const double y0,
const double z0 );
void set( const unsigned M,const unsigned N,
const int m,const char dv_n,
const double x0,
const double y0,
const double z0 );
void set( const unsigned M,const unsigned N );
void set( const int m );
void set( const char dv_n );
void set( const double x0,const double y0,const double z0 );
//
// trigonometric functions--------------------------------------------------------
double Sin();
double Cos();
double Abs();
double Atan();
double Mult();
double Dev();
double Sinh();
double Cosh();
double Sqrt();
double Atanh();
//
// getting functions-----------------------------------------------------
const double& getx( void ) const; // get the final result
const double& gety( void ) const;
const double& getz( void ) const;
// print parameters------------------------------------------------------
void print( ostream& ) const;
// save the results into files-----------
void save( ostream& ) const;
// default destructor----------------------------------------------------
~Cordic( void );
private:
Dformat CORDIC_Dfmt; // codic data format
int mode; // mode: circular\linear\hyperbolic
char dv_name; // decision variable name
double x; // initial state
double y;
double z;
// utility functions-----------------------------------------------------
bool validator( const double x0,const double y0,const double z0 ) const;
// validate intial state
bool terminator( const long dv ) const;
// core functions
void cordic( const int m,const char dv_n );
};
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -