108class sc_unsigned_bitref_r;
109class sc_unsigned_bitref;
110class sc_unsigned_subref_r;
111class sc_unsigned_subref;
120class sc_int_subref_r;
121class sc_uint_subref_r;
123class sc_signed_subref_r;
177 :
sc_value_base(a), m_index( a.m_index ), m_obj_p( a.m_obj_p )
189 bool operator ! ()
const;
196 {
return operator uint64(); }
199 {
return operator uint64(); }
205 {
if ( xz_present_p ) *xz_present_p =
false;
return 1; }
212 dst_p[word_i] &= ~bit_mask;
222 dst_p[word_i] |= bit_mask;
227 dst_p[word_i] &= ~bit_mask;
236 void print( ::std::ostream& os = ::std::cout )
const
302 void scan( ::std::istream& is = ::std::cin );
323 friend class sc_unsigned_signal;
350 :
sc_value_base(a), m_left( a.m_left ), m_obj_p( a.m_obj_p ),
358 {
return m_left >= m_right ? (m_left-m_right+1) : (m_right-m_left+1 ); }
369 inline int to_int()
const;
370 inline unsigned int to_uint()
const;
371 inline long to_long()
const;
372 inline unsigned long to_ulong()
const;
373 inline int64 to_int64()
const;
374 inline uint64 to_uint64()
const;
397 if ( xz_present_p ) *xz_present_p =
false;
398 return m_left - m_right + 1;
415 void print( ::std::ostream& os = ::std::cout )
const
459operator<<( ::std::ostream&,
const sc_unsigned_subref_r& );
506 {
return operator = ( (
unsigned long) a ); }
509 {
return operator = ( (
long) a ); }
528 void scan( ::std::istream& is = ::std::cin );
560 typedef bool elemtype;
570#if !defined(SC_BIGINT_CONFIG_BASE_CLASS_HAS_STORAGE)
593 { a->to_sc_unsigned(*
this);
return *
this; }
605 {
return operator=((
long) v); }
608 {
return operator=((
unsigned long) v); }
629 if ( digit_is_allocated() ) {
delete [] digit; }
636 {
if ( xz_present_p ) *xz_present_p =
false;
return nbits-1; }
660 {
if ( (i < 0) || (i >= nbits-1) ) invalid_index(i); }
716 if ( (l < 0) || (r >= nbits-1) ) invalid_range(l,r);
720 if ( (r < 0) || (l >= nbits-1) ) invalid_range(l,r);
774 inline int to_int()
const;
775 inline unsigned int to_uint()
const;
776 inline long to_long()
const;
777 inline unsigned long to_ulong()
const;
778 inline int64 to_int64()
const;
779 inline uint64 to_uint64()
const;
780 double to_double()
const;
784#ifdef SC_DT_DEPRECATED
785 int to_signed()
const
788 unsigned int to_unsigned()
const
789 {
return to_uint(); }
799 void print( ::std::ostream& os = ::std::cout )
const
802 void scan( ::std::istream& is = ::std::cin );
804 void dump( ::std::ostream& os = ::std::cout )
const;
810 bool sign()
const {
return 0; }
837 if (check_if_outside(i))
853 if (check_if_outside(i))
871 if (check_if_outside(i))
881 {
if (v) set(i);
else clear(i); }
883 {
if (test(i)) clear(i);
else set(i); }
1085 result.
digit[0] = (int)digit[0] >> v;
1087 else if ( nbits < 65 ) {
1088 int64 tmp = digit[1];
1089 tmp = (tmp << 32) | digit[0];
1093 result.
digit[1] = (tmp >>32);
1143#if !defined(SC_BIGINT_CONFIG_BASE_CLASS_HAS_STORAGE)
1149 inline bool digit_is_allocated()
const {
return digit != (
sc_digit*)base_vec; }
1152#if defined(SC_BIGINT_CONFIG_TEMPLATE_CLASS_HAS_NO_BASE_CLASS)
1156 #define SC_UNSIGNED_TEMPS_N (1 << 15)
1158 static sc_unsigned m_temporaries[SC_UNSIGNED_TEMPS_N];
1159 static size_t m_temporaries_i;
1161 static inline sc_unsigned& allocate_temporary(
int nb,
sc_digit* digits_p )
1163 sc_unsigned* result_p = &m_temporaries[m_temporaries_i];
1164 m_temporaries_i = (m_temporaries_i + 1) & (SC_UNSIGNED_TEMPS_N-1);
1165 result_p->digit = digits_p;
1166 result_p->nbits = num_bits(nb);
1167 result_p->ndigits =
DIV_CEIL(result_p->nbits);
1168#if !defined(SC_BIGINT_CONFIG_BASE_CLASS_HAS_STORAGE)
1169 result_p->m_free =
false;
1181 digit[ndigits-1] &= ~(tmp << shift);
1204 static int num_bits(
int nb) {
return nb + 1; }
1206 bool check_if_outside(
int bit_num)
const;
1208 void makezero() {
vector_zero( 0, ndigits, digit ); }
1235operator<<( ::std::ostream&,
const sc_unsigned& );
1271 a->to_sc_unsigned(temp);
1272 return *
this = temp;
1296 if ( !target_p->
test(i) )
return false;
1309 if ( target_p->
test(i) )
return true;
1324 if ( target_p->
test(i) ) odd = ~odd;
1325 return odd ? true :
false;
1352const sc_unsigned_subref&
1356 return ( *
this = aa = a );
1379 int nb = v->length();
1381 nbits = num_bits( nb );
1384 std::snprintf(msg,
sizeof(msg),
1385 "sc_unsigned( sc_generic_base<T> ) : nb = %d is not valid", nb);
1398 v->to_sc_unsigned(*
this);
1425 int adjust = right + 63;
1432 unsigned long long result;
1433 switch( left_i - right_i )
1436 mask = ~((
sc_digit)-2<<(left-right));
1438 result = (digits[right_i] >> right_lob) & mask;
1443 mask = ~(((
sc_digit)-2)<<left_hob);
1444 result = digits[left_i]&mask;
1446 (digits[right_i]>>right_lob);
1451 mask = ~(((
sc_digit)-2)<<left_hob);
1452 result = (digits[left_i]&mask);
1455 (digits[right_i]>>right_lob);
1544 if (
sizeof(
long) < 5 ) {
1563 unsigned long result;
1565 if (
sizeof(
unsigned long) < 5 ) {
1586 result = (int)
digit[0];
1595 unsigned int result;
1597 result = (
unsigned int)
digit[0];
1614 nbits(nb+1), ndigits(
DIV_CEIL(nb+1) )
1629#if !defined(SC_BIGINT_CONFIG_BASE_CLASS_HAS_STORAGE)
1642 nbits(nb+1), ndigits(
DIV_CEIL(nb+1) )
1644# if defined(SC_BIGINT_CONFIG_TEMPLATE_CLASS_HAS_STORAGE)
1674 nbits = num_bits( nb );
1677 std::snprintf(msg,
sizeof(msg),
"%s::%s( int nb ) : nb = %d is not valid",
1678 "sc_unsigned",
"sc_unsigned", nb );
#define SC_DIGIT_INDEX(BIT_INDEX)
#define SC_BIT_INDEX(BIT)
#define SC_FREE_DIGIT(FLAG)
#define SC_BASE_VEC_DIGITS
#define SC_REPORT_ERROR(msg_type, msg)
const char SC_ID_INIT_FAILED_[]
sc_numrep sc_io_base(systemc_ostream &stream_object, sc_numrep def_base)
X & operator|=(sc_proxy< X > &px, const sc_proxy< Y > &py)
bool sc_io_show_base(systemc_ostream &stream_object)
sc_proxy< X >::value_type or_reduce(const sc_proxy< X > &a)
sc_proxy< X >::value_type xor_reduce(const sc_proxy< X > &a)
const sc_big_op_info< WL, true, WR, true >::add_result operator+(const sc_bigint< WL > &left, const sc_bigint< WR > &right)
X & operator^=(sc_proxy< X > &px, const sc_proxy< Y > &py)
sc_carry one_and_zeros(int n)
unsigned long long uint64
void vector_extract(const sc_digit *source_p, sc_digit *destination_p, const int high_bit, const int low_bit)
const sc_big_op_info< WL, true, WR, true >::sub_result operator-(const sc_bigint< WL > &left, const sc_bigint< WR > &right)
void vector_zero(int from_i, int to_i, sc_digit *target_p)
sc_proxy< X >::value_type nor_reduce(const sc_proxy< X > &a)
SC_API std::string to_string(sc_enc)
sc_lv_base reverse(const sc_proxy< X > &x)
X & operator&=(sc_proxy< X > &px, const sc_proxy< Y > &py)
inline::std::istream & operator>>(::std::istream &is, sc_bit &a)
sc_proxy< X >::value_type and_reduce(const sc_proxy< X > &a)
void vector_shift_left(const int from_digits_n, const sc_digit *from_p, const int to_digits_n, sc_digit *to_p, const int shift_n)
inline::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
void vector_shift_right(const int target_n, sc_digit *target_p, int bits_n, const sc_digit fill)
sc_proxy< X >::value_type xnor_reduce(const sc_proxy< X > &a)
sc_proxy< X >::value_type nand_reduce(const sc_proxy< X > &a)
sc_bit operator~(const sc_bit &a)
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
void initialize(const sc_unsigned *obj_p, int index_)
virtual int concat_length(bool *xz_present_p) const
sc_unsigned_bitref_r(const sc_unsigned_bitref_r &a)
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
void print(::std::ostream &os=::std::cout) const
virtual ~sc_unsigned_bitref_r()
virtual uint64 concat_get_uint64() const
virtual void concat_set(const sc_unsigned &src, int low_i)
sc_unsigned_bitref(const sc_unsigned_bitref &a)
virtual void concat_set(const sc_signed &src, int low_i)
virtual void concat_set(int64 src, int low_i)
void scan(::std::istream &is=::std::cin)
virtual void concat_set(uint64 src, int low_i)
unsigned long to_ulong() const
const std::string to_string(sc_numrep numrep=SC_DEC) const
const std::string to_string(sc_numrep numrep, bool w_prefix) const
virtual int concat_length(bool *xz_present_p) const
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
virtual ~sc_unsigned_subref_r()
sc_unsigned_subref_r(const sc_unsigned_subref_r &a)
uint64 to_uint64_reversed() const
virtual uint64 concat_get_uint64() const
unsigned int to_uint() const
void initialize(const sc_unsigned *obj_p, int left_, int right_)
void print(::std::ostream &os=::std::cout) const
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
virtual void concat_set(uint64 src, int low_i)
const sc_unsigned_subref & operator=(const sc_unsigned_subref_r &a)
sc_unsigned_subref(const sc_unsigned_subref &a)
virtual void concat_set(const sc_signed &src, int low_i)
void scan(::std::istream &is=::std::cin)
virtual void concat_set(int64 src, int low_i)
virtual void concat_set(const sc_unsigned &src, int low_i)
sc_unsigned operator<<(int64 v) const
sc_unsigned operator>>(unsigned int v) const
const std::string to_string(sc_numrep numrep, bool w_prefix) const
void check_range(int l, int r) const
sc_digit * get_raw() const
sc_unsigned operator>>(int64 v) const
sc_unsigned operator<<(uint64 v) const
const sc_unsigned & operator>>=(unsigned int v)
sc_unsigned_bitref * temporary_bitref() const
int get_actual_length() const
const sc_unsigned_subref_r & range(int i, int j) const
unsigned long to_ulong() const
sc_unsigned operator<<(const sc_unsigned &v) const
const sc_unsigned & operator>>=(long v)
unsigned int to_uint() const
const sc_unsigned & operator>>=(int64 v)
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
virtual void concat_set(int64 src, int low_i)
virtual void concat_set(uint64 src, int low_i)
static sc_unsigned * temporary()
sc_unsigned operator<<(unsigned long v) const
sc_unsigned operator>>(unsigned long v) const
sc_digit base_vec[SC_BASE_VEC_DIGITS >0?SC_BASE_VEC_DIGITS:1]
void invalid_init(const char *type_name, int nb) const
sc_digit * get_digits() const
const sc_unsigned & operator<<=(const sc_unsigned &v)
void invalid_range(int l, int r) const
virtual uint64 concat_get_uint64() const
virtual int concat_length(bool *xz_present_p) const
bool digit_is_allocated() const
sc_unsigned_subref * temporary_subref() const
int get_raw_nbits() const
const sc_unsigned & operator<<=(uint64 v)
void invalid_index(int i) const
sc_unsigned operator<<(long v) const
const sc_unsigned & operator<<=(unsigned int v)
void check_index(int i) const
virtual void concat_set(const sc_unsigned &src, int low_i)
sc_unsigned operator>>(const sc_unsigned &v) const
sc_unsigned operator>>(uint64 v) const
const std::string to_string(sc_numrep numrep=SC_DEC) const
void dump(::std::ostream &os=::std::cout) const
const sc_unsigned & operator<<=(long v)
void get_packed_rep(sc_digit *buf) const
const sc_unsigned & operator<<=(int64 v)
const sc_unsigned & operator>>=(uint64 v)
sc_unsigned operator>>(long v) const
void scan(::std::istream &is=::std::cin)
const sc_unsigned & operator>>=(int v)
const sc_unsigned_bitref_r & bit(int i) const
sc_unsigned_subref & range(int i, int j)
sc_unsigned_bitref & bit(int i)
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
sc_unsigned operator<<(unsigned int v) const
sc_unsigned(int nb=sc_length_param().len())
void print(::std::ostream &os=::std::cout) const
const sc_unsigned & operator>>=(const sc_unsigned &v)
const sc_unsigned & operator>>=(unsigned long v)
virtual void concat_set(const sc_signed &src, int low_i)
void set_packed_rep(sc_digit *buf)
sc_unsigned operator>>(int v) const
const sc_unsigned & operator<<=(unsigned long v)