69#ifndef __SYSTEMC_EXT_DT_INT_SC_UINT_BASE_HH__
70#define __SYSTEMC_EXT_DT_INT_SC_UINT_BASE_HH__
86class sc_uint_bitref_r;
88class sc_uint_subref_r;
96class sc_signed_subref_r;
97class sc_unsigned_subref_r;
111extern template class sc_vpool<sc_dt::sc_uint_bitref>;
112extern template class sc_vpool<sc_dt::sc_uint_subref>;
122inline bool operator == (
const sc_uint_base &
a,
const sc_uint_base &
b);
123inline bool operator != (
const sc_uint_base &
a,
const sc_uint_base &
b);
124inline bool operator < (
const sc_uint_base &
a,
const sc_uint_base &
b);
125inline bool operator <= (
const sc_uint_base &
a,
const sc_uint_base &
b);
126inline bool operator > (
const sc_uint_base &
a,
const sc_uint_base &
b);
127inline bool operator >= (
const sc_uint_base &
a,
const sc_uint_base &
b);
144 sc_value_base(init), m_index(init.m_index), m_obj_p(init.m_obj_p)
167 *xz_present_p =
false;
176 dst_p[word_i] &= ~bit_mask;
187 dst_p[word_i] |= bit_mask;
190 dst_p[word_i] &= ~bit_mask;
202 bool operator ! ()
const;
203 bool operator ~ ()
const;
210 void print(::std::ostream &os=::std::cout)
const { os << to_bool(); }
254 virtual void concat_set(
int64 src,
int low_i);
255 virtual void concat_set(
const sc_signed &src,
int low_i);
256 virtual void concat_set(
const sc_unsigned &src,
int low_i);
257 virtual void concat_set(
uint64 src,
int low_i);
260 void scan(::std::istream &is=::std::cin);
266inline ::std::istream &operator >> (::std::istream &,
sc_uint_bitref &);
283 sc_value_base(init), m_left(init.m_left), m_obj_p(init.m_obj_p),
284 m_right(init.m_right)
304 int length()
const {
return (m_left - m_right + 1); }
311 *xz_present_p =
false;
314 virtual bool concat_get_ctrl(
sc_digit *dst_p,
int low_i)
const;
315 virtual bool concat_get_data(
sc_digit *dst_p,
int low_i)
const;
337 unsigned int to_uint()
const;
338 long to_long()
const;
339 unsigned long to_ulong()
const;
340 int64 to_int64()
const;
342 double to_double()
const;
350 print(::std::ostream &os=::std::cout)
const
405 return operator = (
a->to_uint64());
409 operator = (
unsigned long a)
419 operator = (
unsigned int a)
434 operator = (
double a)
444 virtual void concat_set(
int64 src,
int low_i);
445 virtual void concat_set(
const sc_signed &src,
int low_i);
446 virtual void concat_set(
const sc_unsigned &src,
int low_i);
447 virtual void concat_set(
uint64 src,
int low_i);
450 void scan(::std::istream &is=::std::cin);
456inline ::std::istream &operator >> (::std::istream &,
sc_uint_subref &);
473 void invalid_length()
const;
474 void invalid_index(
int i)
const;
475 void invalid_range(
int l,
int r)
const;
488 if (i < 0 || i >= m_len) {
496 if (r < 0 || l >= m_len || l < r) {
497 invalid_range( l, r );
501 void check_value()
const;
509 m_val &= (~UINT_ZERO >> m_ulen);
539 m_val(
a->to_uint64()), m_len(
a->length()),
583 m_val =
a->to_uint64();
597 operator = (
unsigned long a)
611 operator = (
unsigned int a)
632 operator = (
double a)
750 return a.m_val ==
b.m_val;
755 return a.m_val !=
b.m_val;
760 return a.m_val <
b.m_val;
765 return a.m_val <=
b.m_val;
770 return a.m_val >
b.m_val;
775 return a.m_val >=
b.m_val;
793 bool test(
int i)
const {
return (0 != (m_val & (UINT_ONE << i))); }
795 void set(
int i) { m_val |= (UINT_ONE << i); }
799 v ? m_val |= (UINT_ONE << i) : m_val &= ~(UINT_ONE << i);
810 *xz_present_p =
false;
813 virtual bool concat_get_ctrl(
sc_digit *dst_p,
int low_i)
const;
814 virtual bool concat_get_data(
sc_digit *dst_p,
int low_i)
const;
816 virtual void concat_set(
int64 src,
int low_i);
817 virtual void concat_set(
const sc_signed &src,
int low_i);
818 virtual void concat_set(
const sc_unsigned &src,
int low_i);
819 virtual void concat_set(
uint64 src,
int low_i);
835 int to_int()
const {
return (
int) m_val; }
836 unsigned int to_uint()
const {
return (
unsigned int)m_val; }
838 unsigned long to_ulong()
const {
return (
unsigned long)m_val; }
843 long long_low()
const {
return (
long)(m_val & UINT64_32ONES); }
844 long long_high()
const {
return (
long)((m_val >> 32) & UINT64_32ONES); }
852 print(::std::ostream &os=::std::cout)
const
857 void scan(::std::istream &is=::std::cin);
866inline ::std::istream &operator >> (::std::istream &,
sc_uint_base &);
877inline sc_uint_bitref_r::operator
uint64 ()
const
879 return m_obj_p->test(m_index);
883sc_uint_bitref_r::operator ! ()
const
885 return !m_obj_p->test(m_index);
889sc_uint_bitref_r::operator ~ ()
const
891 return !m_obj_p->test(m_index);
894inline ::std::ostream &
910inline sc_uint_bitref &
913 m_obj_p->set(m_index,
b.to_bool());
920 m_obj_p->set(m_index,
b.to_bool());
925sc_uint_bitref::operator = (
bool b)
927 m_obj_p->set(m_index,
b);
932sc_uint_bitref::operator &= (
bool b)
935 m_obj_p->set(m_index,
b);
941sc_uint_bitref::operator |= (
bool b)
944 m_obj_p->set(m_index,
b);
950sc_uint_bitref::operator ^= (
bool b)
953 m_obj_p->m_val ^= (UINT_ONE << m_index);
958inline ::std::istream &
978 return ((val & (~UINT_ZERO >> uleft)) >> m_right);
984sc_uint_subref_r::and_reduce()
const
987 return a.and_reduce();
990sc_uint_subref_r::or_reduce()
const
993 return a.or_reduce();
996sc_uint_subref_r::xor_reduce()
const
999 return a.xor_reduce();
1004sc_uint_subref_r::to_int()
const
1010sc_uint_subref_r::to_uint()
const
1016sc_uint_subref_r::to_long()
const
1022sc_uint_subref_r::to_ulong()
const
1025 return a.to_ulong();
1028sc_uint_subref_r::to_int64()
const
1031 return a.to_int64();
1034sc_uint_subref_r::to_uint64()
const
1037 return a.to_uint64();
1040sc_uint_subref_r::to_double()
const
1043 return a.to_double();
1047inline const std::string
1051 return a.to_string(numrep);
1054inline const std::string
1055sc_uint_subref_r::to_string(
sc_numrep numrep,
bool w_prefix)
const
1058 return a.to_string(numrep, w_prefix);
1065 return a.and_reduce();
1070 return a.nand_reduce();
1075 return a.or_reduce();
1080 return a.nor_reduce();
1085 return a.xor_reduce();
1090 return a.xnor_reduce();
1093inline ::std::ostream &
1109inline sc_uint_subref &
1116sc_uint_subref::operator = (
const char *
a)
1119 return (*
this = aa =
a);
1122inline ::std::istream &
1137inline sc_uint_bitref &
1138sc_uint_base::operator [] (
int i)
1147sc_uint_base::operator [] (
int i)
const
1156sc_uint_base::bit(
int i)
1165sc_uint_base::bit(
int i)
const
1175sc_uint_base::operator () (
int left,
int right)
1177 check_range(left, right);
1184sc_uint_base::operator () (
int left,
int right)
const
1186 check_range(left, right);
1193sc_uint_base::range(
int left,
int right)
1195 check_range(left, right);
1202sc_uint_base::range(
int left,
int right)
const
1204 check_range(left, right);
1214 return a.and_reduce();
1219 return a.nand_reduce();
1224 return a.or_reduce();
1229 return a.nor_reduce();
1234 return a.xor_reduce();
1239 return a.xnor_reduce();
1242inline ::std::ostream &
1249inline ::std::istream &
bool operator==(const arr_struct1 &, const arr_struct1 &)
sc_uint_base(const sc_uint_subref_r &a)
sc_uint_base(uint_type v, int w)
sc_uint_base(const sc_generic_base< T > &a)
unsigned long to_ulong() const
sc_uint_base(int w=sc_length_param().len())
void check_range(int l, int r) const
void check_length() const
void check_index(int i) const
friend class sc_uint_subref_r
void print(::std::ostream &os=::std::cout) const
virtual int concat_length(bool *xz_present_p) const
unsigned int to_uint() const
friend class sc_uint_bitref
friend class sc_uint_bitref_r
virtual uint64 concat_get_uint64() const
friend class sc_uint_subref
sc_uint_base(const sc_uint_base &a)
void print(::std::ostream &os=::std::cout) const
friend class sc_uint_base
virtual uint64 concat_get_uint64() const
virtual int concat_length(bool *xz_present_p) const
void initialize(const sc_uint_base *obj_p, int index_)
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
sc_uint_bitref_r(const sc_uint_bitref_r &init)
friend class sc_uint_signal
virtual ~sc_uint_bitref_r()
sc_uint_bitref(const sc_uint_bitref &init)
static sc_core::sc_vpool< sc_uint_bitref > m_pool
virtual int concat_length(bool *xz_present_p) const
void initialize(const sc_uint_base *obj_p, int left_i, int right_i)
friend class sc_uint_base
sc_uint_subref_r(const sc_uint_subref_r &init)
virtual uint64 concat_get_uint64() const
void print(::std::ostream &os=::std::cout) const
virtual ~sc_uint_subref_r()
friend class sc_uint_subref
sc_uint_subref(const sc_uint_subref &init)
static sc_core::sc_vpool< sc_uint_subref > m_pool
double uint64_to_double(uint64 a)
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)