73 #ifndef SC_UINT_BASE_H 74 #define SC_UINT_BASE_H 92 class sc_uint_bitref_r;
94 class sc_uint_subref_r;
101 class sc_int_subref_r;
102 class sc_signed_subref_r;
103 class sc_unsigned_subref_r;
142 friend class sc_uint_signal;
149 sc_value_base(init), m_index(init.m_index), m_obj_p(init.m_obj_p)
174 {
if ( xz_present_p ) *xz_present_p =
false;
return 1; }
180 dst_p[word_i] &= ~bit_mask;
191 dst_p[word_i] |= bit_mask;
196 dst_p[word_i] &= ~bit_mask;
202 {
return operator uint64(); }
209 #ifdef SC_DT_DEPRECATED 218 bool operator ! ()
const;
225 {
return operator uint64 (); }
228 {
return operator uint64 (); }
233 void print( ::std::ostream& os = ::std::cout )
const 290 virtual void concat_set(
int64 src,
int low_i);
291 virtual void concat_set(
const sc_signed& src,
int low_i);
292 virtual void concat_set(
const sc_unsigned& src,
int low_i);
293 virtual void concat_set(
uint64 src,
int low_i);
297 void scan( ::std::istream& is = ::std::cin );
327 sc_value_base(init), m_left(init.m_left), m_obj_p(init.m_obj_p),
328 m_right(init.m_right)
354 {
return ( m_left - m_right + 1 ); }
356 #ifdef SC_DT_DEPRECATED 364 {
if ( xz_present_p ) *xz_present_p =
false;
return length(); }
365 virtual bool concat_get_ctrl(
sc_digit* dst_p,
int low_i )
const;
366 virtual bool concat_get_data(
sc_digit* dst_p,
int low_i )
const;
401 unsigned int to_uint()
const;
402 long to_long()
const;
403 unsigned long to_ulong()
const;
404 int64 to_int64()
const;
406 double to_double()
const;
417 void print( ::std::ostream& os = ::std::cout )
const 471 {
return operator = ( a.operator
uint_type() ); }
474 {
return operator = ( a.operator
uint_type() ); }
478 {
return operator = ( a->to_uint64() ); }
507 virtual void concat_set(
int64 src,
int low_i);
508 virtual void concat_set(
const sc_signed& src,
int low_i);
509 virtual void concat_set(
const sc_unsigned& src,
int low_i);
510 virtual void concat_set(
uint64 src,
int low_i);
514 void scan( ::std::istream& is = ::std::cin );
544 void invalid_length()
const;
545 void invalid_index(
int i )
const;
546 void invalid_range(
int l,
int r )
const;
548 void check_length()
const 549 {
if( m_len <= 0 || m_len >
SC_INTWIDTH ) { invalid_length(); } }
551 void check_index(
int i )
const 552 {
if( i < 0 || i >= m_len ) { invalid_index( i ); } }
554 void check_range(
int l,
int r )
const 555 {
if( r < 0 || l >= m_len || l < r ) { invalid_range( l, r ); } }
557 void check_value()
const;
572 : m_val( 0 ), m_len( w ), m_ulen(
SC_INTWIDTH - m_len )
576 : m_val( v ), m_len( w ), m_ulen(
SC_INTWIDTH - m_len )
577 { check_length(); extend_sign(); }
580 :
sc_value_base(a), m_val(a.m_val), m_len(a.m_len), m_ulen(a.m_ulen)
584 : m_val( a ), m_len( a.length() ), m_ulen(
SC_INTWIDTH - m_len )
589 : m_val( a->to_uint64() ), m_len( a->length() ),
591 { check_length(); extend_sign(); }
611 { m_val = v; extend_sign();
return *
this; }
614 { m_val = a.
m_val; extend_sign();
return *
this; }
617 { m_val = a; extend_sign();
return *
this; }
621 { m_val = a->to_uint64(); extend_sign();
return *
this; }
639 { m_val = a; extend_sign();
return *
this; }
642 { m_val = a; extend_sign();
return *
this; }
645 { m_val = a; extend_sign();
return *
this; }
648 { m_val = a; extend_sign();
return *
this; }
651 { m_val = a; extend_sign();
return *
this; }
654 { m_val = (
uint_type) a; extend_sign();
return *
this; }
660 { m_val += v; extend_sign();
return *
this; }
663 { m_val -= v; extend_sign();
return *
this; }
666 { m_val *= v; extend_sign();
return *
this; }
669 { m_val /= v; extend_sign();
return *
this; }
672 { m_val %= v; extend_sign();
return *
this; }
678 { m_val &= v; extend_sign();
return *
this; }
681 { m_val |= v; extend_sign();
return *
this; }
684 { m_val ^= v; extend_sign();
return *
this; }
688 { m_val <<= v; extend_sign();
return *
this; }
691 { m_val >>= v;
return *
this; }
697 { ++ m_val; extend_sign();
return *
this; }
700 {
sc_uint_base tmp( *
this ); ++ m_val; extend_sign();
return tmp; }
703 { -- m_val; extend_sign();
return *
this; }
706 {
sc_uint_base tmp( *
this ); -- m_val; extend_sign();
return tmp; }
751 {
return ( 0 != (m_val & (
UINT_ONE << i)) ); }
756 void set(
int i,
bool v )
765 #ifdef SC_DT_DEPRECATED 773 {
if ( xz_present_p ) *xz_present_p =
false;
return length(); }
774 virtual bool concat_get_ctrl(
sc_digit* dst_p,
int low_i )
const;
775 virtual bool concat_get_data(
sc_digit* dst_p,
int low_i )
const;
778 virtual void concat_set(
int64 src,
int low_i);
779 virtual void concat_set(
const sc_signed& src,
int low_i);
780 virtual void concat_set(
const sc_unsigned& src,
int low_i);
781 virtual void concat_set(
uint64 src,
int low_i);
815 {
return (
int) m_val; }
818 {
return (
unsigned int) m_val; }
821 {
return (
long) m_val; }
824 {
return (
unsigned long) m_val; }
827 {
return (
int64) m_val; }
830 {
return (
uint64) m_val; }
851 void print( ::std::ostream& os = ::std::cout )
const 854 void scan( ::std::istream& is = ::std::cin );
884 sc_uint_bitref_r::operator
uint64 ()
const 886 return m_obj_p->test( m_index );
893 return ! m_obj_p->test( m_index );
900 return ! m_obj_p->test( m_index );
926 m_obj_p->set( m_index, b.
to_bool() );
934 m_obj_p->set( m_index, b.
to_bool() );
942 m_obj_p->set( m_index, b );
952 m_obj_p->set( m_index, b );
962 m_obj_p->set( m_index, b );
972 m_obj_p->m_val ^= (
UINT_ONE << m_index);
1001 return ( (val & (~
UINT_ZERO >> uleft)) >> m_right );
1177 return operator = ( a.operator
uint_type() );
1185 return ( *
this = aa = a );
1255 check_range( left, right );
1265 check_range( left, right );
1276 check_range( left, right );
1286 check_range( left, right );
const std::string to_string(sc_numrep numrep=SC_DEC) const
Base class for the fixed-point types; limited precision.
void scan(::std::istream &is=::std::cin)
sc_uint_subref_r(const sc_uint_subref_r &init)
sc_uint_base(uint_type v, int w)
sc_uint_bitref_r(const sc_uint_bitref_r &init)
Proxy class for sc_uint part selection (r-value only).
sc_uint_subref(const sc_uint_subref &init)
bool operator==(const sc_bit &a, const sc_bit &b)
unsigned long to_ulong() const
Proxy class for sc_int part selection (r-value only).
Fixed-point value types; limited precision.
sc_uint_subref & operator=(uint_type v)
sc_proxy< X >::value_type nand_reduce(const sc_proxy< X > &a)
X & operator&=(sc_proxy< X > &px, const sc_proxy< Y > &py)
Report ids for the datatypes/int code.
void print(::std::ostream &os=::std::cout) const
sc_uint_bitref & operator^=(bool b)
Proxy class for sc_unsigned part selection (r-value only).
sc_proxy< X >::value_type xnor_reduce(const sc_proxy< X > &a)
virtual uint64 concat_get_uint64() const
sc_proxy< X >::value_type nor_reduce(const sc_proxy< X > &a)
Proxy class for sc_uint bit selection (r-value and l-value).
static const uint64 UINT_ONE
X & operator|=(sc_proxy< X > &px, const sc_proxy< Y > &py)
Arbitrary precision signed number.
virtual ~sc_uint_subref_r()
Abstract base class of all SystemC native variables.
unsigned int to_uint() const
Arbitrary precision unsigned number.
Base class for the fixed-point types; arbitrary precision.
sc_uint_subref & operator()(int left, int right)
Base class for SystemC bit values.
unsigned long to_ulong() const
uint64 const sc_uint_base int b
Proxy class for sc_uint part selection (r-value and l-value).
bool operator!=(const sc_bit &a, const sc_bit &b)
sc_uint_bitref & operator&=(bool b)
sc_proxy< X >::value_type xor_reduce(const sc_proxy< X > &a)
void scan(::std::istream &is=::std::cin)
Fixed-point value type; arbitrary precision.
virtual ~sc_uint_bitref_r()
void initialize(const sc_uint_base *obj_p, int left_i, int right_i)
Arbitrary size logic vector base class.
unsigned int to_uint() const
double uint64_to_double(uint64 a)
Platform independent conversion from double uint64 to double.
sc_proxy< X >::value_type or_reduce(const sc_proxy< X > &a)
void scan(::std::istream &is=::std::cin)
void print(::std::ostream &os=::std::cout) const
bool operator>=(const sc_int_base &a, const sc_int_base &b)
bool operator<(const sc_int_base &a, const sc_int_base &b)
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
SC_API const std::string to_string(sc_enc)
bool operator>(const sc_int_base &a, const sc_int_base &b)
Abstract base class of all SystemC `simulation' objects.
Proxy class for user-defined value classes and other classes that.
void initialize(const sc_uint_base *obj_p, int index_)
static sc_core::sc_vpool< sc_uint_bitref > m_pool
sc_numrep
Enumeration of number representations for character string conversion.
const std::string to_string(sc_numrep numrep=SC_DEC) const
virtual uint64 concat_get_uint64() const
Proxy class for sc_signed part selection (r-value only).
static const uint64 UINT64_32ONES
virtual int concat_length(bool *xz_present_p) const
sc_uint_bitref & operator=(const sc_uint_bitref_r &b)
sc_uint_base(int w=sc_length_param().len())
X & operator^=(sc_proxy< X > &px, const sc_proxy< Y > &py)
static const uint64 UINT_ZERO
sc_uint_base(const sc_uint_subref_r &a)
virtual int concat_length(bool *xz_present_p) const
sc_uint_base(const sc_uint_base &a)
sc_uint_subref & range(int left, int right)
#define SC_API_TEMPLATE_DECL_
sc_uint_bitref(const sc_uint_bitref &init)
static sc_core::sc_vpool< sc_uint_subref > m_pool
virtual uint64 concat_get_uint64() const
sc_numrep sc_io_base(::std::ostream &, sc_numrep)
Proxy class for sc_uint bit selection (r-value only).
sc_uint_bitref & operator|=(bool b)
void print(::std::ostream &os=::std::cout) const
Top level header file for arbitrary precision signed/unsigned.
SC_API const uint_type mask_int[SC_INTWIDTH][SC_INTWIDTH]
Temporary value pool classes.
inline ::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
const sc_bit operator~(const sc_bit &a)
Arbitrary size bit vector base class.
sc_uint_bitref & bit(int i)
bool sc_io_show_base(::std::ostream &)
sc_proxy< X >::value_type and_reduce(const sc_proxy< X > &a)
virtual int concat_length(bool *xz_present_p) const
sc_uint_bitref & operator[](int i)
bool operator<=(const sc_int_base &a, const sc_int_base &b)
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
inline ::std::istream & operator>>(::std::istream &is, sc_bit &a)
sc_uint_base(const sc_generic_base< T > &a)