Go to the documentation of this file.
69 #ifndef __SYSTEMC_EXT_DT_INT_SC_UINT_BASE_HH__
70 #define __SYSTEMC_EXT_DT_INT_SC_UINT_BASE_HH__
74 #include "../fx/scfx_ieee.hh"
75 #include "../misc/sc_value_base.hh"
76 #include "../sc_temporary.hh"
86 class sc_uint_bitref_r;
88 class sc_uint_subref_r;
95 class sc_int_subref_r;
96 class sc_signed_subref_r;
97 class sc_unsigned_subref_r;
111 extern template class sc_vpool<sc_dt::sc_uint_bitref>;
112 extern template class sc_vpool<sc_dt::sc_uint_subref>;
122 inline bool operator == (
const sc_uint_base &
a,
const sc_uint_base &
b);
123 inline bool operator != (
const sc_uint_base &
a,
const sc_uint_base &
b);
124 inline bool operator < (
const sc_uint_base &
a,
const sc_uint_base &
b);
125 inline bool operator <= (
const sc_uint_base &
a,
const sc_uint_base &
b);
126 inline bool operator > (
const sc_uint_base &
a,
const sc_uint_base &
b);
127 inline bool operator >= (
const sc_uint_base &
a,
const sc_uint_base &
b);
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;
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);
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;
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);
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;
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;
779 sc_uint_bitref &operator [] (
int i);
780 const sc_uint_bitref_r &operator [] (
int i)
const;
782 sc_uint_bitref &bit(
int i);
783 const sc_uint_bitref_r &bit(
int i)
const;
786 sc_uint_subref &operator () (
int left,
int right);
787 const sc_uint_subref_r &operator () (
int left,
int right)
const;
789 sc_uint_subref &range(
int left,
int right);
790 const sc_uint_subref_r &range(
int left,
int right)
const;
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; }
857 void scan(::std::istream &
is=::std::cin);
877 inline sc_uint_bitref_r::operator
uint64 ()
const
879 return m_obj_p->test(m_index);
883 sc_uint_bitref_r::operator ! ()
const
885 return !m_obj_p->test(m_index);
891 return !m_obj_p->test(m_index);
894 inline ::std::ostream &
910 inline sc_uint_bitref &
913 m_obj_p->set(m_index,
b.to_bool());
920 m_obj_p->set(m_index,
b.to_bool());
925 sc_uint_bitref::operator = (
bool b)
927 m_obj_p->set(m_index,
b);
935 m_obj_p->set(m_index,
b);
944 m_obj_p->set(m_index,
b);
953 m_obj_p->m_val ^= (
UINT_ONE << m_index);
958 inline ::std::istream &
987 return a.and_reduce();
993 return a.or_reduce();
999 return a.xor_reduce();
1004 sc_uint_subref_r::to_int()
const
1010 sc_uint_subref_r::to_uint()
const
1016 sc_uint_subref_r::to_long()
const
1021 inline unsigned long
1022 sc_uint_subref_r::to_ulong()
const
1025 return a.to_ulong();
1028 sc_uint_subref_r::to_int64()
const
1031 return a.to_int64();
1034 sc_uint_subref_r::to_uint64()
const
1037 return a.to_uint64();
1040 sc_uint_subref_r::to_double()
const
1043 return a.to_double();
1047 inline const std::string
1051 return a.to_string(numrep);
1054 inline const std::string
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();
1093 inline ::std::ostream &
1109 inline sc_uint_subref &
1116 sc_uint_subref::operator = (
const char *
a)
1119 return (*
this =
aa =
a);
1122 inline ::std::istream &
1137 inline sc_uint_bitref &
1138 sc_uint_base::operator [] (
int i)
1147 sc_uint_base::operator [] (
int i)
const
1156 sc_uint_base::bit(
int i)
1165 sc_uint_base::bit(
int i)
const
1175 sc_uint_base::operator () (
int left,
int right)
1177 check_range(left, right);
1184 sc_uint_base::operator () (
int left,
int right)
const
1186 check_range(left, right);
1193 sc_uint_base::range(
int left,
int right)
1195 check_range(left, right);
1202 sc_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();
1242 inline ::std::ostream &
1249 inline ::std::istream &
1258 #endif // __SYSTEMC_EXT_DT_INT_SC_UINT_BASE_HH__
const FlagsType init
This Stat is Initialized.
friend class sc_uint_base
sc_uint_base(const sc_generic_base< T > &a)
bool to_bool(const std::string &value, bool &retval)
Turn a string representation of a boolean into a boolean value.
virtual ~sc_uint_subref_r()
sc_uint_base(const sc_uint_base &a)
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
X & operator|=(sc_proxy< X > &px, const sc_proxy< Y > &py)
sc_uint_bitref_r(const sc_uint_bitref_r &init)
virtual int concat_length(bool *xz_present_p) const
double uint64_to_double(uint64 a)
inline ::std::istream & operator>>(::std::istream &, sc_uint_base &)
void print(::std::ostream &os=::std::cout) const
void initialize(const sc_uint_base *obj_p, int index_)
bool operator<(const sc_uint_base &a, const sc_uint_base &b)
const std::string to_string(sc_enc enc)
virtual uint64 concat_get_uint64() const
friend class sc_uint_signal
X & operator&=(sc_proxy< X > &px, const sc_proxy< Y > &py)
inline ::std::ostream & operator<<(::std::ostream &, const sc_uint_base &)
void print(::std::ostream &os=::std::cout) const
bool sc_io_show_base(::std::ostream &os)
static const uint64 UINT_ONE
bool operator!=(const sc_uint_base &a, const sc_uint_base &b)
void check_index(int i) const
sc_uint_subref_r(const sc_uint_subref_r &init)
friend class sc_uint_subref_r
unsigned long to_ulong() const
sc_uint_base(const sc_uint_subref_r &a)
bool operator>=(const sc_uint_base &a, const sc_uint_base &b)
friend class sc_uint_subref
bool and_reduce(const sc_uint_base &a)
sc_uint_base(int w=sc_length_param().len())
void check_range(int l, int r) const
sc_uint_bitref(const sc_uint_bitref &init)
sc_numrep sc_io_base(::std::ostream &os, sc_numrep def_base)
static const uint64 UINT64_32ONES
friend class sc_uint_base
bool nand_reduce(const sc_uint_base &a)
sc_uint_subref(const sc_uint_subref &init)
bool or_reduce(const sc_uint_base &a)
virtual ~sc_uint_bitref_r()
virtual uint64 concat_get_uint64() const
unsigned int to_uint() const
void check_length() const
virtual int concat_length(bool *xz_present_p) const
friend class sc_uint_base
friend class sc_uint_subref
friend class sc_uint_bitref_r
static sc_core::sc_vpool< sc_uint_bitref > m_pool
bool operator<=(const sc_uint_base &a, const sc_uint_base &b)
static sc_core::sc_vpool< sc_uint_subref > m_pool
bool operator==(const sc_uint_base &a, const sc_uint_base &b)
friend class sc_uint_base
bool xnor_reduce(const sc_uint_base &a)
sc_uint_base(uint_type v, int w)
bool xor_reduce(const sc_uint_base &a)
X & operator^=(sc_proxy< X > &px, const sc_proxy< Y > &py)
static const uint64 UINT_ZERO
const sc_bit operator~(const sc_bit &a)
const uint_type mask_int[SC_INTWIDTH][SC_INTWIDTH]
virtual uint64 concat_get_uint64() const
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
void initialize(const sc_uint_base *obj_p, int left_i, int right_i)
virtual int concat_length(bool *xz_present_p) const
bool operator>(const sc_uint_base &a, const sc_uint_base &b)
bool nor_reduce(const sc_uint_base &a)
friend class sc_uint_bitref
void print(::std::ostream &os=::std::cout) const
Generated on Wed Sep 30 2020 14:02:16 for gem5 by doxygen 1.8.17