34 #include <itpp/itexports.h> 890 uint64_t(1), uint64_t(1) << 1, uint64_t(1) << 2, uint64_t(1) << 3, uint64_t(1) << 4,
891 uint64_t(1) << 5, uint64_t(1) << 6, uint64_t(1) << 7, uint64_t(1) << 8, uint64_t(1) << 9,
892 uint64_t(1) << 10, uint64_t(1) << 11, uint64_t(1) << 12, uint64_t(1) << 13, uint64_t(1) << 14,
893 uint64_t(1) << 15, uint64_t(1) << 16, uint64_t(1) << 17, uint64_t(1) << 18, uint64_t(1) << 19,
894 uint64_t(1) << 20, uint64_t(1) << 21, uint64_t(1) << 22, uint64_t(1) << 23, uint64_t(1) << 24,
895 uint64_t(1) << 25, uint64_t(1) << 26, uint64_t(1) << 27, uint64_t(1) << 28, uint64_t(1) << 29,
896 uint64_t(1) << 30, uint64_t(1) << 31, uint64_t(1) << 32, uint64_t(1) << 33, uint64_t(1) << 34,
897 uint64_t(1) << 35, uint64_t(1) << 36, uint64_t(1) << 37, uint64_t(1) << 38, uint64_t(1) << 39,
898 uint64_t(1) << 40, uint64_t(1) << 41, uint64_t(1) << 42, uint64_t(1) << 43, uint64_t(1) << 44,
899 uint64_t(1) << 45, uint64_t(1) << 46, uint64_t(1) << 47, uint64_t(1) << 48, uint64_t(1) << 49,
900 uint64_t(1) << 50, uint64_t(1) << 51, uint64_t(1) << 52, uint64_t(1) << 53, uint64_t(1) << 54,
901 uint64_t(1) << 55, uint64_t(1) << 56, uint64_t(1) << 57, uint64_t(1) << 58, uint64_t(1) << 59,
902 uint64_t(1) << 60, uint64_t(1) << 61, uint64_t(1) << 62, uint64_t(1) << 63
986 : shift(s), wordlen(w), emode(e), omode(o), qmode(q), stat_ptr(ptr) {init();}
989 : shift(x.shift), wordlen(
MAX_WORDLEN), emode(
TC), omode(
WRAP), qmode(
TRN), stat_ptr(0) {init();}
998 static void set_output_mode(std::string o);
1017 virtual void print()
const;
1046 fixrep scale_and_apply_modes(
double x,
q_mode q)
const;
1068 #endif // #ifndef FIX_BASE_H output_mode get_output_mode() const
Get output mode.
static void set_output_mode(output_mode o)
Set output mode to OUTPUT_FIX, OUTPUT_FIX_SHIFT, OUTPUT_FLOAT or OUTPUT_FLOAT_SHIFT. Static member function.
fixrep scale_and_apply_modes(double x) const
Convert from double to fixrep using shift and quantization mode qmode, then call limit() ...
Rounding to minus infinity.
q_mode get_q_mode() const
Get quantization mode.
Output floating-point value.
std::ostream & operator<<(std::ostream &output, const bin &inbin)
Output stream of bin.
const uint64_t UINT64_POW2[64]
Table for fast multiplication or division by 2^n.
void set_shift(int s)
Set shift (without shifting)
fixrep rshift_and_apply_q_mode(fixrep x, int n) const
Right shift n bits using quantization mode qmode and make call to statistics object (if any) ...
Stat * stat_ptr
Pointer to statistics object.
e_mode emode
Sign encoding mode.
e_mode get_e_mode() const
Get sign encoding mode.
virtual ~Fix_Base()
Destructor.
fixrep get_max() const
Get maximum value of data representation.
T min(const Vec< T > &in)
Minimum value of vector.
const double DOUBLE_POW2[128]
Table for fast multiplication by 2^(n-64)
e_mode
Sign encoding modes (aligned with SystemC)
Output fixed-point representation only.
Fix_Base(const Fix_Base &x)
Copy constructor.
Rounding to plus infinity.
T max(const Vec< T > &v)
Maximum value of vector.
o_mode
Overflow modes (aligned with SystemC)
Convergent rounding with half-way value rounded to odd value (not defined in SystemC) ...
fixrep get_min() const
Get minimum value of data representation.
q_mode qmode
Quantization mode.
fixrep min
Minimum allowed value (help variable to speed up calculations)
int n_unused_bits
Number of unused (MSB) bits (help variable to speed up calculations)
o_mode omode
Overflow mode.
const int MAX_WORDLEN
Max word length.
Miscellaneous statistics functions and classes - header file.
int shift
Accumulated bitshift (positive means left-shifted, negative means right-shifted)
Output floating-point value followed by <<shift.
Base class for fixed-point data types.
Fix_Base(int s=0, int w=MAX_WORDLEN, e_mode e=TC, o_mode o=WRAP, q_mode q=TRN, Stat *ptr=0)
Default constructor.
Symmetrical saturation (Not implemented)
o_mode get_o_mode() const
Get overflow mode.
int get_wordlen() const
Get word length.
Sign magnitued wrap-around (Not implemented)
int64_t fixrep
Representation for fixed-point data types.
Output fixed-point representation followed by <shift> (default)
A class for sampling a signal and calculating statistics.
Convergent rounding with half-way value rounded to even value.
Saturation to zero (Not implemented)
q_mode
Quantization modes (aligned with SystemC)
int get_shift() const
Get shift.
fixrep max
Maximum allowed value (help variable to speed up calculations)