99#ifndef __SYSTEMC_EXT_DT_INT_SC_UNSIGNED_HH__
100#define __SYSTEMC_EXT_DT_INT_SC_UNSIGNED_HH__
115class sc_unsigned_bitref_r;
116class sc_unsigned_bitref;
117class sc_unsigned_subref_r;
118class sc_unsigned_subref;
127class sc_int_subref_r;
128class sc_uint_subref_r;
130class sc_signed_subref_r;
142extern template class sc_vpool<sc_dt::sc_unsigned_bitref>;
143extern template class sc_vpool<sc_dt::sc_unsigned_subref>;
144extern template class sc_vpool<sc_dt::sc_unsigned>;
153 small_type vs,
int vnb,
int vnd,
const sc_digit *vd,
154 small_type if_u_signed=0, small_type if_v_signed=0);
166 int vnb,
int vnd,
const sc_digit *vd);
170 int vnb,
int vnd,
const sc_digit *vd);
174 int vnb,
int vnd,
const sc_digit *vd);
461inline bool operator != (
const sc_unsigned &u,
int v);
462inline bool operator != (
const sc_unsigned &u,
unsigned int v);
468inline bool operator != (
int u,
const sc_unsigned &v);
469inline bool operator != (
unsigned int u,
const sc_unsigned &v);
484bool operator < (
const sc_unsigned &u,
unsigned long v);
485inline bool operator < (
const sc_unsigned &u,
int v);
486inline bool operator < (
const sc_unsigned &u,
unsigned int v);
491bool operator < (
unsigned long u,
const sc_unsigned &v);
492inline bool operator < (
int u,
const sc_unsigned &v);
493inline bool operator < (
unsigned int u,
const sc_unsigned &v);
509inline bool operator <= (
const sc_unsigned &u,
int v);
510inline bool operator <= (
const sc_unsigned &u,
unsigned int v);
516inline bool operator <= (
int u,
const sc_unsigned &v);
517inline bool operator <= (
unsigned int u,
const sc_unsigned &v);
533inline bool operator > (
const sc_unsigned &u,
int v);
534inline bool operator > (
const sc_unsigned &u,
unsigned int v);
540inline bool operator > (
int u,
const sc_unsigned &v);
541inline bool operator > (
unsigned int u,
const sc_unsigned &v);
557inline bool operator >= (
const sc_unsigned &u,
int v);
558inline bool operator >= (
const sc_unsigned &u,
unsigned int v);
564inline bool operator >= (
int u,
const sc_unsigned &v);
565inline bool operator >= (
unsigned int u,
const sc_unsigned &v);
610 bool operator ! ()
const;
611 bool operator ~ ()
const;
622 *xz_present_p =
false;
635 dst_p[word_i] &= ~bit_mask;
646 dst_p[word_i] |= bit_mask;
649 dst_p[word_i] &= ~bit_mask;
656 void print(::std::ostream &os=::std::cout)
const { os << to_bool(); }
706 void scan(::std::istream &is=::std::cin);
754 if (m_left >= m_right)
755 return m_left - m_right + 1;
757 return m_right - m_left + 1;
780 *xz_present_p =
false;
781 return m_left - m_right + 1;
797 print(::std::ostream &os=::std::cout)
const
851 operator = (
unsigned int a)
853 return operator = ((
unsigned long)
a);
859 return operator = ((
long)
a);
875 void scan(::std::istream &is=::std::cin);
904 void invalid_init(
const char *type_name,
int nb)
const;
928 a->to_sc_unsigned(*
this);
944 return operator = ((
long)v);
948 operator = (
unsigned int v)
950 return operator = ((
unsigned long)v);
979 *xz_present_p =
false;
982 virtual bool concat_get_ctrl(
sc_digit *dst_p,
int low_i)
const;
983 virtual bool concat_get_data(
sc_digit *dst_p,
int low_i)
const;
984 virtual uint64 concat_get_uint64()
const;
985 virtual void concat_set(
int64 src,
int low_i);
986 virtual void concat_set(
const sc_signed &src,
int low_i);
987 virtual void concat_set(
const sc_unsigned &src,
int low_i);
988 virtual void concat_set(
uint64 src,
int low_i);
1002 if ((i < 0) || (i >= nbits - 1))
1006 void invalid_index(
int i)
const;
1018 operator [] (
int i)
const
1056 if ((l < 0) || (r >= nbits - 1))
1057 invalid_range(l, r);
1059 if ((r < 0) || (l >= nbits - 1))
1060 invalid_range(l, r);
1064 void invalid_range(
int l,
int r)
const;
1085 operator () (
int i,
int j)
1094 operator () (
int i,
int j)
const
1117 print(::std::ostream &os=::std::cout)
const
1122 void scan(::std::istream &is=::std::cin);
1123 void dump(::std::ostream &os=::std::cout)
const;
1127 bool iszero()
const;
1210 return operator + (u, (
unsigned long)v);
1221 return operator + ((
unsigned long)u, v);
1233 return operator += ((
long)v);
1236 operator += (
unsigned int v)
1238 return operator += ((
unsigned long)v);
1278 return operator -= ((
long)v);
1281 operator -= (
unsigned int v)
1283 return operator -= ((
unsigned long)v);
1306 return operator * (u, (
unsigned long)v);
1317 return operator * ((
unsigned long)u, v);
1326 const sc_unsigned &operator *= (
int v) {
return operator *= ((
long)v); }
1328 operator *= (
unsigned int v)
1330 return operator *= ((
unsigned long)v);
1355 return operator / (u, (
unsigned long)v);
1366 return operator / ((
unsigned long)u, v);
1375 const sc_unsigned &operator /= (
int v) {
return operator /= ((
long)v); }
1377 operator /= (
unsigned int v)
1379 return operator /= ((
unsigned long)v);
1404 return operator % (u, (
unsigned long)v);
1415 return operator % ((
unsigned long)u, v);
1424 const sc_unsigned &operator %= (
int v) {
return operator %= ((
long)v); }
1426 operator %= (
unsigned int v)
1428 return operator %= ((
unsigned long)v);
1455 return operator & (u, (
unsigned long)v);
1466 return operator & ((
unsigned long)u, v);
1477 operator &= (
unsigned int v)
1479 return operator &= ((
unsigned long)v);
1504 return operator | (u, (
unsigned long)v);
1515 return operator | ((
unsigned long)u, v);
1526 operator |= (
unsigned int v)
1528 return operator |= ((
unsigned long)v);
1553 return operator ^ (u, (
unsigned long)v);
1564 return operator ^ ((
unsigned long)u, v);
1576 return operator ^= ((
long)v);
1579 operator ^= (
unsigned int v)
1581 return operator ^= ((
unsigned long)v);
1622 const sc_unsigned &operator <<= (
int v) {
return operator <<= ((
long)v); }
1624 operator <<= (
unsigned int v)
1626 return operator <<= ((
unsigned long)v);
1649 return operator >> (u, (
long)v);
1654 return operator >> (u, (
unsigned long)v);
1663 const sc_unsigned &operator >>= (
int v) {
return operator >>= ((
long)v); }
1665 operator >>= (
unsigned int v)
1667 return operator >>= ((
unsigned long)v);
1733 return operator != (u, (
long)v);
1738 return operator != (u, (
unsigned long)v);
1748 return operator != ((
long)u, v);
1753 return operator != ((
unsigned long)u, v);
1768 friend bool operator < (
const sc_unsigned &u,
long v);
1769 friend bool operator < (
const sc_unsigned &u,
unsigned long v);
1773 return operator < (u, (
long)v);
1778 return operator < (u, (
unsigned long)v);
1783 friend bool operator < (
long u,
const sc_unsigned &v);
1784 friend bool operator < (
unsigned long u,
const sc_unsigned &v);
1788 return operator < ((
long)u, v);
1793 return operator < ((
unsigned long)u, v);
1813 return operator <= (u, (
long)v);
1816 operator <= (
const sc_unsigned &u,
unsigned int v)
1818 return operator <= (u, (
unsigned long)v);
1828 return operator <= ((
long)u, v);
1831 operator <= (
unsigned int u,
const sc_unsigned &v)
1833 return operator <= ((
unsigned long)u, v);
1853 return operator > (u, (
long)v);
1858 return operator > (u, (
unsigned long)v);
1868 return operator > ((
long)u, v);
1873 return operator > ((
unsigned long)u, v);
1893 return operator >= (u, (
long)v);
1898 return operator >= (u, (
unsigned long)v);
1908 return operator >= ((
long)u, v);
1913 return operator >= ((
unsigned long)u, v);
1940 int vnb,
int vnd,
const sc_digit *vd);
1944 int vnb,
int vnd,
const sc_digit *vd);
1948 int vnb,
int vnd,
const sc_digit *vd);
2022inline ::std::ostream &
operator << (::std::ostream &,
const sc_unsigned &);
2024inline ::std::istream &operator >> (::std::istream &, sc_unsigned &);
2036inline ::std::ostream &
2051inline const sc_unsigned_subref &
2055 a->to_sc_unsigned(temp);
2056 return *
this = temp;
2059inline ::std::istream &
2076sc_unsigned_subref_r::and_reduce()
const
2079 for (
int i = m_right; i <= m_left; i++)
2080 if (!target_p->
test(i))
2086sc_unsigned_subref_r::nand_reduce()
const
2092sc_unsigned_subref_r::or_reduce()
const
2095 for (
int i = m_right; i <= m_left; i++)
2096 if (target_p->
test(i))
2102sc_unsigned_subref_r::nor_reduce()
const
2108sc_unsigned_subref_r::xor_reduce()
const
2113 for (
int i = m_right; i <= m_left; i++)
2114 if (target_p->
test(i)) odd = ~odd;
2115 return odd ? true :
false;
2118inline bool sc_unsigned_subref_r::xnor_reduce()
const {
return !
xor_reduce(); }
2120inline ::std::ostream &
2136inline const sc_unsigned_subref &
2137sc_unsigned_subref::operator = (
const char *
a)
2140 return (*
this = aa =
a);
2144inline ::std::istream &
2161 int nb = v->length();
2162 sgn = default_sign();
2164 nbits = num_bits(nb);
2166 invalid_init(
"sc_generic_base<T>", nb);
2176 v->to_sc_unsigned(*
this);
2179inline ::std::ostream &
2186inline ::std::istream &
bool operator==(const arr_struct1 &, const arr_struct1 &)
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
void initialize(const sc_unsigned *obj_p, int index_)
virtual int concat_length(bool *xz_present_p) const
sc_unsigned_bitref_r(const sc_unsigned_bitref_r &a)
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
void print(::std::ostream &os=::std::cout) const
virtual ~sc_unsigned_bitref_r()
virtual uint64 concat_get_uint64() const
virtual void concat_set(const sc_unsigned &src, int low_i)
sc_unsigned_bitref(const sc_unsigned_bitref &a)
virtual void concat_set(const sc_signed &src, int low_i)
virtual void concat_set(int64 src, int low_i)
static sc_core::sc_vpool< sc_unsigned_bitref > m_pool
void scan(::std::istream &is=::std::cin)
virtual void concat_set(uint64 src, int low_i)
unsigned long to_ulong() const
const std::string to_string(sc_numrep numrep=SC_DEC) const
const std::string to_string(sc_numrep numrep, bool w_prefix) const
friend class sc_unsigned_signal
virtual int concat_length(bool *xz_present_p) const
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
virtual ~sc_unsigned_subref_r()
sc_unsigned_subref_r(const sc_unsigned_subref_r &a)
virtual uint64 concat_get_uint64() const
unsigned int to_uint() const
void initialize(const sc_unsigned *obj_p, int left_, int right_)
void print(::std::ostream &os=::std::cout) const
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
virtual void concat_set(uint64 src, int low_i)
sc_unsigned_subref(const sc_unsigned_subref &a)
virtual void concat_set(const sc_signed &src, int low_i)
static sc_core::sc_vpool< sc_unsigned_subref > m_pool
void scan(::std::istream &is=::std::cin)
virtual void concat_set(int64 src, int low_i)
virtual void concat_set(const sc_unsigned &src, int low_i)
void check_range(int l, int r) const
sc_digit * get_raw() const
const sc_unsigned & operator|=(int v)
sc_unsigned(const sc_unsigned &v)
friend sc_unsigned div_unsigned_friend(small_type s, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
const sc_unsigned_subref_r & range(int i, int j) const
unsigned long to_ulong() const
unsigned int to_uint() const
friend sc_unsigned add_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
small_type default_sign() const
sc_unsigned(const sc_unsigned &v, small_type s)
void copy_digits(int nb, int nd, const sc_digit *d)
sc_unsigned(const sc_signed &v, small_type s)
friend class sc_concatref
sc_unsigned(const sc_unsigned_subref_r &v)
virtual int concat_length(bool *xz_present_p) const
sc_unsigned(const sc_int_subref_r &v)
friend class sc_unsigned_bitref_r
static sc_core::sc_vpool< sc_unsigned > m_pool
void convert_SM_to_2C_to_SM()
const sc_unsigned & operator&=(int v)
void check_index(int i) const
friend class sc_unsigned_subref
sc_unsigned(const sc_signed &v)
sc_unsigned(const sc_signed *u, int l, int r)
bool check_if_outside(int bit_num) const
sc_unsigned(const sc_uint_subref_r &v)
friend class sc_unsigned_subref_r
void dump(::std::ostream &os=::std::cout) const
void get_packed_rep(sc_digit *buf) const
void scan(::std::istream &is=::std::cin)
sc_unsigned(small_type s, int nb, int nd, sc_digit *d, bool alloc=true)
friend sc_unsigned mul_unsigned_friend(small_type s, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
const sc_unsigned_bitref_r & bit(int i) const
sc_unsigned_subref & range(int i, int j)
sc_unsigned_bitref & bit(int i)
sc_unsigned(int nb=sc_length_param().len())
friend class sc_unsigned_bitref
friend sc_unsigned and_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_unsigned(const sc_signed_subref_r &v)
void print(::std::ostream &os=::std::cout) const
friend sc_unsigned mod_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
sc_unsigned(const sc_unsigned *u, int l, int r)
friend sc_unsigned or_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
friend sc_unsigned xor_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
friend sc_unsigned sub_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
void set_packed_rep(sc_digit *buf)
friend class sc_signed_subref_r
sc_unsigned(const sc_bv_base &v)
friend class sc_signed_subref
int num_bits(int nb) const
sc_unsigned(const sc_lv_base &v)
void copy_digits_unsigned(small_type &us, int unb, int und, sc_digit *ud, int, int vnd, const sc_digit *vd)
sc_unsigned div_unsigned_friend(small_type s, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
sc_proxy< X >::value_type or_reduce(const sc_proxy< X > &a)
sc_unsigned sub_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_proxy< X >::value_type xor_reduce(const sc_proxy< X > &a)
sc_numrep sc_io_base(::std::ostream &os, sc_numrep def_base)
sc_unsigned mod_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
small_type convert_unsigned_2C_to_SM(int nb, int nd, sc_digit *d)
small_type convert_unsigned_SM_to_2C_to_SM(small_type s, int nb, int nd, sc_digit *d)
small_type make_zero(int nd, sc_digit *d)
sc_unsigned or_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_unsigned mul_unsigned_friend(small_type s, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
sc_proxy< X >::value_type nor_reduce(const sc_proxy< X > &a)
int compare_unsigned(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd, small_type if_u_signed, small_type if_v_signed)
sc_unsigned and_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_unsigned xor_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_unsigned add_unsigned_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
const std::string to_string(sc_enc enc)
sc_proxy< X >::value_type and_reduce(const sc_proxy< X > &a)
void convert_unsigned_SM_to_2C(small_type s, int nd, sc_digit *d)
sc_proxy< X >::value_type xnor_reduce(const sc_proxy< X > &a)
sc_proxy< X >::value_type nand_reduce(const sc_proxy< X > &a)
std::ostream & operator<<(std::ostream &os, gem5::RiscvISA::PrivilegeMode pm)