Go to the documentation of this file.
96 template class sc_vpool<sc_dt::sc_signed_bitref>;
97 template class sc_vpool<sc_dt::sc_signed_subref>;
110 sc_signed::invalid_init(
const char *type_name,
int nb)
const
112 std::stringstream msg;
113 msg <<
"sc_signed("<< type_name <<
") : nb = " << nb <<
" is not valid";
122 sc_signed::invalid_index(
int i)
const
124 std::stringstream msg;
125 msg <<
"sc_bigint bit selection: index = " <<
i <<
" violates "
126 "0 <= index <= " << (nbits - 1);
132 sc_signed::invalid_range(
int l,
int r)
const
134 std::stringstream msg;
135 msg <<
"sc_bigint part selection: left = " <<
136 l <<
", right = " <<
r <<
" \n"
137 " violates either (" << (nbits-1) <<
" >= left >= 0) or "
138 "(" << (nbits-1) <<
" >= right >= 0)";
158 sc_signed::concat_get_ctrl(
sc_digit *dst_p,
int low_i)
const
171 mask = ~(~0U << left_shift);
172 dst_p[dst_i] = (dst_p[dst_i] & ~
mask);
175 for (; dst_i <= end_i; dst_i++)
182 sc_signed::concat_get_data(
sc_digit *dst_p,
int low_i)
const
198 high_i = low_i + nbits - 1;
208 if (dst_i == end_i) {
209 mask = ~(~0U << left_shift);
210 dst_p[dst_i] = ((dst_p[dst_i] &
mask) |
214 }
else if (left_shift == 0) {
215 for (src_i = 0; dst_i < end_i; dst_i++, src_i++) {
216 dst_p[dst_i] = digit[src_i];
220 dst_p[dst_i] = digit[src_i] &
mask;
226 mask = ~(~0U << left_shift);
227 right_word = digit[0];
228 dst_p[dst_i] = (dst_p[dst_i] &
mask) |
230 for (src_i = 1, dst_i++; dst_i < end_i; dst_i++, src_i++) {
231 left_word = digit[src_i];
232 dst_p[dst_i] = ((left_word << left_shift)&
DIGIT_MASK) |
233 (right_word >> right_shift);
234 right_word = left_word;
236 left_word = (src_i < ndigits) ? digit[src_i] : 0;
238 dst_p[dst_i] = ((left_word << left_shift) |
239 (right_word >> right_shift)) &
mask;
247 if (dst_i == end_i) {
248 mask = ~(~0U << nbits);
250 mask = ~(~0U << left_shift);
251 dst_p[dst_i] = ((dst_p[dst_i] &
mask) |
255 }
else if (left_shift == 0) {
257 for (src_i = 0; dst_i < end_i; dst_i++, src_i++) {
258 right_word = (digit[src_i] ^
DIGIT_MASK) + carry;
264 right_word = (src_i < ndigits) ?
266 dst_p[dst_i] = right_word &
mask;
272 mask = ~(~0U << left_shift);
275 dst_p[dst_i] = (dst_p[dst_i] &
mask) |
279 for (src_i = 1, dst_i++; dst_i < end_i; dst_i++, src_i++) {
280 left_word = (digit[src_i] ^
DIGIT_MASK) + carry;
281 dst_p[dst_i] = ((left_word << left_shift)&
DIGIT_MASK) |
282 (right_word >> right_shift);
286 left_word = (src_i < ndigits) ?
289 dst_p[dst_i] = ((left_word << left_shift) |
290 (right_word >> right_shift)) &
mask;
298 if (dst_i == end_i) {
299 mask = ~(~0U << nbits) << left_shift;
300 dst_p[dst_i] = dst_p[dst_i] & ~
mask;
303 }
else if (left_shift == 0) {
304 for (src_i = 0; dst_i < end_i; dst_i++, src_i++) {
311 mask = ~(~0U << left_shift);
312 dst_p[dst_i] = (dst_p[dst_i] &
mask);
313 for (dst_i++; dst_i <= end_i; dst_i++) {
325 sc_signed::concat_get_uint64()
const
347 result = result & ~(
mask << nbits);
359 sc_signed::concat_set(
int64 src,
int low_i)
361 *
this = (low_i < 64) ? src >> low_i : src >> 63;
368 *
this = src >> low_i;
377 *
this = src >> low_i;
383 sc_signed::concat_set(
uint64 src,
int low_i)
385 *
this = (low_i < 64) ? src >> low_i : 0;
400 for (
i = 0;
i < ndigits-1;
i++) {
416 return sgn ==
SC_ZERO ? false :
true;
426 for (
i = 0;
i < nbits;
i++)
429 return odd ? true :
false;
441 sc_signed::operator = (
const char *
a)
445 "character string is zero");
446 }
else if (*
a == 0) {
448 "character string is empty");
452 return this->operator = (
aa);
454 std::stringstream msg;
455 msg <<
"character string '" <<
a <<
"' is not valid";
471 convert_SM_to_2C_to_SM();
485 convert_SM_to_2C_to_SM();
491 sc_signed::operator=(
long v)
500 convert_SM_to_2C_to_SM();
506 sc_signed::operator=(
unsigned long v)
514 convert_SM_to_2C_to_SM();
520 sc_signed::operator=(
double v)
531 while (std::floor(
v) && (
i < ndigits)) {
537 convert_SM_to_2C_to_SM();
547 int minlen =
sc_min(nbits,
v.length());
549 for (;
i < minlen; ++
i) {
552 for (;
i < nbits; ++
i) {
562 int minlen =
sc_min(nbits,
v.length());
564 for (;
i < minlen; ++
i) {
567 for (;
i < nbits; ++
i) {
581 return aa.to_string(numrep);
589 return aa.to_string(numrep, w_prefix);
600 return operator = ((
int64)
v);
631 return operator += ((
int64)
v);
662 return operator -= ((
int64)
v);
693 return operator *= ((
int64)
v);
724 return operator /= ((
int64)
v);
755 return operator %= ((
int64)
v);
861 return operator <<= ((
int64)
v);
874 return operator >>= ((
int64)
v);
982 return operator += ((
uint64)
v);
1013 return operator -= ((
uint64)
v);
1032 return operator *= ((
uint64)
v);
1051 return operator /= ((
uint64)
v);
1070 return operator %= ((
uint64)
v);
1140 return operator <<= ((
uint64)
v);
1153 return operator >>= ((
uint64)
v);
1246 #define CONVERT_LONG(u) \
1247 small_type u ## s = get_sign(u); \
1248 sc_digit u ## d[DIGITS_PER_ULONG]; \
1249 from_uint(DIGITS_PER_ULONG, u ## d, (unsigned long) u);
1251 #define CONVERT_LONG_2(u) \
1252 sc_digit u ## d[DIGITS_PER_ULONG]; \
1253 from_uint(DIGITS_PER_ULONG, u ## d, (unsigned long) u);
1255 #define CONVERT_INT(u) \
1256 small_type u ## s = get_sign(u); \
1257 sc_digit u ## d[DIGITS_PER_UINT]; \
1258 from_uint(DIGITS_PER_UINT, u ## d, (unsigned int) u);
1260 #define CONVERT_INT_2(u) \
1261 sc_digit u ## d[DIGITS_PER_UINT]; \
1262 from_uint(DIGITS_PER_UINT, u ## d, (unsigned int) u);
1264 #define CONVERT_INT64(u) \
1265 small_type u ## s = get_sign(u); \
1266 sc_digit u ## d[DIGITS_PER_UINT64]; \
1267 from_uint(DIGITS_PER_UINT64, u ## d, (uint64) u);
1269 #define CONVERT_INT64_2(u) \
1270 sc_digit u ## d[DIGITS_PER_UINT64]; \
1271 from_uint(DIGITS_PER_UINT64, u ## d, (uint64) u);
1304 v.sgn,
v.nbits,
v.ndigits,
v.digit);
1319 v.sgn,
v.nbits,
v.ndigits,
v.digit);
1334 v.sgn,
v.nbits,
v.ndigits,
v.digit);
1368 v.sgn,
v.nbits,
v.ndigits,
v.digit);
1402 v.sgn,
v.nbits,
v.ndigits,
v.digit);
1436 v.sgn,
v.nbits,
v.ndigits,
v.digit);
1470 v.sgn,
v.nbits,
v.ndigits,
v.digit);
1504 v.sgn,
v.nbits,
v.ndigits,
v.digit);
1538 v.sgn,
v.nbits,
v.ndigits,
v.digit);
1574 -
v.sgn,
v.nbits,
v.ndigits,
v.digit);
1589 -
v.sgn,
v.nbits,
v.ndigits,
v.digit);
1604 -
v.sgn,
v.nbits,
v.ndigits,
v.digit);
1619 -
v.sgn,
v.nbits,
v.ndigits,
v.digit);
1653 -
v.sgn,
v.nbits,
v.ndigits,
v.digit);
1687 -
v.sgn,
v.nbits,
v.ndigits,
v.digit);
1722 -
v.sgn,
v.nbits,
v.ndigits,
v.digit);
1756 -
v.sgn,
v.nbits,
v.ndigits,
v.digit);
1790 -
v.sgn,
v.nbits,
v.ndigits,
v.digit);
1824 -
v.sgn,
v.nbits,
v.ndigits,
v.digit);
1858 -
v.sgn,
v.nbits,
v.ndigits,
v.digit);
1892 -
v.sgn,
v.nbits,
v.ndigits,
v.digit);
1919 v.nbits,
v.ndigits,
v.digit);
1933 v.nbits,
v.ndigits,
v.digit);
1947 v.nbits,
v.ndigits,
v.digit);
1979 v.nbits,
v.ndigits,
v.digit);
2011 v.nbits,
v.ndigits,
v.digit);
2043 v.nbits,
v.ndigits,
v.digit);
2075 v.nbits,
v.ndigits,
v.digit);
2107 v.nbits,
v.ndigits,
v.digit);
2138 v.nbits,
v.ndigits,
v.digit);
2169 v.nbits,
v.ndigits,
v.digit);
2185 v.nbits,
v.ndigits,
v.digit);
2201 v.nbits,
v.ndigits,
v.digit);
2237 v.nbits,
v.ndigits,
v.digit);
2273 v.nbits,
v.ndigits,
v.digit);
2310 v.nbits,
v.ndigits,
v.digit);
2346 v.nbits,
v.ndigits,
v.digit);
2382 v.nbits,
v.ndigits,
v.digit);
2419 v.nbits,
v.ndigits,
v.digit);
2448 v.nbits,
v.ndigits,
v.digit);
2462 v.nbits,
v.ndigits,
v.digit);
2476 v.nbits,
v.ndigits,
v.digit);
2512 v.nbits,
v.ndigits,
v.digit);
2548 v.nbits,
v.ndigits,
v.digit);
2580 v.nbits,
v.ndigits,
v.digit);
2616 v.nbits,
v.ndigits,
v.digit);
2653 v.nbits,
v.ndigits,
v.digit);
2685 v.nbits,
v.ndigits,
v.digit);
2711 v.sgn,
v.nbits,
v.ndigits,
v.digit);
2723 v.sgn,
v.nbits,
v.ndigits,
v.digit);
2735 v.sgn,
v.nbits,
v.ndigits,
v.digit);
2763 v.sgn,
v.nbits,
v.ndigits,
v.digit);
2791 v.sgn,
v.nbits,
v.ndigits,
v.digit);
2819 v.sgn,
v.nbits,
v.ndigits,
v.digit);
2847 v.sgn,
v.nbits,
v.ndigits,
v.digit);
2875 v.sgn,
v.nbits,
v.ndigits,
v.digit);
2903 v.sgn,
v.nbits,
v.ndigits,
v.digit);
2933 v.sgn,
v.nbits,
v.ndigits,
v.digit);
2948 v.sgn,
v.nbits,
v.ndigits,
v.digit);
2963 v.sgn,
v.nbits,
v.ndigits,
v.digit);
2997 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3031 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3065 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3099 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3133 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3167 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3199 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3215 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3230 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3264 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3298 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3331 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3365 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3399 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3432 v.sgn,
v.nbits,
v.ndigits,
v.digit);
3895 sc_signed::iszero()
const
3907 sc_signed::sign()
const
3926 #define CLASS_TYPE sc_signed
3927 #define CLASS_TYPE_STR "sc_signed"
3929 #define ADD_HELPER add_signed_friend
3930 #define SUB_HELPER sub_signed_friend
3931 #define MUL_HELPER mul_signed_friend
3932 #define DIV_HELPER div_signed_friend
3933 #define MOD_HELPER mod_signed_friend
3934 #define AND_HELPER and_signed_friend
3935 #define OR_HELPER or_signed_friend
3936 #define XOR_HELPER xor_signed_friend
3938 #include "sc_nbfriends.inc"
3942 #define IF_SC_SIGNED 1 // 1 = sc_signed
3943 #define CLASS_TYPE_SUBREF sc_signed_subref_r
3944 #define OTHER_CLASS_TYPE sc_unsigned
3945 #define OTHER_CLASS_TYPE_SUBREF sc_unsigned_subref_r
3947 #define MUL_ON_HELPER mul_on_help_signed
3948 #define DIV_ON_HELPER div_on_help_signed
3949 #define MOD_ON_HELPER mod_on_help_signed
3951 #include "sc_nbcommon.inc"
3953 #undef MOD_ON_HELPER
3954 #undef DIV_ON_HELPER
3955 #undef MUL_ON_HELPER
3957 #undef OTHER_CLASS_TYPE_SUBREF
3958 #undef OTHER_CLASS_TYPE
3959 #undef CLASS_TYPE_SUBREF
3973 #undef CLASS_TYPE_STR
3975 #include "sc_signed_bitref.inc"
3976 #include "sc_signed_subref.inc"
3979 #undef CONVERT_LONG_2
3980 #undef CONVERT_INT64
3981 #undef CONVERT_INT64_2
sc_signed div_signed_friend(small_type s, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
bool operator<=(const sc_uint_base &u, const sc_signed &v)
sc_signed operator>>(const sc_signed &u, const sc_unsigned &v)
X & operator|=(sc_proxy< X > &px, const sc_proxy< Y > &py)
const char SC_ID_INIT_FAILED_[]
sc_signed operator^(unsigned long u, const sc_signed &v)
sc_digit one_and_zeros(int n)
void vec_zero(int from, int ulen, sc_digit *u)
sc_signed operator&(unsigned long u, const sc_signed &v)
#define CONVERT_INT64_2(u)
small_type check_for_zero(small_type s, int ulen, const sc_digit *u)
const std::string to_string(sc_enc enc)
small_type get_sign(Type &u)
Time operator-(const Time &l, const Time &r)
bool operator!=(const sc_uint_base &u, const sc_signed &v)
const char SC_ID_CONVERSION_FAILED_[]
sc_signed operator|(unsigned long u, const sc_signed &v)
bool operator==(unsigned long u, const sc_signed &v)
X & operator&=(sc_proxy< X > &px, const sc_proxy< Y > &py)
sc_signed operator<<(const sc_signed &u, const sc_unsigned &v)
small_type mul_signs(small_type us, small_type vs)
sc_proxy< X >::value_type xor_reduce(const sc_proxy< X > &a)
sc_signed operator%(unsigned long u, const sc_signed &v)
void safe_set(int i, bool v, sc_digit *d)
sc_proxy< X >::value_type or_reduce(const sc_proxy< X > &a)
#define DIGITS_PER_UINT64
sc_signed operator/(unsigned long u, const sc_signed &v)
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)
#define SC_REPORT_ERROR(msg_type, msg)
bool operator>(const sc_uint_base &u, const sc_signed &v)
sc_signed operator*(unsigned long u, const sc_signed &v)
sc_signed operator+(const sc_signed &u)
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)
const T sc_min(const T &a, const T &b)
int vec_skip_and_cmp(int ulen, const sc_digit *u, int vlen, const sc_digit *v)
void from_uint(int ulen, sc_digit *u, Type v)
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_proxy< X >::value_type and_reduce(const sc_proxy< X > &a)
X & operator^=(sc_proxy< X > &px, const sc_proxy< Y > &py)
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 char SC_ID_OUT_OF_BOUNDS_[]
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)
#define CONVERT_LONG_2(u)
void is_bad_double(double v)
sc_signed mod_signed_friend(small_type us, int unb, int und, const sc_digit *ud, int vnb, int vnd, const sc_digit *vd)
bool operator>=(const sc_uint_base &u, const sc_signed &v)
bool operator<(unsigned long u, const sc_signed &v)
Generated on Wed Sep 30 2020 14:02:15 for gem5 by doxygen 1.8.17