80template class sc_vpool<sc_dt::sc_int_bitref>;
81template class sc_vpool<sc_dt::sc_int_subref>;
93 std::stringstream msg;
94 msg <<
"sc_int_concref<T1,T2> initialization: length = " << length <<
112void sc_int_bitref::concat_set(
int64 src,
int low_i)
115 *
this = aa = (low_i < 64) ? src >> low_i : src >> 63;
118void sc_int_bitref::concat_set(
const sc_signed &src,
int low_i)
122 *
this = aa = 1 & (src >> low_i);
124 *
this = aa = (src < 0) ? (
int_type)-1 : 0;
131 *
this = aa = 1 & (src >> low_i);
136void sc_int_bitref::concat_set(
uint64 src,
int low_i)
139 *
this = aa = (low_i < 64) ? src >> low_i : 0;
145sc_int_bitref::scan(::std::istream &is)
160sc_int_subref_r::concat_get_ctrl(
sc_digit *dst_p,
int low_i)
const
168 high_i = low_i + (m_left - m_right);
170 mask = ~mask_int[m_left][m_right];
173 dst_p[dst_i] = (
sc_digit)(dst_p[dst_i] & mask);
174 switch (end_i - dst_i) {
200sc_int_subref_r::concat_get_data(
sc_digit *dst_p,
int low_i)
const
212 high_i = low_i + (m_left-m_right);
214 mask = ~mask_int[m_left][m_right];
215 val = (m_obj_p->m_val & mask) >> m_right;
219 mask = ~(~UINT_ZERO << left_shift);
220 dst_p[dst_i] = (
sc_digit)((dst_p[dst_i] & mask) |
223 switch (end_i - dst_i) {
270 val |= (v << m_right) & ~mask;
271 m_obj_p->m_val = val;
272 m_obj_p->extend_sign();
280 return (*
this = aa =
a);
287 return (*
this = aa =
a);
294 return (*
this = aa =
a);
301 return (*
this = aa =
a);
308sc_int_subref::concat_set(
int64 src,
int low_i)
311 *
this = aa = (low_i < 64) ? src >> low_i : src >> 63;
315sc_int_subref::concat_set(
const sc_signed &src,
int low_i)
319 *
this = aa = src >> low_i;
321 *
this = (src < 0) ? (
int_type)-1 : 0;
329 *
this = aa = src >> low_i;
335sc_int_subref::concat_set(
uint64 src,
int low_i)
338 *
this = aa = (low_i < 64) ? src >> low_i : 0;
344sc_int_subref::scan(::std::istream &is)
360sc_int_base::invalid_length()
const
362 std::stringstream msg;
363 msg <<
"sc_int[_base] initialization: length = " << m_len <<
370sc_int_base::invalid_index(
int i)
const
372 std::stringstream msg;
373 msg <<
"sc_int[_base] bit selection: index = " << i <<
374 " violates 0 <= index <= " << (m_len - 1);
380sc_int_base::invalid_range(
int l,
int r)
const
382 std::stringstream msg;
383 msg <<
"sc_int[_base] part selection: " <<
384 "left = " << l <<
", right = " << r <<
" violates " <<
385 (m_len-1) <<
" >= left >= right >= 0";
391sc_int_base::check_value()
const
394 if (m_val < -limit || m_val >= limit) {
395 std::stringstream msg;
396 msg <<
"sc_int[_base]: value does not fit into a length of " << m_len;
404 m_val(0), m_len(v.length()), m_ulen(
SC_INTWIDTH - m_len)
410 m_val(0), m_len(v.length()), m_ulen(
SC_INTWIDTH - m_len)
416 m_val(0), m_len(v.length()), m_ulen(
SC_INTWIDTH - m_len)
419 *
this = v.to_uint64();
422 m_val(0), m_len(v.length()), m_ulen(
SC_INTWIDTH - m_len)
425 *
this = v.to_uint64();
428 m_val(0), m_len(v.length()), m_ulen(
SC_INTWIDTH - m_len)
431 *
this = v.to_uint64();
435 m_val(0), m_len(
a.length()), m_ulen(
SC_INTWIDTH - m_len)
438 *
this =
a.to_int64();
442 m_val(0), m_len(
a.length()), m_ulen(
SC_INTWIDTH - m_len)
445 *
this =
a.to_int64();
455 for (; i < minlen; ++i) {
459 for (; i <
m_len; ++i) {
472 for (; i < minlen; ++i) {
475 for (; i <
m_len; ++i) {
489 for (; i < minlen; ++i) {
490 set(i,
a.get_bit(i));
492 for (; i <
m_len; ++i) {
505 for (; i < minlen; ++i) {
508 for (; i <
m_len; ++i) {
521 "character string is zero");
522 }
else if (*
a == 0) {
524 "character string is empty");
530 std::stringstream msg;
531 msg <<
"character string '" <<
a <<
"' is not valid";
543 return aa.to_string(numrep);
551 return aa.to_string(numrep, w_prefix);
568 val = ((val & (mask << n)) >> n) ^ (val & mask);
585 mask = ~(~UINT_ZERO << left_shift);
586 dst_p[dst_i] = (
sc_digit)(dst_p[dst_i] & mask);
588 for (; dst_i <= end_i; dst_i++)
621 high_i = low_i + (
m_len - 1);
628 mask = ~(~UINT_ZERO <<
m_len);
633 mask = (~UINT_ZERO << left_shift);
634 dst_p[dst_i] = (
sc_digit)((dst_p[dst_i] & ~mask) |
636 switch (end_i - dst_i) {
671 *
this = (low_i < 64) ? src >> low_i : src >> 63;
678 *
this = src >> low_i;
680 *
this = (src < 0) ? (
int_type)-1 : 0;
687 *
this = src >> low_i;
695 *
this = (low_i < 64) ? src >> low_i : 0;
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const
void check_length() const
sc_int_base & operator=(int_type v)
virtual bool concat_get_data(sc_digit *dst_p, int low_i) const
void scan(::std::istream &is=::std::cin)
sc_int_base(int w=sc_length_param().len())
const std::string to_string(sc_numrep numrep=SC_DEC) const
virtual void concat_set(int64 src, int low_i)
const char SC_ID_CONVERSION_FAILED_[]
const char SC_ID_OUT_OF_BOUNDS_[]
const T sc_min(const T &a, const T &b)
const uint_type mask_int[SC_INTWIDTH][SC_INTWIDTH]
void sc_int_concref_invalid_length(int length)
#define SC_REPORT_WARNING(msg_type, msg)
#define SC_REPORT_ERROR(msg_type, msg)