Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12592

Change subject: systemc: "Fix" some error message formatting.
......................................................................

systemc: "Fix" some error message formatting.

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

Change-Id: I1260cec35fa39586fbef39047b9da4ff3c03b3ed
---
M src/systemc/dt/bit/sc_bit.cc
M src/systemc/dt/bit/sc_logic.cc
M src/systemc/dt/int/sc_nbutils.cc
M src/systemc/dt/int/sc_signed.cc
M src/systemc/dt/int/sc_unsigned.cc
M src/systemc/ext/dt/bit/sc_bv_base.hh
M src/systemc/ext/dt/fx/sc_fxdefs.hh
M src/systemc/ext/dt/int/sc_nbutils.hh
8 files changed, 16 insertions(+), 14 deletions(-)



diff --git a/src/systemc/dt/bit/sc_bit.cc b/src/systemc/dt/bit/sc_bit.cc
index 7572a0e..8382c88 100644
--- a/src/systemc/dt/bit/sc_bit.cc
+++ b/src/systemc/dt/bit/sc_bit.cc
@@ -77,8 +77,8 @@
 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 @@
 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
 }

diff --git a/src/systemc/dt/bit/sc_logic.cc b/src/systemc/dt/bit/sc_logic.cc
index 81663fc..4943d3d 100644
--- a/src/systemc/dt/bit/sc_logic.cc
+++ b/src/systemc/dt/bit/sc_logic.cc
@@ -72,7 +72,7 @@
 {
     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 @@
 {
     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 @@
 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);
     }
 }

diff --git a/src/systemc/dt/int/sc_nbutils.cc b/src/systemc/dt/int/sc_nbutils.cc
index df7cc55..5d2c50f 100644
--- a/src/systemc/dt/int/sc_nbutils.cc
+++ b/src/systemc/dt/int/sc_nbutils.cc
@@ -89,7 +89,7 @@
         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() );
     }
 }

diff --git a/src/systemc/dt/int/sc_signed.cc b/src/systemc/dt/int/sc_signed.cc
index 1cb7112..74660b3 100644
--- a/src/systemc/dt/int/sc_signed.cc
+++ b/src/systemc/dt/int/sc_signed.cc
@@ -132,7 +132,7 @@
 {
     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());
diff --git a/src/systemc/dt/int/sc_unsigned.cc b/src/systemc/dt/int/sc_unsigned.cc
index aca49ba..ffea95a 100644
--- a/src/systemc/dt/int/sc_unsigned.cc
+++ b/src/systemc/dt/int/sc_unsigned.cc
@@ -140,7 +140,7 @@
 {
     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());
diff --git a/src/systemc/ext/dt/bit/sc_bv_base.hh b/src/systemc/ext/dt/bit/sc_bv_base.hh
index 8aac78d..ffb3c5a 100644
--- a/src/systemc/ext/dt/bit/sc_bv_base.hh
+++ b/src/systemc/ext/dt/bit/sc_bv_base.hh
@@ -264,7 +264,7 @@
 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);
     }
 }

diff --git a/src/systemc/ext/dt/fx/sc_fxdefs.hh b/src/systemc/ext/dt/fx/sc_fxdefs.hh
index 0d76df6..8acfabf 100644
--- a/src/systemc/ext/dt/fx/sc_fxdefs.hh
+++ b/src/systemc/ext/dt/fx/sc_fxdefs.hh
@@ -243,7 +243,7 @@
 #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")
diff --git a/src/systemc/ext/dt/int/sc_nbutils.hh b/src/systemc/ext/dt/int/sc_nbutils.hh
index 9f7269e..0d3a15c 100644
--- a/src/systemc/ext/dt/int/sc_nbutils.hh
+++ b/src/systemc/ext/dt/int/sc_nbutils.hh
@@ -822,7 +822,7 @@
 {
     // 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");
 }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12592
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I1260cec35fa39586fbef39047b9da4ff3c03b3ed
Gerrit-Change-Number: 12592
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to