Go to the documentation of this file.
63 #ifndef __SYSTEMC_EXT_DT_INT_SC_NBUTILS_HH__
64 #define __SYSTEMC_EXT_DT_INT_SC_NBUTILS_HH__
71 #include "../../utils/sc_report_handler.hh"
72 #include "../bit/messages.hh"
95 std::ios::fmtflags flags =
os.flags() & std::ios::basefield;
96 if (flags & ::std::ios::dec)
return SC_DEC;
97 if (flags & ::std::ios::hex)
return SC_HEX;
98 if (flags & ::std::ios::oct)
return SC_OCT;
105 return (
os.flags() & ::std::ios::showbase) != 0;
110 inline ::std::ostream &
301 return (ulen - vlen);
304 while ((--ulen >= 0) && (
u[ulen] ==
v[ulen]))
316 return (
int)(
u[ulen] -
v[ulen]);
332 while ((--ulen >= 0) && (!
u[ulen]))
378 for (
int i = from;
i < ulen;
i++)
392 for (
int i = 0;
i <
n; ++
i)
422 for (
int i = 0;
i < ulen; ++
i) {
448 while (
v && (
i < ulen)) {
456 # define SC_LIKELY_(x) !!(x)
458 # define SC_LIKELY_(x) __builtin_expect(!!(x), 1)
475 if (
SC_LIKELY_(
u > (std::numeric_limits<Type>::min)()))
507 void test_bound_failed(
int nb);
512 if (nb > SC_MAX_NBITS) {
513 test_bound_failed(nb);
526 "div_by_zero<Type>(Type) : division by zero");
591 sc_assert((nb > 0) && (nd > 0) && (
d != NULL));
604 trim(added, nb, nd,
d);
628 sc_assert((nb > 0) && (nd > 0) && (
d != NULL));
640 sc_assert((nb > 0) && (nd > 0) && (
d != NULL));
703 sc_assert((nb > 0) && (nd > 0) && (
d != NULL));
755 int vnb,
int vnd,
const sc_digit *vd)
812 return std::numeric_limits<double>::has_quiet_NaN && (
v !=
v);
818 return v == std::numeric_limits<double>::infinity() ||
819 v == -std::numeric_limits<double>::infinity();
828 "is_bad_double(double v) : "
829 "v is not finite - NaN or Inf");
834 #endif // __SYSTEMC_EXT_DT_INT_SC_NBUTILS_HH__
const char SC_ID_VALUE_NOT_VALID_[]
#define BITS_PER_HALF_DIGIT
void convert_SM_to_2C_trimmed(small_type added, small_type s, int nb, int nd, sc_digit *d)
void convert_signed_SM_to_2C_trimmed(small_type s, int nb, int nd, sc_digit *d)
void copy_digits_unsigned(small_type &us, int unb, int und, sc_digit *ud, int, int vnd, const sc_digit *vd)
int vec_cmp(int ulen, const sc_digit *u, int vlen, const sc_digit *v)
void vec_add_small_on(int ulen, sc_digit *u, sc_digit v)
void vec_add_small(int ulen, const sc_digit *u, sc_digit v, sc_digit *w)
void convert_signed_SM_to_2C(small_type s, int nd, sc_digit *d)
sc_digit one_and_zeros(int n)
void vec_reverse(int unb, int und, sc_digit *ud, int l, int r)
void vec_zero(int from, int ulen, sc_digit *u)
sc_digit vec_rem_small(int ulen, const sc_digit *u, sc_digit v)
void vec_sub_small_on(int ulen, sc_digit *u, sc_digit v)
small_type convert_unsigned_SM_to_2C_to_SM(small_type s, int nb, int nd, sc_digit *d)
void vec_sub(int ulen, const sc_digit *u, int vlen, const sc_digit *v, sc_digit *w)
small_type check_for_zero(small_type s, int ulen, const sc_digit *u)
int vec_skip_leading_zeros(int ulen, const sc_digit *u)
const std::string to_string(sc_enc enc)
small_type get_sign(Type &u)
sc_signed operator<<(const sc_signed &u, const sc_int_base &v)
void trim_signed(int nb, int nd, sc_digit *d)
void vec_add_on(int ulen, sc_digit *ubegin, int vlen, const sc_digit *v)
void vec_div_large(int ulen, const sc_digit *u, int vlen, const sc_digit *v, sc_digit *w)
void convert_SM_to_2C(small_type s, int nd, sc_digit *d)
const char * get_base_and_sign(const char *v, small_type &b, small_type &s)
bool sc_io_show_base(::std::ostream &os)
small_type mul_signs(small_type us, small_type vs)
const char SC_ID_OPERATION_FAILED_[]
void vec_from_char(int ulen, const uchar *u, int vlen, sc_digit *v)
void safe_set(int i, bool v, sc_digit *d)
void copy_digits_signed(small_type &us, int unb, int und, sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
void vec_add_on2(int ulen, sc_digit *ubegin, int, const sc_digit *v)
void trim_unsigned(int nb, int nd, sc_digit *d)
void trim(small_type added, int nb, int nd, sc_digit *d)
#define SC_REPORT_ERROR(msg_type, msg)
void vec_copy_and_zero(int ulen, sc_digit *u, int vlen, const sc_digit *v)
void convert_unsigned_SM_to_2C_trimmed(small_type s, int nb, int nd, sc_digit *d)
sc_numrep sc_io_base(::std::ostream &os, sc_numrep def_base)
void vec_mul(int ulen, const sc_digit *u, int vlen, const sc_digit *vbegin, sc_digit *wbegin)
void convert_unsigned_SM_to_2C(small_type s, int nd, sc_digit *d)
void vec_sub_small(int ulen, const sc_digit *u, sc_digit v, sc_digit *w)
void vec_rem_large(int ulen, const sc_digit *u, int vlen, const sc_digit *v, sc_digit *w)
void vec_div_small(int ulen, const sc_digit *u, sc_digit v, sc_digit *q)
void vec_mul_small(int ulen, const sc_digit *u, sc_digit v, sc_digit *w)
small_type convert_signed_2C_to_SM(int nb, int nd, sc_digit *d)
void vec_add(int ulen, const sc_digit *u, int vlen, const sc_digit *v, sc_digit *w)
small_type convert_unsigned_2C_to_SM(int nb, int nd, sc_digit *d)
int vec_skip_and_cmp(int ulen, const sc_digit *u, int vlen, const sc_digit *v)
small_type convert_signed_SM_to_2C_to_SM(small_type s, int nb, int nd, sc_digit *d)
void vec_sub_on2(int ulen, sc_digit *ubegin, int vlen, const sc_digit *v)
sc_concref_r< sc_bitref_r< T1 >, sc_bitref_r< T2 > > concat(sc_bitref_r< T1 >, sc_bitref_r< T2 >)
void parse_binary_bits(const char *src_p, int dst_n, sc_digit *data_p, sc_digit *ctrl_p)
small_type vec_from_str(int unb, int und, sc_digit *u, const char *v, sc_numrep base)
int vec_to_char(int ulen, const sc_digit *u, int vlen, uchar *v)
void vec_sub_on(int ulen, sc_digit *ubegin, int vlen, const sc_digit *v)
void parse_hex_bits(const char *src_p, int dst_n, sc_digit *data_p, sc_digit *ctrl_p)
void from_uint(int ulen, sc_digit *u, Type v)
void vec_mul_small_on(int ulen, sc_digit *u, sc_digit v)
small_type make_zero(int nd, sc_digit *d)
void vec_shift_right(int ulen, sc_digit *u, int nsr, sc_digit fill)
void vec_copy(int n, sc_digit *u, const sc_digit *v)
sc_digit one_and_ones(int n)
sc_digit high_half_masked(sc_digit d)
void is_bad_double(double v)
sc_digit low_half(sc_digit d)
sc_digit high_half(sc_digit d)
void vec_complement(int ulen, sc_digit *u)
void vec_shift_left(int ulen, sc_digit *u, int nsl)
int vec_find_first_nonzero(int ulen, const sc_digit *u)
sc_digit vec_rem_on_small(int ulen, sc_digit *u, sc_digit v)
small_type fsm_move(char c, small_type &b, small_type &s, small_type &state)
Generated on Wed Sep 30 2020 14:02:16 for gem5 by doxygen 1.8.17