78template class sc_vpool<sc_dt::sc_uint_bitref>;
79template class sc_vpool<sc_dt::sc_uint_subref>;
91 std::stringstream msg;
92 msg <<
"sc_uint_concref<T1,T2> initialization: length = " << length <<
112sc_uint_bitref::concat_set(
int64 src,
int low_i)
115 *
this = aa = (low_i < 64) ? src >> low_i : src >> 63;
119sc_uint_bitref::concat_set(
const sc_signed &src,
int low_i)
123 *
this = aa = 1 & (src >> low_i);
125 *
this = aa = (src < 0) ? (
int_type)-1 : 0;
133 *
this = aa = 1 & (src >> low_i);
139sc_uint_bitref::concat_set(
uint64 src,
int low_i)
142 *
this = aa = (low_i < 64) ? src >> low_i : 0;
148sc_uint_bitref::scan(::std::istream &is)
163sc_uint_subref_r::concat_get_ctrl(
sc_digit *dst_p,
int low_i)
const
174 mask = ~(~UINT_ZERO << left_shift);
175 dst_p[dst_i] = (
sc_digit)((dst_p[dst_i] & mask));
178 for (; dst_i <= end_i; dst_i++)
185sc_uint_subref_r::concat_get_data(
sc_digit *dst_p,
int low_i)
const
197 high_i = low_i + (m_left-m_right);
199 mask = ~mask_int[m_left][m_right];
200 val = (m_obj_p->m_val & mask) >> m_right;
204 mask = ~(~UINT_ZERO << left_shift);
205 dst_p[dst_i] = (
sc_digit)(((dst_p[dst_i] & mask)) |
208 switch (end_i - dst_i) {
255 val |= (v << m_right) & ~mask;
256 m_obj_p->m_val = val;
257 m_obj_p->extend_sign();
265 return (*
this = aa =
a);
272 return (*
this = aa =
a);
279 return (*
this = aa =
a);
286 return (*
this = aa =
a);
293sc_uint_subref::concat_set(
int64 src,
int low_i)
296 *
this = aa = (low_i < 64) ? src >> low_i : src >> 63;
300sc_uint_subref::concat_set(
const sc_signed &src,
int low_i)
304 *
this = aa = src >> low_i;
306 *
this = aa = (src < 0) ? (
int_type)-1 : 0;
314 *
this = aa = src >> low_i;
320sc_uint_subref::concat_set(
uint64 src,
int low_i)
323 *
this = aa = (low_i < 64) ? src >> low_i : 0;
328sc_uint_subref::scan(::std::istream &is)
345sc_uint_base::invalid_length()
const
347 std::stringstream msg;
348 msg <<
"sc_uint[_base] initialization: length = " << m_len <<
355sc_uint_base::invalid_index(
int i)
const
357 std::stringstream msg;
358 msg <<
"sc_uint[_base] bit selection: index = " << i <<
359 " violates 0 <= index <= " << (m_len - 1);
365sc_uint_base::invalid_range(
int l,
int r)
const
367 std::stringstream msg;
368 msg <<
"sc_uint[_base] part selection: " <<
369 "left = " << l <<
", right = " << r <<
" violates " <<
370 (m_len - 1) <<
" >= left >= right >= 0";
377sc_uint_base::check_value()
const
379 uint_type limit = (~UINT_ZERO >> m_ulen);
381 std::stringstream msg;
382 msg <<
"sc_uint[_base]: value does not fit into a length of " << m_len;
390 m_val(0), m_len(v.length()), m_ulen(
SC_INTWIDTH - m_len)
396 m_val(0), m_len(v.length()), m_ulen(
SC_INTWIDTH - m_len)
402 m_val(0), m_len(v.length()), m_ulen(
SC_INTWIDTH - m_len)
405 *
this = v.to_uint64();
408 m_val(0), m_len(v.length()), m_ulen(
SC_INTWIDTH - m_len)
411 *
this = v.to_uint64();
414 m_val(0), m_len(v.length()), m_ulen(
SC_INTWIDTH - m_len)
417 *
this = v.to_uint64();
421 m_val(0), m_len(
a.length()), m_ulen(
SC_INTWIDTH - m_len)
424 *
this =
a.to_uint64();
428 m_val(0), m_len(
a.length()), m_ulen(
SC_INTWIDTH - m_len)
431 *
this =
a.to_uint64();
441 for (; i < minlen; ++i) {
445 for (; i <
m_len; ++i) {
458 for (; i < minlen; ++i) {
461 for (; i <
m_len; ++i) {
475 for (; i < minlen; ++i) {
476 set(i,
a.get_bit(i));
478 for (; i <
m_len; ++i) {
491 for (; i < minlen; ++i) {
494 for (; i <
m_len; ++i) {
507 "character string is zero");
508 }
else if (*
a == 0) {
510 "character string is empty");
516 std::stringstream msg;
517 msg <<
"character string '" <<
a <<
"' is not valid";
530 return aa.to_string(numrep);
538 return aa.to_string(numrep, w_prefix);
564 val = ((val & (mask << n)) >> n) ^ (val & mask);
583 mask = ~(~UINT_ZERO << left_shift);
584 dst_p[dst_i] = (
sc_digit)((dst_p[dst_i] & mask));
587 for (; dst_i <= end_i; dst_i++)
620 high_i = low_i + (
m_len - 1);
627 mask = ~(~UINT_ZERO <<
m_len);
632 mask = ~(~UINT_ZERO << left_shift);
633 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;
sc_uint_base(int w=sc_length_param().len())
sc_uint_base & operator=(uint_type v)
void scan(::std::istream &is=::std::cin)
void check_length() const
virtual void concat_set(int64 src, int low_i)
virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) 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 char SC_ID_CONVERSION_FAILED_[]
const char SC_ID_OUT_OF_BOUNDS_[]
void sc_uint_concref_invalid_length(int length)
const T sc_min(const T &a, const T &b)
const uint_type mask_int[SC_INTWIDTH][SC_INTWIDTH]
static const uint64 UINT_ZERO
#define SC_REPORT_WARNING(msg_type, msg)
#define SC_REPORT_ERROR(msg_type, msg)