114 class sc_signed_bitref_r;
115 class sc_signed_bitref;
116 class sc_signed_subref_r;
117 class sc_signed_subref;
126 class sc_int_subref_r;
127 class sc_uint_subref_r;
130 class sc_unsigned_subref_r;
227 inline sc_signed
operator + (
const sc_unsigned& u,
int v);
231 inline sc_signed
operator + (
int u,
const sc_unsigned& v);
238 inline sc_signed
operator + (
const sc_signed& u,
int v);
239 inline sc_signed
operator + (
const sc_signed& u,
unsigned int v);
245 inline sc_signed
operator + (
int u,
const sc_signed& v);
246 inline sc_signed
operator + (
unsigned int u,
const sc_signed& v);
267 inline sc_signed
operator - (
const sc_unsigned& u,
int v);
268 inline sc_signed
operator - (
const sc_unsigned& u,
unsigned int v);
274 inline sc_signed
operator - (
int u,
const sc_unsigned& v);
275 inline sc_signed
operator - (
unsigned int u,
const sc_unsigned& v);
282 inline sc_signed
operator - (
const sc_signed& u,
int v);
283 inline sc_signed
operator - (
const sc_signed& u,
unsigned int v);
289 inline sc_signed
operator - (
int u,
const sc_signed& v);
290 inline sc_signed
operator - (
unsigned int u,
const sc_signed& v);
311 inline sc_signed
operator * (
const sc_unsigned& u,
int v);
315 inline sc_signed
operator * (
int u,
const sc_unsigned& v);
322 inline sc_signed
operator * (
const sc_signed& u,
int v);
323 inline sc_signed
operator * (
const sc_signed& u,
unsigned int v);
329 inline sc_signed
operator * (
int u,
const sc_signed& v);
330 inline sc_signed
operator * (
unsigned int u,
const sc_signed& v);
348 inline sc_signed
operator / (
const sc_unsigned& u,
int v);
352 inline sc_signed
operator / (
int u,
const sc_unsigned& v);
359 inline sc_signed
operator / (
const sc_signed& u,
int v);
360 inline sc_signed
operator / (
const sc_signed& u,
unsigned int v);
366 inline sc_signed
operator / (
int u,
const sc_signed& v);
367 inline sc_signed
operator / (
unsigned int u,
const sc_signed& v);
385 inline sc_signed
operator % (
const sc_unsigned& u,
int v);
389 inline sc_signed
operator % (
int u,
const sc_unsigned& v);
396 inline sc_signed
operator % (
const sc_signed& u,
int v);
397 inline sc_signed
operator % (
const sc_signed& u,
unsigned int v);
403 inline sc_signed
operator % (
int u,
const sc_signed& v);
404 inline sc_signed
operator % (
unsigned int u,
const sc_signed& v);
424 inline sc_signed
operator & (
const sc_unsigned& u,
int v);
428 inline sc_signed
operator & (
int u,
const sc_unsigned& v);
435 inline sc_signed
operator & (
const sc_signed& u,
int v);
436 inline sc_signed
operator & (
const sc_signed& u,
unsigned int v);
442 inline sc_signed
operator & (
int u,
const sc_signed& v);
443 inline sc_signed
operator & (
unsigned int u,
const sc_signed& v);
461 inline sc_signed
operator | (
const sc_unsigned& u,
int v);
465 inline sc_signed
operator | (
int u,
const sc_unsigned& v);
472 inline sc_signed
operator | (
const sc_signed& u,
int v);
473 inline sc_signed
operator | (
const sc_signed& u,
unsigned int v);
479 inline sc_signed
operator | (
int u,
const sc_signed& v);
480 inline sc_signed
operator | (
unsigned int u,
const sc_signed& v);
498 inline sc_signed
operator ^ (
const sc_unsigned& u,
int v);
502 inline sc_signed
operator ^ (
int u,
const sc_unsigned& v);
509 inline sc_signed
operator ^ (
const sc_signed& u,
int v);
510 inline sc_signed
operator ^ (
const sc_signed& u,
unsigned int v);
516 inline sc_signed
operator ^ (
int u,
const sc_signed& v);
517 inline sc_signed
operator ^ (
unsigned int u,
const sc_signed& v);
540 inline sc_signed
operator << (
const sc_signed& u,
int v);
541 inline sc_signed
operator << (
const sc_signed& u,
unsigned int v);
558 inline sc_signed
operator >> (
const sc_signed& u,
int v);
559 inline sc_signed
operator >> (
const sc_signed& u,
unsigned int v);
583 inline bool operator == (
const sc_signed& u,
int v);
584 inline bool operator == (
const sc_signed& u,
unsigned int v);
590 inline bool operator == (
int u,
const sc_signed& v);
591 inline bool operator == (
unsigned int u,
const sc_signed& v);
608 inline bool operator != (
const sc_signed& u,
int v);
609 inline bool operator != (
const sc_signed& u,
unsigned int v);
615 inline bool operator != (
int u,
const sc_signed& v);
616 inline bool operator != (
unsigned int u,
const sc_signed& v);
633 inline bool operator < (
const sc_signed& u,
int v);
634 inline bool operator < (
const sc_signed& u,
unsigned int v);
640 inline bool operator < (
int u,
const sc_signed& v);
641 inline bool operator < (
unsigned int u,
const sc_signed& v);
658 inline bool operator <= (
const sc_signed& u,
int v);
659 inline bool operator <= (
const sc_signed& u,
unsigned int v);
665 inline bool operator <= (
int u,
const sc_signed& v);
666 inline bool operator <= (
unsigned int u,
const sc_signed& v);
683 inline bool operator > (
const sc_signed& u,
int v);
684 inline bool operator > (
const sc_signed& u,
unsigned int v);
690 inline bool operator > (
int u,
const sc_signed& v);
691 inline bool operator > (
unsigned int u,
const sc_signed& v);
708 inline bool operator >= (
const sc_signed& u,
int v);
709 inline bool operator >= (
const sc_signed& u,
unsigned int v);
715 inline bool operator >= (
int u,
const sc_signed& v);
716 inline bool operator >= (
unsigned int u,
const sc_signed& v);
746 m_obj_p = (
const_cast<sc_signed*
>( obj_p ) );
759 :
sc_value_base(a), m_index( a.m_index ), m_obj_p( a.m_obj_p )
771 bool operator ! ()
const;
778 {
return operator uint64(); }
781 {
return operator uint64(); }
786 {
if ( xz_present_p ) *xz_present_p =
false;
return 1; }
793 dst_p[word_i] &= ~bit_mask;
803 dst_p[word_i] |= bit_mask;
808 dst_p[word_i] &= ~bit_mask;
817 void print( ::std::ostream& os = ::std::cout )
const 878 virtual void concat_set(
int64 src,
int low_i);
879 virtual void concat_set(
const sc_signed& src,
int low_i);
880 virtual void concat_set(
const sc_unsigned& src,
int low_i);
881 virtual void concat_set(
uint64 src,
int low_i);
886 void scan( ::std::istream& is = ::std::cin );
908 friend class sc_signed_signal;
920 m_obj_p = (
const_cast<sc_signed*
>( obj_p ));
936 :
sc_value_base(a), m_left( a.m_left ), m_obj_p( a.m_obj_p ),
944 {
return m_left >= m_right ? (m_left-m_right+1) : (m_right-m_left+1 ); }
955 unsigned int to_uint()
const;
956 long to_long()
const;
957 unsigned long to_ulong()
const;
958 int64 to_int64()
const;
960 double to_double()
const;
972 if ( xz_present_p ) *xz_present_p =
false;
973 return m_left - m_right + 1;
975 virtual uint64 concat_get_uint64()
const;
976 virtual bool concat_get_ctrl(
sc_digit* dst_p,
int low_i )
const;
977 virtual bool concat_get_data(
sc_digit* dst_p,
int low_i )
const;
991 void print( ::std::ostream& os = ::std::cout )
const 1052 a->to_sc_unsigned(temp);
1053 return operator = (temp);
1060 {
return operator = ( (
unsigned long) a ); }
1063 {
return operator = ( (
long) a ); }
1073 virtual void concat_set(
int64 src,
int low_i);
1074 virtual void concat_set(
const sc_signed& src,
int low_i);
1075 virtual void concat_set(
const sc_unsigned& src,
int low_i);
1076 virtual void concat_set(
uint64 src,
int low_i);
1080 void scan( ::std::istream& is = ::std::cin );
1110 typedef bool elemtype;
1112 void invalid_init(
const char* type_name,
int nb )
const;
1137 { a->to_sc_signed(*
this);
return *
this; }
1142 const sc_signed& operator = (
const char* v);
1146 const sc_signed& operator = (
unsigned long v);
1149 {
return operator=((
long) v); }
1152 {
return operator=((
unsigned long) v); }
1161 #ifdef SC_INCLUDE_FX 1173 #ifndef SC_MAX_NBITS 1183 {
if ( xz_present_p ) *xz_present_p =
false;
return nbits; }
1184 virtual bool concat_get_ctrl(
sc_digit* dst_p,
int low_i )
const;
1185 virtual bool concat_get_data(
sc_digit* dst_p,
int low_i )
const;
1186 virtual uint64 concat_get_uint64()
const;
1187 virtual void concat_set(
int64 src,
int low_i);
1188 virtual void concat_set(
const sc_signed& src,
int low_i);
1189 virtual void concat_set(
const sc_unsigned& src,
int low_i);
1190 virtual void concat_set(
uint64 src,
int low_i);
1206 {
if ( i < 0 || i >= nbits ) invalid_index(i); }
1208 void invalid_index(
int i )
const;
1260 if ( l < 0 || r >= nbits ) invalid_range(l,r);
1264 if ( r < 0 || l >= nbits ) invalid_range(l,r);
1268 void invalid_range(
int l,
int r )
const;
1272 check_range( i, j );
1281 check_range( i, j );
1290 check_range( i, j );
1299 check_range( i, j );
1310 unsigned int to_uint()
const;
1311 long to_long()
const;
1312 unsigned long to_ulong()
const;
1313 int64 to_int64()
const;
1314 uint64 to_uint64()
const;
1315 double to_double()
const;
1317 #ifdef SC_DT_DEPRECATED 1318 int to_signed()
const 1319 {
return to_int(); }
1321 unsigned int to_unsigned()
const 1322 {
return to_uint(); }
1333 void print( ::std::ostream& os = ::std::cout )
const 1336 void scan( ::std::istream& is = ::std::cin );
1338 void dump( ::std::ostream& os = ::std::cout )
const;
1343 bool iszero()
const;
1364 bool test(
int i)
const;
1367 void set(
int i,
bool v)
1368 {
if (v)
set(i);
else clear(i); }
1370 {
if (test(i)) clear(i);
else set(i); }
1376 void get_packed_rep(
sc_digit *buf)
const;
1377 void set_packed_rep(
sc_digit *buf);
1433 {
return operator+(u, (
unsigned long) v); }
1442 {
return operator+((
unsigned long) u, v); }
1449 const sc_signed& operator += (
unsigned long v);
1451 {
return operator+=((
long) v); }
1453 {
return operator+=((
unsigned long) v); }
1477 {
return operator-(u, (
unsigned long) v); }
1486 {
return operator-((
unsigned long) u, v); }
1496 {
return operator-(u, (
unsigned long) v); }
1505 {
return operator-((
unsigned long) u, v); }
1512 const sc_signed& operator -= (
unsigned long v);
1514 {
return operator -= ((
long) v); }
1516 {
return operator -= ((
unsigned long) v); }
1552 {
return operator*(u, (
unsigned long) v); }
1561 {
return operator*((
unsigned long) u, v); }
1568 const sc_signed& operator *= (
unsigned long v);
1570 {
return operator*=((
long) v); }
1572 {
return operator*=((
unsigned long) v); }
1606 {
return operator/(u, (
unsigned long) v); }
1615 {
return operator/((
unsigned long) u, v); }
1622 const sc_signed& operator /= (
unsigned long v);
1624 {
return operator/=((
long) v); }
1626 {
return operator/=((
unsigned long) v); }
1660 {
return operator%(u, (
unsigned long) v); }
1669 {
return operator%((
unsigned long) u, v); }
1676 const sc_signed& operator %= (
unsigned long v);
1678 {
return operator%=((
long) v); }
1680 {
return operator%=((
unsigned long) v); }
1716 {
return operator&(u, (
unsigned long) v); }
1725 {
return operator&((
unsigned long) u, v); }
1770 {
return operator|(u, (
unsigned long) v); }
1779 {
return operator|((
unsigned long) u, v); }
1824 {
return operator^(u, (
unsigned long) v); }
1833 {
return operator^((
unsigned long) u, v); }
1877 const sc_signed& operator <<= (
unsigned long v);
1879 {
return operator<<=((
long) v); }
1881 {
return operator<<=((
unsigned long) v); }
1908 const sc_signed& operator >>= (
unsigned long v);
1910 {
return operator>>=((
long) v); }
1912 {
return operator>>=((
unsigned long) v); }
1997 {
return operator<(u, (
unsigned long) v); }
2006 {
return operator<((
unsigned long) u, v); }
2055 {
return operator>(u, (
unsigned long) v); }
2064 {
return operator>((
unsigned long) u, v); }
2204 int num_bits(
int nb)
const {
return nb; }
2206 bool check_if_outside(
int bit_num)
const;
2208 void copy_digits(
int nb,
int nd,
const sc_digit *d)
2216 void convert_2C_to_SM()
2219 void convert_SM_to_2C_to_SM()
2269 for (
int i = m_right; i <= m_left; i++ )
2270 if ( !target_p->
test(i) )
return false;
2282 for (
int i = m_right; i <= m_left; i++ )
2283 if ( target_p->
test(i) )
return true;
2297 for (
int i = m_right; i <= m_left; i++ )
2298 if ( target_p->
test(i) ) odd = ~odd;
2299 return odd ? true :
false;
2329 return ( *
this = aa = a );
2354 int nb = v->length();
2355 sgn = default_sign();
2357 nbits = num_bits( nb );
2359 invalid_init(
"sc_generic_base<T>", nb );
2363 # ifdef SC_MAX_NBITS 2369 v->to_sc_signed(*
this);
SC_API sc_signed operator-(const sc_unsigned &u, const sc_signed &v)
Proxy class for sized bit concatenation.
Base class for the fixed-point types; limited precision.
sc_signed sub_signed_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
void scan(::std::istream &is=::std::cin)
sc_signed_bitref(const sc_signed_bitref &a)
small_type make_zero(int nd, sc_digit *d)
sc_signed_bitref_r(const sc_signed_bitref_r &a)
Proxy class for sc_uint part selection (r-value only).
const sc_signed_subref_r & range(int i, int j) const
bool operator==(const sc_bit &a, const sc_bit &b)
Proxy class for sc_int part selection (r-value only).
Fixed-point value types; limited precision.
SC_API sc_signed operator*(const sc_unsigned &u, const sc_signed &v)
sc_proxy< X >::value_type nand_reduce(const sc_proxy< X > &a)
X & operator&=(sc_proxy< X > &px, const sc_proxy< Y > &py)
void convert_SM_to_2C(small_type s, int nd, sc_digit *d)
small_type convert_signed_2C_to_SM(int nb, int nd, sc_digit *d)
Proxy class for sc_unsigned part selection (r-value only).
virtual uint64 concat_get_uint64() const
sc_proxy< X >::value_type xnor_reduce(const sc_proxy< X > &a)
Proxy class for sc_signed bit selection (r-value and l-value).
sc_proxy< X >::value_type nor_reduce(const sc_proxy< X > &a)
sc_signed mul_signed_friend(small_type s, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
sc_signed div_signed_friend(small_type s, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
void scan(::std::istream &is=::std::cin)
X & operator|=(sc_proxy< X > &px, const sc_proxy< Y > &py)
Arbitrary precision signed number.
Abstract base class of all SystemC native variables.
Arbitrary precision unsigned number.
Base class for the fixed-point types; arbitrary precision.
Base class for SystemC bit values.
void scan(::std::istream &is=::std::cin)
sc_digit * get_raw() const
bool operator!=(const sc_bit &a, const sc_bit &b)
sc_signed_subref(const sc_signed_subref &a)
sc_signed and_signed_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
const sc_fxval operator/(const sc_fxnum &a, const sc_fxnum &b)
const sc_bit operator|(const sc_bit &a, const sc_bit &b)
sc_proxy< X >::value_type xor_reduce(const sc_proxy< X > &a)
virtual ~sc_signed_subref_r()
void initialize(const sc_signed *obj_p, int left_, int right_)
Fixed-point value type; arbitrary precision.
SC_API sc_signed operator%(const sc_unsigned &u, const sc_signed &v)
Arbitrary size logic vector base class.
Proxy class for sc_unsigned part selection (r-value and l-value).
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)
static sc_core::sc_vpool< sc_signed_bitref > m_pool
Arbitrary precision unsigned arithmetic.
Proxy class for sc_signed part selection (r-value and l-value).
sc_signed or_signed_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
bool operator>=(const sc_int_base &a, const sc_int_base &b)
External and friend functions for both sc_signed and.
Proxy class for sc_signed bit selection (r-value only).
bool operator<(const sc_int_base &a, const sc_int_base &b)
const sc_lv_base reverse(const sc_proxy< X > &x)
static sc_core::sc_vpool< sc_signed_subref > m_pool
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.
const sc_signed_bitref_r & bit(int i) const
sc_numrep
Enumeration of number representations for character string conversion.
const sc_bit operator^(const sc_bit &a, const sc_bit &b)
Proxy class for sc_signed part selection (r-value only).
void copy_digits_signed(small_type &us, int unb, int und, sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
virtual ~sc_signed_bitref_r()
X & operator^=(sc_proxy< X > &px, const sc_proxy< Y > &py)
void convert_signed_SM_to_2C(small_type s, int nd, sc_digit *d)
void print(::std::ostream &os=::std::cout) const
void check_index(int i) const
sc_signed_subref_r(const sc_signed_subref_r &a)
virtual int concat_length(bool *xz_present_p) const
void check_range(int l, int r) const
#define SC_API_TEMPLATE_DECL_
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
sc_signed_bitref & bit(int i)
sc_signed xor_signed_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_signed mod_signed_friend(small_type us, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
const sc_bit operator&(const sc_bit &a, const sc_bit &b)
virtual int concat_length(bool *xz_present_p) const
sc_numrep sc_io_base(::std::ostream &, sc_numrep)
Top level header file for arbitrary precision signed/unsigned.
virtual int concat_length(bool *xz_present_p) const
sc_signed_subref & range(int i, int j)
Temporary value pool classes.
void print(::std::ostream &os=::std::cout) const
const sc_signed_subref & operator=(const sc_signed_subref_r &a)
inline ::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
small_type convert_signed_SM_to_2C_to_SM(small_type s, int nb, int nd, sc_digit *d)
SC_NORETURN_ SC_API void sc_abort()
const sc_bit operator~(const sc_bit &a)
Arbitrary size bit vector base class.
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
External functions for both sc_signed and sc_unsigned.
bool sc_io_show_base(::std::ostream &)
sc_proxy< X >::value_type and_reduce(const sc_proxy< X > &a)
sc_signed add_signed_friend(small_type us, int unb, int und, const sc_digit *ud, small_type vs, int vnb, int vnd, const sc_digit *vd)
sc_signed(int nb=sc_length_param().len())
bool operator<=(const sc_int_base &a, const sc_int_base &b)
void print(::std::ostream &os=::std::cout) const
inline ::std::istream & operator>>(::std::istream &is, sc_bit &a)
void initialize(const sc_signed *obj_p, int index_)