88 for (
int i = 0; i < sz; ++i) {
99 int s_len = s.length() - 1;
102 for (; i < min_len; ++i) {
103 char c = s[s_len - i - 1];
104 if (
c !=
'0' &&
c !=
'1') {
106 "string can contain only '0' and '1' characters");
115 for (; i <
len; ++i) {
124 init(s.length() - 1);
129 m_len(0), m_size(0), m_data(0)
141 for (
int i = 0; i < sz; ++i) {
166 "character string is zero");
167 return std::string();
171 "character string is empty");
172 return std::string();
177 if (s[0] ==
'-' || s[0] ==
'+') {
180 if (n > (i + 2) && s[i] ==
'0') {
181 if (s[i + 1] ==
'b' || s[i + 1] ==
'B') {
182 if (s[i + 2] ==
'0' || s[i + 2] ==
'1') {
183 std::string str(&s[2]);
188 if (s[i + 1] ==
'b' || s[i + 1] ==
'B' ||
189 s[i + 1] ==
'c' || s[i + 1] ==
'C' ||
190 s[i + 1] ==
'd' || s[i + 1] ==
'D' ||
191 s[i + 1] ==
'o' || s[i + 1] ==
'O' ||
192 s[i + 1] ==
'x' || s[i + 1] ==
'X') {
195 sc_fix a(s, n * 4, n * 4, SC_TRN, SC_WRAP, 0, SC_ON);
196 std::string str =
a.to_bin();
199 const char *p = str.c_str() + 2;
200 while (p[1] && p[0] == p[1]) {
203 return std::string(p);
205 std::stringstream msg;
206 msg <<
"character string '" << s <<
"' is not valid";
209 return std::string();
225 std::string str(
"0bus");
228 sc_ufix a(str.c_str(), n, n, SC_TRN, SC_WRAP, 0, SC_ON);
229 return a.to_string(numrep, w_prefix);
sc_bv_base & operator=(const sc_proxy< X > &a)
void init(int length_, bool init_value=false)
void set_bit(int i, value_type value)
sc_bv_base(int length_=sc_length_param().len())
void assign_from_string(const std::string &)
const char SC_ID_CANNOT_CONVERT_[]
const char SC_ID_ZERO_LENGTH_[]
const sc_digit SC_DIGIT_ZERO
const T sc_min(const T &a, const T &b)
const std::string convert_to_fmt(const std::string &s, sc_numrep numrep, bool w_prefix)
const std::string convert_to_bin(const char *s)
#define SC_REPORT_ERROR(msg_type, msg)