81 #ifndef SC_CONCATREF_H 82 #define SC_CONCATREF_H 131 m_len_r = right.concat_length(&right_xz);
132 m_len = left.concat_length(&left_xz) + m_len_r;
133 m_flags = ( left_xz || right_xz ) ? cf_xz_present : cf_none;
145 m_len_r = right.concat_length(&right_xz);
146 m_len = left.concat_length(&left_xz) + m_len_r;
147 m_flags = ( left_xz || right_xz ) ? cf_xz_present : cf_none;
161 #ifdef SC_DT_DEPRECATED 171 *xz_present_p = m_flags & cf_xz_present ? true :
false;
177 m_left_p->concat_clear_data(to_ones);
178 m_right_p->concat_clear_data(to_ones);
183 bool rnz = m_right_p->concat_get_ctrl( dst_p, low_i );
184 bool lnz = m_left_p->concat_get_ctrl( dst_p, low_i+m_len_r );
190 bool rnz = m_right_p->concat_get_data( dst_p, low_i );
191 bool lnz = m_left_p->concat_get_data( dst_p, low_i+m_len_r );
198 return m_right_p->concat_get_uint64();
201 return (m_left_p->concat_get_uint64() << m_len_r) |
202 m_right_p->concat_get_uint64();
208 m_right_p->concat_set( src, low_i );
209 m_left_p->concat_set( src, low_i+m_len_r);
214 m_right_p->concat_set( src, low_i );
215 m_left_p->concat_set( src, low_i+m_len_r);
220 m_right_p->concat_set( src, low_i );
221 m_left_p->concat_set( src, low_i+m_len_r);
226 m_right_p->concat_set( src, low_i );
227 m_left_p->concat_set( src, low_i+m_len_r);
238 result = m_right_p->concat_get_uint64();
242 result = (m_left_p->concat_get_uint64() << m_len_r) |
243 (result & ~(mask << m_len_r));
248 result = result & ~(mask << m_len);
259 result_p->nbits = result_p->num_bits(m_len);
260 result_p->ndigits =
DIV_CEIL(result_p->nbits);
262 sizeof(
sc_digit)*result_p->ndigits );
263 #if defined(_MSC_VER) 265 memset( result_p->digit, 0,
sizeof(
sc_digit)*result_p->ndigits );
267 result_p->digit[result_p->ndigits-1] = 0;
269 right_non_zero = m_right_p->concat_get_data( result_p->digit, 0 );
270 left_non_zero = m_left_p->concat_get_data(result_p->digit, m_len_r);
271 if ( left_non_zero || right_non_zero )
280 return (
int64)to_uint64();
283 {
return (
int)to_int64(); }
285 {
return (
unsigned int)to_uint64(); }
287 {
return (
long)to_int64(); }
289 {
return (
unsigned long)to_uint64(); }
291 {
return value().to_double(); }
294 { target =
value(); }
297 { target =
value(); }
302 {
return to_uint64(); }
321 {
return value().to_string(numrep); }
324 {
return value().to_string(numrep,w_prefix); }
333 m_left_p->concat_set((
int64)v, m_len_r);
340 m_left_p->concat_set((
int64)v, m_len_r);
347 m_left_p->concat_set(v, m_len_r);
354 m_left_p->concat_set((
uint64)v, m_len_r);
361 m_left_p->concat_set((
uint64)v, m_len_r);
368 m_left_p->concat_set(v, m_len_r);
377 m_left_p->concat_set(temp, m_len_r);
384 m_left_p->concat_set(v, m_len_r);
391 m_left_p->concat_set(v, m_len_r);
400 m_left_p->concat_set(v, m_len_r);
408 m_right_p->concat_set(temp, 0);
409 m_left_p->concat_set(temp, m_len_r);
417 m_right_p->concat_set(data, 0);
418 m_left_p->concat_set(data, m_len_r);
426 {
return value().and_reduce(); }
429 {
return value().nand_reduce(); }
432 {
return value().or_reduce(); }
435 {
return value().nor_reduce(); }
438 {
return value().xor_reduce(); }
441 {
return value().xnor_reduce(); }
445 void print( ::std::ostream& os = ::std::cout )
const 446 { os << this->
value(); }
448 void scan( ::std::istream& is )
473 sc_concatref() : m_left_p(0), m_right_p(0), m_len(0), m_len_r(0), m_flags()
532 return target.
value() << (int)shift;
537 return target.
value() << (int)shift;
543 return target.
value() << (int)shift;
549 return target.
value() << shift;
555 return target.
value() << (int)shift;
560 return target.
value() << (int)shift;
565 return target.
value() >> (int)shift;
570 return target.
value() >> (int)shift;
576 return target.
value() >> (int)shift;
582 return target.
value() >> shift;
588 return target.
value() >> (int)shift;
593 return target.
value() >> (int)shift;
603 return os << v.
value();
655 if ( xz_present_p ) *xz_present_p =
false;
663 dst_p[word_i] &= ~bit;
672 dst_p[word_i] |= bit;
674 dst_p[word_i] &= ~bit;
680 return m_value ? 1 : 0;
690 #define SC_CONCAT_OP_TYPE(RESULT,OP,OTHER_TYPE) \ 691 inline RESULT operator OP ( const sc_concatref& a, OTHER_TYPE b ) \ 693 return a.value() OP b; \ 695 inline RESULT operator OP ( OTHER_TYPE a, const sc_concatref& b ) \ 697 return a OP b.value(); \ 702 #define SC_CONCAT_OP(RESULT,OP) \ 703 inline RESULT operator OP ( const sc_concatref& a, const sc_concatref& b ) \ 705 return a.value() OP b.value(); \ 707 SC_CONCAT_OP_TYPE(const sc_signed,OP,int) \ 708 SC_CONCAT_OP_TYPE(const sc_signed,OP,long) \ 709 SC_CONCAT_OP_TYPE(const sc_signed,OP,int64) \ 710 SC_CONCAT_OP_TYPE(RESULT,OP,unsigned int) \ 711 SC_CONCAT_OP_TYPE(RESULT,OP,unsigned long) \ 712 SC_CONCAT_OP_TYPE(RESULT,OP,uint64) \ 713 SC_CONCAT_OP_TYPE(const sc_signed,OP,const sc_int_base&) \ 714 SC_CONCAT_OP_TYPE(RESULT,OP,const sc_uint_base&) \ 715 SC_CONCAT_OP_TYPE(const sc_signed,OP,const sc_signed&) \ 716 SC_CONCAT_OP_TYPE(RESULT,OP,const sc_unsigned&) \ 717 inline RESULT operator OP ( const sc_concatref& a, bool b ) \ 719 return a.value() OP (int)b; \ 721 inline RESULT operator OP ( bool a, const sc_concatref& b ) \ 723 return (int)a OP b.value(); \ 727 #define SC_CONCAT_BOOL_OP(OP) \ 728 inline bool operator OP ( const sc_concatref& a, const sc_concatref& b ) \ 730 return a.value() OP b.value(); \ 732 SC_CONCAT_OP_TYPE(bool,OP,int) \ 733 SC_CONCAT_OP_TYPE(bool,OP,long) \ 734 SC_CONCAT_OP_TYPE(bool,OP,int64) \ 735 SC_CONCAT_OP_TYPE(bool,OP,unsigned int) \ 736 SC_CONCAT_OP_TYPE(bool,OP,unsigned long) \ 737 SC_CONCAT_OP_TYPE(bool,OP,uint64) \ 738 SC_CONCAT_OP_TYPE(bool,OP,const sc_int_base&) \ 739 SC_CONCAT_OP_TYPE(bool,OP,const sc_uint_base&) \ 740 SC_CONCAT_OP_TYPE(bool,OP,const sc_signed&) \ 741 SC_CONCAT_OP_TYPE(bool,OP,const sc_unsigned&) \ 742 inline bool operator OP ( const sc_concatref& a, bool b ) \ 744 return a.value() OP (int)b; \ 746 inline bool operator OP ( bool a, const sc_concatref& b ) \ 748 return (int)a OP b.value(); \ 767 #undef SC_CONCAT_OP_TYPE 872 #endif // SC_CONCATREF_H SC_API sc_signed operator-(const sc_unsigned &u, const sc_signed &v)
Proxy class for sized bit concatenation.
sc_concref_r< sc_bitref_r< T1 >, sc_bitref_r< T2 > > concat(sc_bitref_r< T1 >, sc_bitref_r< T2 >)
virtual int concat_length(bool *xz_present_p) const
virtual void concat_set(uint64 src, int low_i)
Arbitrary precision signed arithmetic.
sc_proxy< X >::value_type nand_reduce(const sc_proxy< X > &a)
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
Arbitrary size logic vector class.
void print(::std::ostream &os=::std::cout) const
sc_proxy< X >::value_type xnor_reduce(const sc_proxy< X > &a)
unsigned int length() const
sc_proxy< X >::value_type nor_reduce(const sc_proxy< X > &a)
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
Arbitrary precision signed number.
void initialize(const sc_value_base &left, const sc_value_base &right)
Abstract base class of all SystemC native variables.
unsigned int to_uint() const
void scan(::std::istream &is=::std::cin)
Arbitrary precision unsigned number.
Base class for SystemC bit values.
const std::string to_string(sc_numrep numrep=SC_DEC) const
sc_byte_heap SC_API sc_temp_heap
uint64 const sc_uint_base int b
void scan(::std::istream &is)
sc_proxy< X >::value_type xor_reduce(const sc_proxy< X > &a)
sc_value_base * m_right_p
An unsigned integer whose length is less than 64 bits.
Proxy class for read-only boolean values in concatenations.
Arbitrary size logic vector base class.
SC_API sc_signed operator+(const sc_unsigned &u, const sc_signed &v)
sc_proxy< X >::value_type or_reduce(const sc_proxy< X > &a)
virtual void concat_set(int64 src, int low_i)
Arbitrary precision unsigned arithmetic.
sc_concref_r< sc_bitref_r< T1 >, sc_bitref_r< T2 > > operator,(sc_bitref_r< T1 >, sc_bitref_r< T2 >)
static sc_concat_bool * allocate(bool v)
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
virtual uint64 concat_get_uint64() const
sc_clock period is zero sc_clock low time is zero sc_fifo< T > cannot have more than one writer bind interface to port failed complete binding failed remove port failed insert primitive channel failed sc_signal< T > cannot have more than one driver resolved port not bound to resolved signal sc_semaphore requires an initial value
static sc_core::sc_vpool< sc_unsigned > m_pool
Abstract base class of all SystemC `simulation' objects.
Proxy class for user-defined value classes and other classes that.
virtual void concat_set(const sc_signed &src, int low_i)
sc_numrep
Enumeration of number representations for character string conversion.
#define SC_CONCAT_BOOL_OP(OP)
void initialize(sc_value_base &left, sc_value_base &right)
void to_sc_signed(sc_signed &target) const
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
unsigned long to_ulong() const
static sc_core::sc_vpool< sc_concatref > m_pool
#define SC_API_TEMPLATE_DECL_
virtual void concat_set(const sc_unsigned &src, int low_i)
#define SC_CONCAT_OP(RESULT, OP)
virtual uint64 concat_get_uint64() const
static sc_core::sc_vpool< sc_concat_bool > m_pool
Arbitrary size bit vector class.
virtual ~sc_concat_bool()
virtual void concat_set(int64 src, int low_i)
void to_sc_unsigned(sc_unsigned &target) const
Temporary value pool classes.
virtual int concat_length(bool *xz_present_p) const
inline ::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
const sc_unsigned & value() const
const sc_bit operator~(const sc_bit &a)
Arbitrary size bit vector base class.
virtual void concat_clear_data(bool to_ones)
const std::string to_string(sc_numrep numrep, bool w_prefix) const
sc_proxy< X >::value_type and_reduce(const sc_proxy< X > &a)
A signed integer whose length is less than 64 bit.
inline ::std::istream & operator>>(::std::istream &is, sc_bit &a)