URL
https://opencores.org/ocsvn/systemc_cordic/systemc_cordic/trunk
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
2 |
wwcheng |
#ifndef _CONVERT_H_
|
2 |
|
|
#define _CONVERT_H_
|
3 |
|
|
// convert.h: header file
|
4 |
|
|
/********************************************************************
|
5 |
|
|
//
|
6 |
|
|
// Module:
|
7 |
|
|
// Collection of type conversion parameters and functions
|
8 |
|
|
//
|
9 |
|
|
// Authors: Winnie Cheng<wwcheng@stanford.edu>,
|
10 |
|
|
// Peter Wu<peter5@stanford.edu>
|
11 |
|
|
*********************************************************************/
|
12 |
|
|
|
13 |
|
|
/* common angles in fixed point format */
|
14 |
|
|
#define INT90 (0x2d00) /* Predefine 90 degrees in fixed point format */
|
15 |
|
|
#define INT180 (0x5a00) /* Predefine 180 degrees in fixed point format */
|
16 |
|
|
|
17 |
|
|
/* start values for some rotation */
|
18 |
|
|
#define START_SINCOS_Y 0x004e
|
19 |
|
|
#define START_SINHCOSH_X 0x009b // 1.2074
|
20 |
|
|
|
21 |
|
|
/* specification for fixed point format */
|
22 |
|
|
#define FRACTBITS 7 /* Number of fractional bits */
|
23 |
|
|
#define CONV (1<<FRACTBITS) /* Conversion factor to fixed-point format */
|
24 |
|
|
|
25 |
|
|
/* fixed-point <-> floating point conversion functions */
|
26 |
|
|
/* convert from fixed point to float */
|
27 |
|
|
#define tofp(i) ((double)(1.0*i)/(1.0*CONV))
|
28 |
|
|
/* convert from float to fixed point */
|
29 |
|
|
#define toint(fp) ((short)(fp*CONV+0.5))
|
30 |
|
|
|
31 |
|
|
#endif /* _CONVERT_H_ */
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.