systemc: "Fix" some error message formatting.

These changes make the output match what Accellera outputs so that the
tests will pass.

Change-Id: I1260cec35fa39586fbef39047b9da4ff3c03b3ed
Reviewed-on: https://gem5-review.googlesource.com/c/12592
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
This commit is contained in:
Gabe Black
2018-09-05 00:06:26 -07:00
parent 1b3ff4d6a8
commit e38594f758
8 changed files with 16 additions and 14 deletions

View File

@@ -77,8 +77,8 @@ void
sc_bit::invalid_value(char c)
{
std::stringstream msg;
msg << "sc_bit('" << c << "')";
SC_REPORT_ERROR("value is not valid", msg.str().c_str());
msg << "sc_bit( '" << c << "' )";
SC_REPORT_ERROR("(E204) value is not valid", msg.str().c_str());
sc_core::sc_abort(); // can't recover from here
}
@@ -86,8 +86,8 @@ void
sc_bit::invalid_value(int i)
{
std::stringstream msg;
msg << "sc_bit(" << i << ")";
SC_REPORT_ERROR("value is not valid", msg.str().c_str());
msg << "sc_bit( " << i << " )";
SC_REPORT_ERROR("(E204) value is not valid", msg.str().c_str());
sc_core::sc_abort(); // can't recover from here
}

View File

@@ -72,7 +72,7 @@ sc_logic::invalid_value(char c)
{
std::stringstream msg;
msg << "sc_logic('" << c << "')";
SC_REPORT_ERROR("value is not valid", msg.str().c_str());
SC_REPORT_ERROR("(E204) value is not valid", msg.str().c_str());
}
void
@@ -80,7 +80,7 @@ sc_logic::invalid_value(int i)
{
std::stringstream msg;
msg << "sc_logic(" << i << ")";
SC_REPORT_ERROR("value is not valid", msg.str().c_str());
SC_REPORT_ERROR("(E204) value is not valid", msg.str().c_str());
}
@@ -88,9 +88,11 @@ void
sc_logic::invalid_01() const
{
if ((int)m_val == Log_Z) {
SC_REPORT_WARNING("sc_logic value 'Z' cannot be converted to bool", 0);
SC_REPORT_WARNING(
"(W211) sc_logic value 'Z' cannot be converted to bool", 0);
} else {
SC_REPORT_WARNING("sc_logic value 'X' cannot be converted to bool", 0);
SC_REPORT_WARNING(
"(W212) sc_logic value 'X' cannot be converted to bool", 0);
}
}

View File

@@ -89,7 +89,7 @@ is_valid_base(sc_numrep base)
std::stringstream msg;
msg << "is_valid_base( sc_numrep base ) : base = " << base <<
" is not valid";
SC_REPORT_ERROR("value is not valid", msg.str().c_str() );
SC_REPORT_ERROR("(E204) value is not valid", msg.str().c_str() );
}
}

View File

@@ -132,7 +132,7 @@ sc_signed::invalid_range(int l, int r) const
{
std::stringstream msg;
msg << "sc_bigint part selection: left = " <<
l << ", right = " << r << "\n"
l << ", right = " << r << " \n"
" violates either (" << (nbits-1) << " >= left >= 0) or "
"(" << (nbits-1) << " >= right >= 0)";
SC_REPORT_ERROR("(E5) out of bounds", msg.str().c_str());

View File

@@ -140,7 +140,7 @@ sc_unsigned::invalid_range(int l, int r) const
{
std::stringstream msg;
msg << "sc_biguint part selection: left = " <<
l << ", right = " << r << "\n"
l << ", right = " << r << " \n"
" violates either (" << (nbits - 2) << " >= left >= 0) or "
"(" << (nbits-2) << " >= right >= 0)";
SC_REPORT_ERROR("(E5) out of bounds", msg.str().c_str());

View File

@@ -264,7 +264,7 @@ inline void
sc_bv_base::set_cword(int /*i*/, sc_digit w)
{
if (w) {
SC_REPORT_WARNING("sc_bv cannot contain values X and Z", 0);
SC_REPORT_WARNING("(W207) sc_bv cannot contain values X and Z", 0);
}
}

View File

@@ -243,7 +243,7 @@ const int SC_DEFAULT_MAX_WL_ = SC_BUILTIN_MAX_WL_;
#define SC_ERROR_IF_(cnd,id) SC_ERROR_IF_IMPL_(cnd, id, 0)
#define SC_CHECK_WL_(wl) SC_ERROR_IF_((wl) <= 0, \
"total wordlength <= 0 is not valid")
"(E300) total wordlength <= 0 is not valid")
#define SC_CHECK_N_BITS_(n_bits) \
SC_ERROR_IF_((n_bits) < 0, "number of bits < 0 is not valid")

View File

@@ -822,7 +822,7 @@ is_bad_double(double v)
{
// Windows throws exception.
if (is_nan(v) || is_inf(v))
SC_REPORT_ERROR("value is not valid",
SC_REPORT_ERROR("(E204) value is not valid",
"is_bad_double(double v) : "
"v is not finite - NaN or Inf");
}