34#include <itpp/itexports.h>
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;
Base class for fixed-point data types.
e_mode get_e_mode() const
Get sign encoding mode.
q_mode get_q_mode() const
Get quantization mode.
fixrep get_max() const
Get maximum value of data representation.
static void set_output_mode(output_mode o)
Set output mode to OUTPUT_FIX, OUTPUT_FIX_SHIFT, OUTPUT_FLOAT or OUTPUT_FLOAT_SHIFT....
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.
int get_wordlen() const
Get word length.
virtual ~Fix_Base()
Destructor.
fixrep scale_and_apply_modes(double x) const
Convert from double to fixrep using shift and quantization mode qmode, then call limit()
int n_unused_bits
Number of unused (MSB) bits (help variable to speed up calculations)
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)
output_mode get_output_mode() const
Get output mode.
fixrep get_min() const
Get minimum value of data representation.
void set_shift(int s)
Set shift (without shifting)
fixrep min
Minimum allowed value (help variable to speed up calculations)
e_mode emode
Sign encoding mode.
Stat * stat_ptr
Pointer to statistics object.
fixrep max
Maximum allowed value (help variable to speed up calculations)
int get_shift() const
Get shift.
int shift
Accumulated bitshift (positive means left-shifted, negative means right-shifted)
q_mode qmode
Quantization mode.
o_mode omode
Overflow mode.
o_mode get_o_mode() const
Get overflow mode.
Fix_Base(const Fix_Base &x)
Copy constructor.
A class for sampling a signal and calculating statistics.
const int MAX_WORDLEN
Max word length.
o_mode
Overflow modes (aligned with SystemC)
const double DOUBLE_POW2[128]
Table for fast multiplication by 2^(n-64)
e_mode
Sign encoding modes (aligned with SystemC)
const uint64_t UINT64_POW2[64]
Table for fast multiplication or division by 2^n.
q_mode
Quantization modes (aligned with SystemC)
int64_t fixrep
Representation for fixed-point data types.
@ SAT_ZERO
Saturation to zero (Not implemented)
@ WRAP_SM
Sign magnitued wrap-around (Not implemented)
@ SAT_SYM
Symmetrical saturation (Not implemented)
@ TRN_ZERO
Truncation to zero.
@ RND
Rounding to plus infinity.
@ RND_INF
Rounding to infinity.
@ RND_CONV
Convergent rounding with half-way value rounded to even value.
@ RND_MIN_INF
Rounding to minus infinity.
@ RND_ZERO
Rounding to zero.
@ RND_CONV_ODD
Convergent rounding with half-way value rounded to odd value (not defined in SystemC)
@ OUTPUT_FIX
Output fixed-point representation only.
@ OUTPUT_FLOAT
Output floating-point value.
@ OUTPUT_FIX_SHIFT
Output fixed-point representation followed by <shift> (default)
@ OUTPUT_FLOAT_SHIFT
Output floating-point value followed by <<shift.
T min(const Vec< T > &in)
Minimum value of vector.
T max(const Vec< T > &v)
Maximum value of vector.
Miscellaneous statistics functions and classes - header file.
std::ostream & operator<<(std::ostream &output, const bin &inbin)
Output stream of bin.