69#ifndef __SYSTEMC_EXT_DT_INT_SC_INT_BASE_HH__
70#define __SYSTEMC_EXT_DT_INT_SC_INT_BASE_HH__
91class sc_signed_subref_r;
92class sc_unsigned_subref_r;
110extern template class sc_vpool<sc_dt::sc_int_bitref>;
111extern template class sc_vpool<sc_dt::sc_int_subref>;
124inline bool operator == (
const sc_int_base &
a,
const sc_int_base &
b);
125inline bool operator != (
const sc_int_base &
a,
const sc_int_base &
b);
126inline bool operator < (
const sc_int_base &
a,
const sc_int_base &
b);
127inline bool operator <= (
const sc_int_base &
a,
const sc_int_base &
b);
128inline bool operator > (
const sc_int_base &
a,
const sc_int_base &
b);
129inline bool operator >= (
const sc_int_base &
a,
const sc_int_base &
b);
165#ifdef SC_DT_DEPRECATED
166 int bitwidth()
const {
return length(); }
174 *xz_present_p =
false;
183 dst_p[word_i] &= ~bit_mask;
194 dst_p[word_i] |= bit_mask;
197 dst_p[word_i] &= ~bit_mask;
211 bool operator ! ()
const;
212 bool operator ~ ()
const;
222 void print(::std::ostream& os=::std::cout)
const { os << to_bool(); }
265 virtual void concat_set(
int64 src,
int low_i);
266 virtual void concat_set(
const sc_signed &src,
int low_i);
267 virtual void concat_set(
const sc_unsigned &src,
int low_i);
268 virtual void concat_set(
uint64 src,
int low_i);
271 void scan(::std::istream &is=::std::cin);
279inline ::std::istream &operator >> (::std::istream &,
sc_int_bitref &);
317 int length()
const {
return (m_left - m_right + 1); }
324 *xz_present_p =
false;
327 virtual bool concat_get_ctrl(
sc_digit* dst_p,
int low_i )
const;
328 virtual bool concat_get_data(
sc_digit* dst_p,
int low_i )
const;
356 unsigned int to_uint()
const;
357 long to_long()
const;
358 unsigned long to_ulong()
const;
359 int64 to_int64()
const;
361 double to_double()
const;
369 print(::std::ostream &os=::std::cout)
const
425 return operator = (
a->to_int64());
431 operator = (
unsigned long a)
443 operator = (
unsigned int a)
461 operator = (
double a)
472 virtual void concat_set(
int64 src,
int low_i);
473 virtual void concat_set(
const sc_signed &src,
int low_i);
474 virtual void concat_set(
const sc_unsigned &src,
int low_i);
475 virtual void concat_set(
uint64 src,
int low_i);
478 void scan(::std::istream &is=::std::cin);
485inline ::std::istream &operator >> (::std::istream &,
sc_int_subref &);
503 void invalid_length()
const;
504 void invalid_index(
int i)
const;
505 void invalid_range(
int l,
int r)
const;
518 if (i < 0 || i >= m_len) {
526 if (r < 0 || l >= m_len || l < r) {
531 void check_value()
const;
539 m_val = (m_val << m_ulen >> m_ulen);
570 m_val(
a->to_int64()), m_len(
a->length()), m_ulen(
SC_INTWIDTH - m_len)
617 m_val =
a->to_int64();
636 operator = (
unsigned long a)
652 operator = (
unsigned int a)
676 operator = (
double a)
808 return a.m_val ==
b.m_val;
814 return a.m_val !=
b.m_val;
820 return a.m_val <
b.m_val;
826 return a.m_val <=
b.m_val;
832 return a.m_val >
b.m_val;
838 return a.m_val >=
b.m_val;
859 bool test(
int i)
const {
return (0 != (m_val & (UINT_ONE << i))); }
861 void set(
int i) { m_val |= (UINT_ONE << i); }
866 v ? m_val |= (UINT_ONE << i) : m_val &= ~(UINT_ONE << i);
877 *xz_present_p =
false;
880 virtual bool concat_get_ctrl(
sc_digit* dst_p,
int low_i )
const;
881 virtual bool concat_get_data(
sc_digit* dst_p,
int low_i )
const;
890 virtual void concat_set(
int64 src,
int low_i);
891 virtual void concat_set(
const sc_signed &src,
int low_i);
892 virtual void concat_set(
const sc_unsigned &src,
int low_i);
893 virtual void concat_set(
uint64 src,
int low_i);
911 int to_int()
const {
return (
int)m_val; }
912 unsigned int to_uint()
const {
return (
unsigned int)m_val; }
914 unsigned long to_ulong()
const {
return (
unsigned long)m_val; }
918 long long_low()
const {
return (
long)(m_val & UINT64_32ONES); }
919 long long_high()
const {
return (
long)((m_val >> 32) & UINT64_32ONES); }
929 print(::std::ostream &os=::std::cout)
const
934 void scan(::std::istream &is=::std::cin);
943inline ::std::istream &operator >> (::std::istream &,
sc_int_base &);
954inline sc_int_bitref_r::operator
uint64 ()
const
956 return m_obj_p->test(m_index);
960sc_int_bitref_r::operator ! ()
const
962 return ! m_obj_p->test(m_index);
966sc_int_bitref_r::operator ~ ()
const
968 return !m_obj_p->test(m_index);
972inline ::std::ostream &
988inline sc_int_bitref &
991 m_obj_p->set(m_index, (
bool)
b);
992 m_obj_p->extend_sign();
999 m_obj_p->set(m_index, (
bool)
b);
1000 m_obj_p->extend_sign();
1005sc_int_bitref::operator = (
bool b)
1007 m_obj_p->set(m_index,
b);
1008 m_obj_p->extend_sign();
1014sc_int_bitref::operator &= (
bool b)
1017 m_obj_p->set(m_index,
b);
1018 m_obj_p->extend_sign();
1024sc_int_bitref::operator |= (
bool b)
1027 m_obj_p->set(m_index,
b);
1028 m_obj_p->extend_sign();
1034sc_int_bitref::operator ^= (
bool b)
1037 m_obj_p->m_val ^= (UINT_ONE << m_index);
1038 m_obj_p->extend_sign();
1045inline ::std::istream &
1065 int uright = uleft + m_right;
1066 return (val << uleft >> uright);
1073sc_int_subref_r::and_reduce()
const
1076 return a.and_reduce();
1080sc_int_subref_r::or_reduce()
const
1083 return a.or_reduce();
1087sc_int_subref_r::xor_reduce()
const
1090 return a.xor_reduce();
1097sc_int_subref_r::to_int()
const
1099 int result =
static_cast<int>(
operator uint_type());
1104sc_int_subref_r::to_uint()
const
1106 unsigned int result =
static_cast<unsigned int>(
operator uint_type());
1111sc_int_subref_r::to_long()
const
1113 long result =
static_cast<long>(
operator uint_type());
1118sc_int_subref_r::to_ulong()
const
1120 unsigned long result =
static_cast<unsigned long>(
operator uint_type());
1125sc_int_subref_r::to_int64()
const
1132sc_int_subref_r::to_uint64()
const
1139sc_int_subref_r::to_double()
const
1141 double result =
static_cast<double>(
operator uint_type());
1148inline const std::string
1153 return a.to_string(numrep);
1156inline const std::string
1157sc_int_subref_r::to_string(
sc_numrep numrep,
bool w_prefix)
const
1161 return a.to_string(numrep, w_prefix);
1170 return a.and_reduce();
1176 return a.nand_reduce();
1182 return a.or_reduce();
1188 return a.nor_reduce();
1194 return a.xor_reduce();
1200 return a.xnor_reduce();
1205inline ::std::ostream &
1221inline sc_int_subref &
1224 return operator = (
a.operator
int_type());
1228sc_int_subref::operator = (
const char *
a)
1231 return (*
this = aa =
a);
1236inline ::std::istream &
1252inline sc_int_bitref &
1253sc_int_base::operator [] (
int i)
1262sc_int_base::operator [] (
int i)
const
1272sc_int_base::bit(
int i)
1281sc_int_base::bit(
int i)
const
1293sc_int_base::operator () (
int left,
int right)
1295 check_range(left, right);
1302sc_int_base::operator () (
int left,
int right)
const
1304 check_range(left, right);
1312sc_int_base::range(
int left,
int right)
1314 check_range(left, right);
1321sc_int_base::range(
int left,
int right)
const
1323 check_range(left, right);
1335 return a.and_reduce();
1341 return a.nand_reduce();
1347 return a.or_reduce();
1353 return a.nor_reduce();
1359 return a.xor_reduce();
1365 return a.xnor_reduce();
1370inline ::std::ostream &
1377inline ::std::istream &
bool operator==(const arr_struct1 &, const arr_struct1 &)
sc_int_base(const sc_int_subref_r &a)
friend class sc_int_subref_r
virtual uint64 concat_get_uint64() const
void check_length() const
sc_int_base(int_type v, int w)
void check_index(int i) const
sc_int_base(const sc_int_base &a)
friend class sc_int_bitref
unsigned long to_ulong() const
virtual int concat_length(bool *xz_present_p) const
friend class sc_int_bitref_r
void check_range(int l, int r) const
unsigned int to_uint() const
void print(::std::ostream &os=::std::cout) const
sc_int_base(int w=sc_length_param().len())
friend class sc_int_subref
sc_int_base(const sc_generic_base< T > &a)
sc_int_bitref_r(const sc_int_bitref_r &a)
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
void initialize(const sc_int_base *obj_p, int index_)
virtual uint64 concat_get_uint64() const
void print(::std::ostream &os=::std::cout) const
virtual ~sc_int_bitref_r()
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
virtual int concat_length(bool *xz_present_p) const
static sc_core::sc_vpool< sc_int_bitref > m_pool
sc_int_bitref(const sc_int_bitref &a)
virtual ~sc_int_subref_r()
friend class sc_int_signal
virtual uint64 concat_get_uint64() const
void initialize(const sc_int_base *obj_p, int left_i, int right_i)
sc_int_subref_r(const sc_int_subref_r &a)
friend class sc_int_subref
void print(::std::ostream &os=::std::cout) const
virtual int concat_length(bool *xz_present_p) const
sc_int_subref(const sc_int_subref &a)
static sc_core::sc_vpool< sc_int_subref > m_pool
sc_proxy< X >::value_type or_reduce(const sc_proxy< X > &a)
sc_proxy< X >::value_type xor_reduce(const sc_proxy< X > &a)
sc_numrep sc_io_base(::std::ostream &os, sc_numrep def_base)
const uint_type mask_int[SC_INTWIDTH][SC_INTWIDTH]
sc_proxy< X >::value_type nor_reduce(const sc_proxy< X > &a)
const std::string to_string(sc_enc enc)
sc_proxy< X >::value_type and_reduce(const sc_proxy< X > &a)
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)