111class sc_signed_bitref_r;
112class sc_signed_bitref;
113class sc_signed_subref_r;
114class sc_signed_subref;
123class sc_int_subref_r;
124class sc_uint_subref_r;
127class sc_unsigned_subref_r;
168 m_obj_p = (
const_cast<sc_signed*
>( obj_p ) );
182 :
sc_value_base(a), m_index( a.m_index ), m_obj_p( a.m_obj_p )
194 bool operator ! ()
const;
201 {
return operator uint64(); }
204 {
return operator uint64(); }
209 {
if ( xz_present_p ) *xz_present_p =
false;
return 1; }
216 dst_p[word_i] &= ~bit_mask;
226 dst_p[word_i] |= bit_mask;
231 dst_p[word_i] &= ~bit_mask;
240 void print( ::std::ostream& os = ::std::cout )
const
304 void scan( ::std::istream& is = ::std::cin );
324 friend class sc_signed_signal;
336 m_obj_p = (
const_cast<sc_signed*
>( obj_p ));
352 :
sc_value_base(a), m_left( a.m_left ), m_obj_p( a.m_obj_p ),
360 {
return m_left >= m_right ? (m_left-m_right+1) : (m_right-m_left+1 ); }
370 inline int to_int()
const;
371 inline unsigned int to_uint()
const;
372 inline long to_long()
const;
373 inline unsigned long to_ulong()
const;
374 inline int64 to_int64()
const;
375 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
461operator<<( ::std::ostream&,
const sc_signed_subref_r& );
504 a->to_sc_unsigned(temp);
505 return operator = (temp);
512 {
return operator = ( (
unsigned long) a ); }
515 {
return operator = ( (
long) a ); }
534 void scan( ::std::istream& is = ::std::cin );
566 typedef bool elemtype;
576#if !defined(SC_BIGINT_CONFIG_BASE_CLASS_HAS_STORAGE)
597 { a->to_sc_signed(*
this);
return *
this; }
606 const sc_signed& operator = (
unsigned long v);
609 {
return operator=((
long) v); }
612 {
return operator=((
unsigned long) v); }
633 if ( digit_is_allocated() ) {
delete [] digit; }
641 {
if ( xz_present_p ) *xz_present_p =
false;
return nbits; }
665 {
if ( i < 0 || i >= nbits ) invalid_index(i); }
721 if ( l < 0 || r >= nbits ) invalid_range(l,r);
725 if ( r < 0 || l >= nbits ) invalid_range(l,r);
772 double to_double()
const;
773 inline int to_int()
const;
774 inline unsigned int to_uint()
const;
775 inline long to_long()
const;
776 inline unsigned long to_ulong()
const;
777 inline int64 to_int64()
const;
778 inline uint64 to_uint64()
const;
782#ifdef SC_DT_DEPRECATED
783 int to_signed()
const
786 unsigned int to_unsigned()
const
787 {
return to_uint(); }
798 void print( ::std::ostream& os = ::std::cout )
const
801 void scan( ::std::istream& is = ::std::cin );
803 void dump( ::std::ostream& os = ::std::cout )
const;
835 if (check_if_outside(i))
851 if (check_if_outside(i))
870 if (check_if_outside(i)) {
871 if ( (
int)digit[get_hod()] < 0 )
883 {
if (v) set(i);
else clear(i); }
885 {
if (test(i)) clear(i);
else set(i); }
888 {
return (
int)digit[ndigits-1] < 0; }
1085 result.
digit[0] = 0 > (int)digit[ndigits-1] ? -1 : 0;
1093 result.
digit[0] = (int)digit[0] >> v;
1095 else if ( nbits < 65 ) {
1096 int64 tmp = digit[1];
1097 tmp = (tmp << 32) | digit[0];
1101 result.
digit[1] = (tmp >>32);
1155#if !defined(SC_BIGINT_CONFIG_BASE_CLASS_HAS_STORAGE)
1161 inline bool digit_is_allocated()
const {
return digit != (
sc_digit*)base_vec; }
1164#if defined(SC_BIGINT_CONFIG_TEMPLATE_CLASS_HAS_NO_BASE_CLASS)
1166#define SC_SIGNED_TEMPS_N (1 << 15)
1169 static sc_signed m_temporaries[SC_SIGNED_TEMPS_N];
1170 static size_t m_temporaries_i;
1172 static inline sc_signed& allocate_temporary(
int nb,
sc_digit* digits_p )
1175 sc_signed* result_p = &m_temporaries[m_temporaries_i];
1176 m_temporaries_i = (m_temporaries_i + 1) & (SC_SIGNED_TEMPS_N-1);
1177 result_p->digit = digits_p;
1178 result_p->nbits = num_bits(nb);
1179 result_p->ndigits =
DIV_CEIL(result_p->nbits);
1180 result_p->m_free =
false;
1189 int shift = std::numeric_limits<sc_digit>::digits-1-
SC_BIT_INDEX(nbits-1);
1190 shift = shift > 0 ? shift : 0;
1191 unsigned long long tmp = (std::make_signed<sc_digit>::type) (digit[ndigits-1] << shift);
1192 digit[ndigits-1] = (
sc_digit)(tmp >> shift);
1209 explicit sc_signed(
int nb,
bool zero );
1217 static int num_bits(
int nb) {
return nb; }
1219 bool check_if_outside(
int bit_num)
const;
1221 void makezero() {
vector_zero( 0, ndigits, digit ); }
1243operator<<( ::std::ostream&,
const sc_signed& );
1282 if ( !target_p->
test(i) )
return false;
1295 if ( target_p->
test(i) )
return true;
1310 if ( target_p->
test(i) ) odd = ~odd;
1311 return odd ? true :
false;
1337const sc_signed_subref&
1341 return ( *
this = aa = a );
1366 int nb = v->length();
1368 nbits = num_bits( nb );
1371 std::snprintf(msg,
sizeof(msg),
1372 "sc_unsigned( sc_generic_base<T> ) : nb = %d is not valid", nb);
1385 v->to_sc_signed(*
this);
1413 int adjust = right + 63;
1420 unsigned long long result;
1421 switch( left_i - right_i )
1424 mask = ~((
sc_digit)-2<<(left-right));
1426 result = (digits[right_i] >> right_lob) & mask;
1431 mask = ~(((
sc_digit)-2)<<left_hob);
1432 result = digits[left_i]&mask;
1434 (digits[right_i]>>right_lob);
1439 mask = ~(((
sc_digit)-2)<<left_hob);
1440 result = (digits[left_i]&mask);
1443 (digits[right_i]>>right_lob);
1501 result = (int)
digit[0];
1509 unsigned int result = (
unsigned int)
digit[0];
1547 long result = (
sizeof(long) < 5 ) ?
to_int() : (long)
to_int64();
1556 unsigned long result =
1561#if !defined(SC_BIGINT_CONFIG_BASE_CLASS_HAS_STORAGE)
1576# if defined(SC_BIGINT_CONFIG_TEMPLATE_CLASS_HAS_STORAGE)
1630 nbits = num_bits( nb );
1633 std::snprintf(msg,
sizeof(msg),
"%s::%s( int nb ) : nb = %d is not valid",
1634 "sc_signed",
"sc_signed", 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 ~sc_signed_bitref_r()
virtual int concat_length(bool *xz_present_p) const
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
void initialize(const sc_signed *obj_p, int index_)
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
sc_signed_bitref_r(const sc_signed_bitref_r &a)
virtual uint64 concat_get_uint64() const
void print(::std::ostream &os=::std::cout) const
virtual void concat_set(uint64 src, int low_i)
virtual void concat_set(int64 src, int low_i)
sc_signed_bitref(const sc_signed_bitref &a)
void scan(::std::istream &is=::std::cin)
virtual void concat_set(const sc_signed &src, int low_i)
virtual void concat_set(const sc_unsigned &src, int low_i)
virtual int concat_length(bool *xz_present_p) const
unsigned long to_ulong() const
virtual uint64 concat_get_uint64() const
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
const std::string to_string(sc_numrep numrep=SC_DEC) const
const std::string to_string(sc_numrep numrep, bool w_prefix) const
void initialize(const sc_signed *obj_p, int left_, int right_)
virtual ~sc_signed_subref_r()
void print(::std::ostream &os=::std::cout) const
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
unsigned int to_uint() const
sc_signed_subref_r(const sc_signed_subref_r &a)
uint64 to_uint64_reversed() const
const sc_signed_subref & operator=(const sc_signed_subref_r &a)
virtual void concat_set(const sc_unsigned &src, int low_i)
virtual void concat_set(uint64 src, int low_i)
virtual void concat_set(const sc_signed &src, int low_i)
void scan(::std::istream &is=::std::cin)
sc_signed_subref(const sc_signed_subref &a)
virtual void concat_set(int64 src, int low_i)
const std::string to_string(sc_numrep numrep, bool w_prefix) const
sc_signed operator>>(int64 v) const
void check_range(int l, int r) const
void invalid_range(int l, int r) const
const sc_signed & operator<<=(unsigned int v)
sc_signed operator>>(const sc_signed &v) const
sc_signed operator>>(int v) const
const sc_signed & operator>>=(const sc_signed &v)
int get_actual_length() const
void print(::std::ostream &os=::std::cout) const
const sc_signed & operator>>=(int v)
const sc_signed & operator<<=(uint64 v)
void invalid_index(int i) const
virtual void concat_set(const sc_unsigned &src, int low_i)
sc_signed operator>>(unsigned int v) const
sc_signed_subref & range(int i, int j)
sc_signed_subref * temporary_subref() const
sc_signed operator<<(unsigned int v) const
unsigned int to_uint() const
const sc_signed_subref_r & range(int i, int j) const
bool digit_is_allocated() const
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
sc_signed operator<<(unsigned long v) const
const sc_signed & operator>>=(unsigned long v)
sc_signed operator>>(unsigned long v) const
const sc_signed & operator>>=(uint64 v)
void set_packed_rep(sc_digit *buf)
sc_digit * get_digits() const
const sc_signed & operator<<=(const sc_signed &v)
const sc_signed & operator>>=(int64 v)
void invalid_init(const char *type_name, int nb) const
sc_signed operator<<(long v) const
sc_signed operator<<(const sc_signed &v) const
virtual int concat_length(bool *xz_present_p) const
unsigned long to_ulong() const
sc_signed operator<<(uint64 v) const
virtual uint64 concat_get_uint64() const
const sc_signed & operator>>=(unsigned int v)
sc_signed operator>>(uint64 v) const
const sc_signed_bitref_r & bit(int i) const
void scan(::std::istream &is=::std::cin)
void dump(::std::ostream &os=::std::cout) const
sc_signed operator<<(int64 v) const
virtual void concat_set(uint64 src, int low_i)
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
sc_signed operator>>(long v) const
sc_digit base_vec[SC_BASE_VEC_DIGITS >0?SC_BASE_VEC_DIGITS:1]
sc_digit * get_raw() const
const sc_signed & operator<<=(int64 v)
sc_signed_bitref * temporary_bitref() const
const sc_signed & operator<<=(long v)
const std::string to_string(sc_numrep numrep=SC_DEC) const
virtual void concat_set(int64 src, int low_i)
void get_packed_rep(sc_digit *buf) const
sc_signed(int nb=sc_length_param().len())
virtual void concat_set(const sc_signed &src, int low_i)
const sc_signed & operator>>=(long v)
void check_index(int i) const
const sc_signed & operator<<=(unsigned long v)
sc_signed_bitref & bit(int i)