Go to the documentation of this file.
77 #ifndef __SYSTEMC_EXT_DT_MISC_SC_CONCATREF_HH__
78 #define __SYSTEMC_EXT_DT_MISC_SC_CONCATREF_HH__
82 #include "../bit/sc_bv.hh"
83 #include "../bit/sc_lv.hh"
84 #include "../int/sc_int_base.hh"
85 #include "../int/sc_signed.hh"
86 #include "../int/sc_uint_base.hh"
87 #include "../int/sc_unsigned.hh"
88 #include "../sc_temporary.hh"
134 m_flags = (left_xz || right_xz) ? cf_xz_present : cf_none;
148 m_flags = (left_xz || right_xz) ? cf_xz_present : cf_none;
155 unsigned int length()
const {
return m_len; }
162 *xz_present_p = m_flags & cf_xz_present ? true :
false;
169 m_left_p->concat_clear_data(to_ones);
170 m_right_p->concat_clear_data(to_ones);
176 bool rnz = m_right_p->concat_get_ctrl(dst_p, low_i);
177 bool lnz = m_left_p->concat_get_ctrl(dst_p, low_i + m_len_r);
184 bool rnz = m_right_p->concat_get_data(dst_p, low_i);
185 bool lnz = m_left_p->concat_get_data(dst_p, low_i + m_len_r);
193 return m_right_p->concat_get_uint64();
195 return (m_left_p->concat_get_uint64() << m_len_r) |
196 m_right_p->concat_get_uint64();
203 m_right_p->concat_set(src, low_i);
204 m_left_p->concat_set(src, low_i + m_len_r);
210 m_right_p->concat_set(src, low_i);
211 m_left_p->concat_set(src, low_i + m_len_r);
217 m_right_p->concat_set(src, low_i);
218 m_left_p->concat_set(src, low_i + m_len_r);
224 m_right_p->concat_set(src, low_i);
225 m_left_p->concat_set(src, low_i + m_len_r);
235 result = m_right_p->concat_get_uint64();
238 result = (m_left_p->concat_get_uint64() << m_len_r) |
239 (result & ~(
mask << m_len_r));
243 result = result & ~(
mask << m_len);
252 sc_unsigned *result_p = sc_unsigned::m_pool.allocate();
260 right_non_zero = m_right_p->concat_get_data(result_p->
digit, 0);
261 left_non_zero = m_left_p->concat_get_data(result_p->
digit, m_len_r);
262 if (left_non_zero || right_non_zero)
270 int to_int()
const {
return (
int)to_int64(); }
271 unsigned int to_uint()
const {
return (
unsigned int)to_uint64(); }
272 long to_long()
const {
return (
long)to_int64(); }
273 unsigned long to_ulong()
const {
return (
unsigned long)to_uint64(); }
274 double to_double()
const {
return value().to_double(); }
281 operator uint64 ()
const {
return to_uint64(); }
296 return value().to_string(numrep);
302 return value().to_string(numrep,w_prefix);
310 m_left_p->concat_set((
int64)
v, m_len_r);
318 m_left_p->concat_set((
int64)
v, m_len_r);
326 m_left_p->concat_set(
v, m_len_r);
331 operator = (
unsigned int v)
334 m_left_p->concat_set((
uint64)
v, m_len_r);
339 operator = (
unsigned long v)
342 m_left_p->concat_set((
uint64)
v, m_len_r);
350 m_left_p->concat_set(
v, m_len_r);
359 m_right_p->concat_set(temp, 0);
360 m_left_p->concat_set(temp, m_len_r);
368 m_left_p->concat_set(
v, m_len_r);
376 m_left_p->concat_set(
v, m_len_r);
381 operator = (
const char *v_p)
385 m_right_p->concat_set(
v, 0);
386 m_left_p->concat_set(
v, m_len_r);
395 m_right_p->concat_set(temp, 0);
396 m_left_p->concat_set(temp, m_len_r);
405 m_right_p->concat_set(
data, 0);
406 m_left_p->concat_set(
data, m_len_r);
419 void print(::std::ostream &
os=::std::cout)
const {
os << this->value(); }
448 sc_concatref() : m_left_p(0), m_right_p(0), m_len(0), m_len_r(0), m_flags()
467 inline const sc_unsigned
473 inline const sc_unsigned
479 inline const sc_unsigned
485 inline const sc_unsigned
491 inline const sc_unsigned
497 inline const sc_unsigned
503 inline const sc_unsigned
509 inline const sc_unsigned
515 inline const sc_unsigned
521 inline const sc_unsigned
527 inline const sc_unsigned
533 inline const sc_unsigned
540 inline ::std::ostream &
543 return os <<
v.value();
546 inline ::std::istream &
589 *xz_present_p =
false;
598 dst_p[word_i] &= ~bit;
608 dst_p[word_i] |= bit;
610 dst_p[word_i] &= ~bit;
617 return m_value ? 1 : 0;
626 #define SC_CONCAT_OP_TYPE(RESULT, OP, OTHER_TYPE) \
628 operator OP (const sc_concatref &a, OTHER_TYPE b) \
630 return a.value() OP b; \
633 operator OP (OTHER_TYPE a, const sc_concatref &b) \
635 return a OP b.value(); \
639 #define SC_CONCAT_OP(RESULT, OP) \
641 operator OP (const sc_concatref &a, const sc_concatref &b) \
643 return a.value() OP b.value(); \
645 SC_CONCAT_OP_TYPE(const sc_signed, OP, int) \
646 SC_CONCAT_OP_TYPE(const sc_signed, OP, long) \
647 SC_CONCAT_OP_TYPE(const sc_signed, OP, int64) \
648 SC_CONCAT_OP_TYPE(RESULT, OP, unsigned int) \
649 SC_CONCAT_OP_TYPE(RESULT, OP, unsigned long) \
650 SC_CONCAT_OP_TYPE(RESULT, OP, uint64) \
651 SC_CONCAT_OP_TYPE(const sc_signed, OP, const sc_int_base &) \
652 SC_CONCAT_OP_TYPE(RESULT, OP, const sc_uint_base &) \
653 SC_CONCAT_OP_TYPE(const sc_signed, OP, const sc_signed &) \
654 SC_CONCAT_OP_TYPE(RESULT, OP, const sc_unsigned &) \
656 operator OP (const sc_concatref &a, bool b) \
658 return a.value() OP (int)b; \
661 operator OP (bool a, const sc_concatref &b) \
663 return (int)a OP b.value(); \
666 #define SC_CONCAT_BOOL_OP(OP) \
668 operator OP (const sc_concatref &a, const sc_concatref &b) \
670 return a.value() OP b.value(); \
672 SC_CONCAT_OP_TYPE(bool, OP, int) \
673 SC_CONCAT_OP_TYPE(bool, OP, long) \
674 SC_CONCAT_OP_TYPE(bool, OP, int64) \
675 SC_CONCAT_OP_TYPE(bool, OP, unsigned int) \
676 SC_CONCAT_OP_TYPE(bool, OP, unsigned long) \
677 SC_CONCAT_OP_TYPE(bool, OP, uint64) \
678 SC_CONCAT_OP_TYPE(bool, OP, const sc_int_base &) \
679 SC_CONCAT_OP_TYPE(bool, OP, const sc_uint_base &) \
680 SC_CONCAT_OP_TYPE(bool, OP, const sc_signed &) \
681 SC_CONCAT_OP_TYPE(bool, OP, const sc_unsigned &) \
683 operator OP (const sc_concatref &a, bool b) \
685 return a.value() OP (int)b; \
688 operator OP (bool a, const sc_concatref &b) \
690 return (int)a OP b.value(); \
709 #undef SC_CONCAT_OP_TYPE
806 #endif // __SYSTEMC_EXT_DT_MISC_SC_CONCATREF_HH__
virtual uint64 concat_get_uint64() const
bool nand_reduce(const sc_concatref &a)
const std::string to_string(sc_numrep numrep=SC_DEC) const
static sc_core::sc_vpool< sc_concatref > m_pool
virtual void concat_set(int64 src, int low_i)
Temp operator+(Temp l, Temp r)
virtual void concat_clear_data(bool to_ones)
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
bool nor_reduce(const sc_concatref &a)
const sc_dt::sc_concatref & concat(bool a, const sc_dt::sc_value_base &b)
sc_byte_heap sc_temp_heap(0x300000)
void scan(::std::istream &is=::std::cin)
void to_sc_signed(sc_signed &target) const
Time operator-(const Time &l, const Time &r)
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
void scan(::std::istream &is)
bool and_reduce(const sc_concatref &a)
const sc_unsigned & value() const
int num_bits(int nb) const
void print(::std::ostream &os=::std::cout) const
static sc_concat_bool * allocate(bool v)
virtual uint64 concat_get_uint64() const
virtual void concat_set(const sc_signed &src, int low_i)
inline ::std::ostream & operator<<(::std::ostream &os, const sc_concatref &v)
bool or_reduce(const sc_concatref &a)
sc_value_base * m_right_p
inline ::std::istream & operator>>(::std::istream &is, sc_concatref &a)
virtual void concat_set(uint64 src, int low_i)
virtual int concat_length(bool *xz_present_p) const
static sc_core::sc_vpool< sc_concat_bool > m_pool
void initialize(sc_value_base &left, sc_value_base &right)
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
virtual ~sc_concat_bool()
virtual int concat_length(bool *xz_present_p=0) const
#define SC_CONCAT_BOOL_OP(OP)
bool xnor_reduce(const sc_concatref &a)
bool xor_reduce(const sc_concatref &a)
unsigned int length() const
unsigned int to_uint() const
virtual void concat_set(const sc_unsigned &src, int low_i)
void initialize(const sc_value_base &left, const sc_value_base &right)
unsigned long to_ulong() const
virtual int concat_length(bool *xz_present_p) const
const sc_bit operator~(const sc_bit &a)
#define SC_CONCAT_OP(RESULT, OP)
const sc_dt::sc_concatref & operator,(bool a, const sc_dt::sc_value_base &b)
void to_sc_unsigned(sc_unsigned &target) const
const std::string to_string(sc_numrep numrep, bool w_prefix) const
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
Generated on Wed Sep 30 2020 14:02:16 for gem5 by doxygen 1.8.17