92#ifndef __SYSTEMC_EXT_DT_INT_SC_SIGNED_HH__
93#define __SYSTEMC_EXT_DT_INT_SC_SIGNED_HH__
109class sc_signed_bitref_r;
110class sc_signed_bitref;
111class sc_signed_subref_r;
112class sc_signed_subref;
121class sc_int_subref_r;
122class sc_uint_subref_r;
125class sc_unsigned_subref_r;
137extern template class sc_vpool<sc_dt::sc_signed_bitref>;
138extern template class sc_vpool<sc_dt::sc_signed_subref>;
156 int vnb,
int vnd,
const sc_digit *vd);
160 int vnb,
int vnd,
const sc_digit *vd);
164 int vnb,
int vnd,
const sc_digit *vd);
550inline bool operator != (
const sc_signed &u,
int v);
551inline bool operator != (
const sc_signed &u,
unsigned int v);
557inline bool operator != (
int u,
const sc_signed &v);
558inline bool operator != (
unsigned int u,
const sc_signed &v);
572bool operator < (
const sc_signed &u,
long v);
573bool operator < (
const sc_signed &u,
unsigned long v);
574inline bool operator < (
const sc_signed &u,
int v);
575inline bool operator < (
const sc_signed &u,
unsigned int v);
579bool operator < (
long u,
const sc_signed &v);
580bool operator < (
unsigned long u,
const sc_signed &v);
581inline bool operator < (
int u,
const sc_signed &v);
582inline bool operator < (
unsigned int u,
const sc_signed &v);
598inline bool operator <= (
const sc_signed &u,
int v);
599inline bool operator <= (
const sc_signed &u,
unsigned int v);
605inline bool operator <= (
int u,
const sc_signed &v);
606inline bool operator <= (
unsigned int u,
const sc_signed &v);
622inline bool operator > (
const sc_signed &u,
int v);
623inline bool operator > (
const sc_signed &u,
unsigned int v);
629inline bool operator > (
int u,
const sc_signed &v);
630inline bool operator > (
unsigned int u,
const sc_signed &v);
646inline bool operator >= (
const sc_signed &u,
int v);
647inline bool operator >= (
const sc_signed &u,
unsigned int v);
653inline bool operator >= (
int u,
const sc_signed &v);
654inline bool operator >= (
unsigned int u,
const sc_signed &v);
699 bool operator ! ()
const;
700 bool operator ~ ()
const;
713 *xz_present_p =
false;
727 dst_p[word_i] &= ~bit_mask;
738 dst_p[word_i] |= bit_mask;
741 dst_p[word_i] &= ~bit_mask;
748 void print(::std::ostream &os=::std::cout)
const { os << to_bool(); }
799 void scan(::std::istream &is=::std::cin);
828 m_obj_p = (
const_cast<sc_signed*
>(obj_p));
847 return m_left >= m_right ? (m_left-m_right + 1) : (m_right-m_left + 1);
871 *xz_present_p =
false;
872 return m_left - m_right + 1;
888 print(::std::ostream &os=::std::cout)
const
937 a->to_sc_unsigned(temp);
938 return operator = (temp);
945 operator = (
unsigned int a)
947 return operator = ((
unsigned long)
a);
953 return operator = ((
long)
a);
969 void scan(::std::istream &is=::std::cin);
997 void invalid_init(
const char *type_name,
int nb)
const;
1021 a->to_sc_signed(*
this);
1028 const sc_signed &operator = (
const char *v);
1032 const sc_signed &operator = (
unsigned long v);
1037 operator = (
unsigned int v)
1039 return operator=((
unsigned long)v);
1068 *xz_present_p =
false;
1071 virtual bool concat_get_ctrl(
sc_digit *dst_p,
int low_i)
const;
1072 virtual bool concat_get_data(
sc_digit *dst_p,
int low_i)
const;
1073 virtual uint64 concat_get_uint64()
const;
1074 virtual void concat_set(
int64 src,
int low_i);
1075 virtual void concat_set(
const sc_signed &src,
int low_i);
1076 virtual void concat_set(
const sc_unsigned &src,
int low_i);
1077 virtual void concat_set(
uint64 src,
int low_i);
1091 if (i < 0 || i >= nbits)
1095 void invalid_index(
int i)
const;
1107 operator [] (
int i)
const
1148 if (l < 0 || r >= nbits)
1149 invalid_range(l, r);
1151 if (r < 0 || l >= nbits)
1152 invalid_range(l, r);
1156 void invalid_range(
int l,
int r)
const;
1177 operator () (
int i,
int j)
1186 operator () (
int i,
int j)
const
1212 print(::std::ostream &os=::std::cout)
const
1217 void scan(::std::istream &is=::std::cin);
1219 void dump(::std::ostream &os=::std::cout)
const;
1223 bool iszero()
const;
1301 return operator + (u, (
long)v);
1309 return operator + ((
long)u, v);
1320 return operator + (u, (
long)v);
1325 return operator + (u, (
unsigned long)v);
1335 return operator + ((
long)u, v);
1340 return operator + ((
unsigned long)u, v);
1352 return operator += ((
long)v);
1355 operator += (
unsigned int v)
1357 return operator += ((
unsigned long)v);
1381 return operator - (u, (
long)v);
1386 return operator - (u, (
unsigned long)v);
1396 return operator - ((
long)u, v);
1401 return operator - ((
unsigned long)u, v);
1412 return operator - (u, (
long) v);
1417 return operator - (u, (
unsigned long)v);
1427 return operator - ((
long)u, v);
1432 return operator - ((
unsigned long)u, v);
1444 return operator -= ((
long)v);
1447 operator -= (
unsigned int v)
1449 return operator -= ((
unsigned long)v);
1472 return operator * (u, (
long)v);
1480 return operator * ((
long)u, v);
1491 return operator * (u, (
long)v);
1496 return operator * (u, (
unsigned long)v);
1506 return operator * ((
long)u, v);
1511 return operator * ((
unsigned long)u, v);
1523 return operator *= ((
long)v);
1526 operator *= (
unsigned int v)
1528 return operator *= ((
unsigned long)v);
1549 return operator / (u, (
long)v);
1557 return operator / ((
long)u, v);
1568 return operator / (u, (
long)v);
1573 return operator / (u, (
unsigned long)v);
1583 return operator / ((
long)u, v);
1588 return operator / ((
unsigned long)u, v);
1600 return operator /= ((
long)v);
1603 operator /= (
unsigned int v)
1605 return operator /= ((
unsigned long)v);
1626 return operator % (u, (
long)v);
1634 return operator % ((
long)u, v);
1645 return operator % (u, (
long)v);
1650 return operator % (u, (
unsigned long)v);
1660 return operator % ((
long)u, v);
1665 return operator % ((
unsigned long) u, v);
1677 return operator %= ((
long)v);
1680 operator %= (
unsigned int v)
1682 return operator %= ((
unsigned long)v);
1705 return operator & (u, (
long)v);
1713 return operator & ((
long) u, v);
1724 return operator & (u, (
long)v);
1729 return operator & (u, (
unsigned long)v);
1737 {
return operator&((
long) u, v); }
1739 {
return operator&((
unsigned long) u, v); }
1750 return operator &= ((
long) v);
1753 operator &= (
unsigned int v)
1755 return operator &= ((
unsigned long) v);
1776 return operator | (u, (
long)v);
1784 return operator | ((
long)u, v);
1795 return operator | (u, (
long)v);
1800 return operator | (u, (
unsigned long)v);
1810 return operator | ((
long) u, v);
1815 return operator | ((
unsigned long)u, v);
1827 return operator |= ((
long)v);
1830 operator |= (
unsigned int v)
1832 return operator |= ((
unsigned long)v);
1853 return operator ^ (u, (
long)v);
1861 return operator ^ ((
long)u, v);
1872 return operator ^ (u, (
long)v);
1877 return operator ^ (u, (
unsigned long)v);
1887 return operator ^ ((
long)u, v);
1892 return operator ^ ((
unsigned long)u, v);
1904 return operator ^= ((
long)v);
1907 operator ^= (
unsigned int v)
1909 return operator ^= ((
unsigned long)v);
1950 operator <<= (
int v)
1952 return operator <<= ((
long)v);
1955 operator <<= (
unsigned int v)
1957 return operator <<= ((
unsigned long)v);
1977 return operator >> (u, (
long)v);
1982 return operator >> (u, (
unsigned long) v);
1992 operator >>= (
int v)
1994 return operator >>= ((
long)v);
1997 operator >>= (
unsigned int v)
1999 return operator >>= ((
unsigned long)v);
2062 friend bool operator != (
const sc_signed &u,
unsigned long v);
2066 return operator != (u, (
long)v);
2071 return operator != (u, (
unsigned long)v);
2077 friend bool operator != (
unsigned long u,
const sc_signed &v);
2081 return operator != ((
long)u, v);
2086 return operator != ((
unsigned long)u, v);
2101 friend bool operator < (
const sc_signed &u,
long v);
2102 friend bool operator < (
const sc_signed &u,
unsigned long v);
2104 {
return operator<(u, (
long) v); }
2106 {
return operator<(u, (
unsigned long) v); }
2110 friend bool operator < (
long u,
const sc_signed &v);
2111 friend bool operator < (
unsigned long u,
const sc_signed &v);
2115 return operator < ((
long)u, v);
2118 operator < (
unsigned int u,
const sc_signed &v)
2120 return operator < ((
unsigned long)u, v);
2136 friend bool operator <= (
const sc_signed &u,
unsigned long v);
2140 return operator <= (u, (
long)v);
2143 operator <= (
const sc_signed &u,
unsigned int v)
2145 return operator <= (u, (
unsigned long)v);
2151 friend bool operator <= (
unsigned long u,
const sc_signed &v);
2155 return operator <= ((
long)u, v);
2158 operator <= (
unsigned int u,
const sc_signed &v)
2160 return operator <= ((
unsigned long)u, v);
2176 friend bool operator > (
const sc_signed &u,
unsigned long v);
2180 return operator > (u, (
long)v);
2185 return operator > (u, (
unsigned long)v);
2191 friend bool operator > (
unsigned long u,
const sc_signed &v);
2195 return operator > ((
long)u, v);
2200 return operator > ((
unsigned long)u, v);
2216 friend bool operator >= (
const sc_signed &u,
unsigned long v);
2220 return operator >= (u, (
long)v);
2225 return operator >= (u, (
unsigned long)v);
2231 friend bool operator >= (
unsigned long u,
const sc_signed &v);
2235 return operator >= ((
long)u, v);
2240 return operator >= ((
unsigned long)u, v);
2262 int vnb,
int vnd,
const sc_digit *vd);
2266 int vnb,
int vnd,
const sc_digit *vd);
2270 int vnb,
int vnd,
const sc_digit *vd);
2346inline ::std::ostream &
operator << (::std::ostream &,
const sc_signed &);
2348inline ::std::istream &operator >> (::std::istream &, sc_signed &);
2350inline ::std::ostream &
2358inline ::std::istream &
2376sc_signed_subref_r::and_reduce()
const
2379 for (
int i = m_right; i <= m_left; i++)
2380 if (!target_p->
test(i))
2386sc_signed_subref_r::nand_reduce()
const
2392sc_signed_subref_r::or_reduce()
const
2395 for (
int i = m_right; i <= m_left; i++)
2396 if (target_p->
test(i))
2402sc_signed_subref_r::nor_reduce()
const
2408sc_signed_subref_r::xor_reduce()
const
2413 for (
int i = m_right; i <= m_left; i++)
2414 if (target_p->
test(i)) odd = ~odd;
2415 return odd ? true :
false;
2419sc_signed_subref_r::xnor_reduce()
const
2424inline ::std::ostream &
2440inline const sc_signed_subref &
2441sc_signed_subref::operator = (
const char *
a)
2444 return (*
this = aa =
a);
2450inline ::std::istream &
2468 int nb = v->length();
2469 sgn = default_sign();
2471 nbits = num_bits(nb);
2473 invalid_init(
"sc_generic_base<T>", nb);
2483 v->to_sc_signed(*
this);
2488inline ::std::ostream &
2495inline ::std::istream &
bool operator==(const arr_struct1 &, const arr_struct1 &)
virtual ~sc_signed_bitref_r()
virtual int concat_length(bool *xz_present_p) const
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
void initialize(const sc_signed *obj_p, int index_)
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
sc_signed_bitref_r(const sc_signed_bitref_r &a)
virtual uint64 concat_get_uint64() const
void print(::std::ostream &os=::std::cout) const
virtual void concat_set(uint64 src, int low_i)
virtual void concat_set(int64 src, int low_i)
static sc_core::sc_vpool< sc_signed_bitref > m_pool
sc_signed_bitref(const sc_signed_bitref &a)
void scan(::std::istream &is=::std::cin)
virtual void concat_set(const sc_signed &src, int low_i)
virtual void concat_set(const sc_unsigned &src, int low_i)
virtual int concat_length(bool *xz_present_p) const
unsigned long to_ulong() const
virtual uint64 concat_get_uint64() const
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
const std::string to_string(sc_numrep numrep=SC_DEC) const
const std::string to_string(sc_numrep numrep, bool w_prefix) const
void initialize(const sc_signed *obj_p, int left_, int right_)
virtual ~sc_signed_subref_r()
void print(::std::ostream &os=::std::cout) const
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
unsigned int to_uint() const
sc_signed_subref_r(const sc_signed_subref_r &a)
friend class sc_signed_signal
virtual void concat_set(const sc_unsigned &src, int low_i)
virtual void concat_set(uint64 src, int low_i)
virtual void concat_set(const sc_signed &src, int low_i)
void scan(::std::istream &is=::std::cin)
sc_signed_subref(const sc_signed_subref &a)
static sc_core::sc_vpool< sc_signed_subref > m_pool
virtual void concat_set(int64 src, int low_i)
void check_range(int l, int r) const
sc_signed(const sc_signed &v)
void convert_SM_to_2C_to_SM()
int num_bits(int nb) const
void copy_digits(int nb, int nd, const sc_digit *d)
friend class sc_signed_bitref_r
bool check_if_outside(int bit_num) const
sc_signed(const sc_int_subref_r &v)
void print(::std::ostream &os=::std::cout) const
friend sc_signed sub_signed_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_signed(const sc_signed_subref_r &v)
sc_signed_subref & range(int i, int j)
friend sc_signed div_signed_friend(small_type s, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
friend class sc_signed_bitref
unsigned int to_uint() const
const sc_signed_subref_r & range(int i, int j) const
small_type default_sign() const
friend sc_signed mul_signed_friend(small_type s, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
friend sc_signed mod_signed_friend(small_type us, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
sc_signed(const sc_uint_subref_r &v)
friend class sc_concatref
void set_packed_rep(sc_digit *buf)
sc_signed(const sc_unsigned *u, int l, int r)
const sc_signed & operator=(int v)
sc_signed(const sc_bv_base &v)
sc_signed(const sc_unsigned_subref_r &v)
virtual int concat_length(bool *xz_present_p) const
unsigned long to_ulong() const
sc_signed(small_type s, int nb, int nd, sc_digit *d, bool alloc=true)
friend class sc_unsigned_subref
friend sc_signed or_signed_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
const sc_signed_bitref_r & bit(int i) const
sc_signed(const sc_signed &v, small_type s)
void scan(::std::istream &is=::std::cin)
void dump(::std::ostream &os=::std::cout) const
friend sc_signed and_signed_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_signed(const sc_lv_base &v)
friend sc_signed add_signed_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_signed(const sc_unsigned &v)
sc_digit * get_raw() const
friend sc_signed xor_signed_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
void get_packed_rep(sc_digit *buf) const
sc_signed(int nb=sc_length_param().len())
friend class sc_signed_subref_r
friend class sc_signed_subref
void check_index(int i) const
sc_signed(const sc_signed *u, int l, int r)
sc_signed_bitref & bit(int i)
sc_signed(const sc_unsigned &v, small_type s)
small_type convert_signed_2C_to_SM(int nb, int nd, sc_digit *d)
sc_signed xor_signed_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 or_reduce(const sc_proxy< X > &a)
sc_signed and_signed_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_signed add_signed_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
void convert_signed_SM_to_2C(small_type s, int nd, sc_digit *d)
small_type convert_signed_SM_to_2C_to_SM(small_type s, int nb, int nd, sc_digit *d)
sc_signed div_signed_friend(small_type s, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
small_type make_zero(int nd, sc_digit *d)
sc_signed mul_signed_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)
sc_signed sub_signed_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)
sc_signed mod_signed_friend(small_type us, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
sc_signed or_signed_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 xnor_reduce(const sc_proxy< X > &a)
sc_proxy< X >::value_type nand_reduce(const sc_proxy< X > &a)
void copy_digits_signed(small_type &us, int unb, int und, sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
std::ostream & operator<<(std::ostream &os, gem5::RiscvISA::PrivilegeMode pm)