Go to the documentation of this file.
85 os <<
"sc_fxnum_bitref" << ::std::endl;
86 os <<
"(" << ::std::endl;
89 os <<
"idx = " <<
m_idx << ::std::endl;
90 os <<
")" << ::std::endl;
117 os <<
"sc_fxnum_fast_bitref" << ::std::endl;
118 os <<
"(" << ::std::endl;
121 os <<
"idx = " <<
m_idx << ::std::endl;
122 os <<
")" << ::std::endl;
162 os <<
"sc_fxnum_subref" << ::std::endl;
163 os <<
"(" << ::std::endl;
166 os <<
"from = " <<
m_from << ::std::endl;
167 os <<
"to = " <<
m_to << ::std::endl;
168 os <<
")" << ::std::endl;
209 os <<
"sc_fxnum_fast_subref" << ::std::endl;
210 os <<
"(" << ::std::endl;
213 os <<
"from = " <<
m_from << ::std::endl;
214 os <<
"to = " <<
m_to << ::std::endl;
215 os <<
")" << ::std::endl;
309 os <<
"sc_fxnum" << ::std::endl;
310 os <<
"(" << ::std::endl;
323 os <<
")" << ::std::endl;
339 SC_ASSERT_(observer_ != 0,
"unlock observer failed");
353 int fwl = params.
wl() - params.
iwl();
357 double frac_part = modf(
val, &int_part);
359 q_flag = (frac_part != 0.0);
364 switch (params.
q_mode()) {
373 if (frac_part >= 0.5)
375 else if (frac_part < -0.5)
385 if (frac_part >= 0.5)
387 else if (frac_part <= -0.5)
393 if (frac_part > 0.5 ||
394 (frac_part == 0.5 && fmod(int_part, 2.0) != 0.0)) {
396 }
else if (frac_part < -0.5 ||
397 (frac_part == -0.5 && fmod(int_part, 2.0) != 0.0)) {
406 else if (frac_part < -0.5)
414 else if (frac_part <= -0.5)
428 overflow(
double &
c,
const scfx_params ¶ms,
bool &o_flag)
430 int iwl = params.iwl();
431 int fwl = params.wl() - iwl;
435 if (params.enc() ==
SC_TC_) {
436 high = full_circle / 2.0 - resolution;
440 low = - full_circle / 2.0;
443 high = full_circle - resolution;
448 bool under = (
val < low);
451 o_flag = (under ||
over);
454 switch (params.o_mode()) {
457 int n_bits = params.n_bits();
461 val -= floor(
val / full_circle) * full_circle;
464 }
else if (n_bits < params.wl()) {
469 if (
val > (
X - resolution))
476 if (params.enc() ==
SC_TC_)
477 val += full_circle / 2.0 -
X;
479 val += full_circle -
X;
509 int n_bits = params.n_bits();
513 if (
c2.get_bit(iwl) !=
c2.get_bit(iwl - 1))
517 val -= floor(
val / full_circle) * full_circle;
520 }
else if (n_bits == 1) {
522 if (
c2.is_neg() !=
c2.get_bit(iwl - 1))
526 val -= floor(
val / full_circle) * full_circle;
529 }
else if (n_bits < params.wl()) {
531 if (
c2.is_neg() ==
c2.get_bit(iwl - n_bits))
538 if (
val > (
X - resolution))
545 val += full_circle / 2.0 -
X;
577 if (
id.negative() != 0)
588 if (
id.
is_zero() &&
id.negative() != 0) {
602 const scfx_params * =0);
688 os <<
"sc_fxnum_fast" << ::std::endl;
689 os <<
"(" << ::std::endl;
701 os <<
")" << ::std::endl;
713 unsigned int m0 =
id.mantissa0();
714 unsigned int m1 =
id.mantissa1();
719 if (
id.negative() != 0) {
722 unsigned int tmp = m1;
729 int j =
i -
id.exponent();
731 return ((m0 & 1U << 31) != 0);
733 return ((m0 & 1U <<
j) != 0);
734 else if ((
j += 32) >= 0)
735 return ((m1 & 1U <<
j) != 0);
778 unsigned int m0 =
id.mantissa0();
779 unsigned int m1 =
id.mantissa1();
784 if (
id.negative() != 0) {
787 unsigned int tmp = m1;
795 for (
int k = 0;
k < bv.length(); ++
k) {
798 int n =
l -
id.exponent();
800 b = ((m0 & 1U << 31) != 0);
802 b = ((m0 & 1U <<
n) != 0);
803 else if ((
n += 32) >= 0)
804 b = ((m1 & 1U <<
n) != 0);
826 for (
int k = 0;
k < bv.length(); ++
k) {
864 SC_ASSERT_(observer_ != 0,
"unlock observer failed");
bool to_bool(const std::string &value, bool &retval)
Turn a string representation of a boolean into a boolean value.
void print(::std::ostream &=::std::cout) const
void scan(::std::istream &=::std::cin)
const std::string to_oct() const
bool get_slice(int, int, sc_bv_base &) const
const std::string to_string(sc_enc enc)
static void overflow(double &c, const scfx_params ¶ms, bool &o_flag)
sc_fxnum_observer * m_observer
const std::string to_bin() const
const std::string to_hex() const
const std::string to_string() const
double scfx_pow2(int exp)
const std::string to_bin() const
sc_fxnum_fast_observer * lock_observer() const
void dump(::std::ostream &=::std::cout) const
void print(::std::ostream &=::std::cout) const
void print(::std::ostream &=::std::cout) const
void scan(::std::istream &=::std::cin)
bool set_slice(int, int, const sc_bv_base &)
void scan(::std::istream &=::std::cin)
void print(::std::ostream &=::std::cout) const
bool get_slice(int, int, sc_bv_base &) const
const char SC_ID_INVALID_FX_VALUE_[]
void dump(::std::ostream &) const
void scan(::std::istream &=::std::cin)
const std::string to_oct() const
const std::string to_string() const
void print(::std::ostream &os=::std::cout) const
bool set_slice(int, int, const sc_bv_base &)
const std::string to_hex() const
sc_fxnum_observer * lock_observer() const
void unlock_observer(sc_fxnum_fast_observer *) const
void dump(::std::ostream &=::std::cout) const
void scan(::std::istream &=::std::cin)
const std::string to_dec() const
void dump(::std::ostream &=::std::cout) const
void print(::std::ostream &=::std::cout) const
void print(::std::ostream &=::std::cout) const
const char * to_string(sc_numrep, int, sc_fmt, const scfx_params *=0) const
void dump(::std::ostream &=::std::cout) const
const std::string to_dec() const
void dump(::std::ostream &=::std::cout) const
void dump(::std::ostream &) const
void scan(::std::istream &is=::std::cin)
void unlock_observer(sc_fxnum_observer *) const
const char SC_ID_WRAP_SM_NOT_DEFINED_[]
#define SC_ERROR_IF_(cnd, id)
sc_fxnum_fast_observer * m_observer
void scan(::std::istream &=::std::cin)
#define SC_ASSERT_(cnd, msg)
const sc_fxcast_switch & cast_switch() const
void dump(::std::ostream &=::std::cout) const
static void quantization(double &c, const scfx_params ¶ms, bool &q_flag)
Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17