summaryrefslogtreecommitdiff
path: root/src/systemc/dt/bit/sc_bv_base.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-10-08 19:01:38 -0700
committerGabe Black <gabeblack@google.com>2018-10-16 01:13:23 +0000
commitc9f83ec94ba1d7de0cfc46a9a23af2f9e04450e8 (patch)
tree4993ca5a6892b108ae1bc040a23366ef326f190b /src/systemc/dt/bit/sc_bv_base.cc
parente07f7efb75f0f7322d752608eb1cb1e1145b4a98 (diff)
downloadgem5-c9f83ec94ba1d7de0cfc46a9a23af2f9e04450e8.tar.xz
systemc: Switch to using predefined messages for datatypes.
Create and use predefined messages for datatypes which match the ones Accellera uses. Change-Id: I92dd52f62462b864264217bb81f3ff1dcec020bf Reviewed-on: https://gem5-review.googlesource.com/c/13331 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/dt/bit/sc_bv_base.cc')
-rw-r--r--src/systemc/dt/bit/sc_bv_base.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/systemc/dt/bit/sc_bv_base.cc b/src/systemc/dt/bit/sc_bv_base.cc
index 84265af8d..41675d48e 100644
--- a/src/systemc/dt/bit/sc_bv_base.cc
+++ b/src/systemc/dt/bit/sc_bv_base.cc
@@ -55,6 +55,7 @@
#include <cstring>
#include <sstream>
+#include "systemc/ext/dt/bit/messages.hh"
#include "systemc/ext/dt/bit/sc_bv_base.hh"
#include "systemc/ext/dt/fx/sc_fix.hh"
#include "systemc/ext/dt/fx/sc_ufix.hh"
@@ -74,7 +75,7 @@ sc_bv_base::init(int length_, bool init_value)
{
// check the length
if (length_ <= 0) {
- SC_REPORT_ERROR("zero length", 0);
+ SC_REPORT_ERROR(sc_core::SC_ID_ZERO_LENGTH_, 0);
sc_core::sc_abort(); // can't recover from here
}
// allocate memory for the data and control words
@@ -101,7 +102,7 @@ sc_bv_base::assign_from_string(const std::string &s)
for (; i < min_len; ++i) {
char c = s[s_len - i - 1];
if (c != '0' && c != '1') {
- SC_REPORT_ERROR("cannot perform conversion",
+ SC_REPORT_ERROR(sc_core::SC_ID_CANNOT_CONVERT_,
"string can contain only '0' and '1' characters");
// may continue, if suppressed
c = '0';
@@ -161,12 +162,12 @@ convert_to_bin(const char *s)
// because this is seen as a hexadecimal encoding prefix!
if (s == 0) {
- SC_REPORT_ERROR("cannot perform conversion",
- "character string is zero");
+ SC_REPORT_ERROR(sc_core::SC_ID_CANNOT_CONVERT_,
+ "character string is zero");
return std::string();
}
if (*s == 0) {
- SC_REPORT_ERROR("cannot perform conversion",
+ SC_REPORT_ERROR(sc_core::SC_ID_CANNOT_CONVERT_,
"character string is empty");
return std::string();
}
@@ -203,7 +204,7 @@ convert_to_bin(const char *s)
} catch (const sc_core::sc_report &) {
std::stringstream msg;
msg << "character string '" << s << "' is not valid";
- SC_REPORT_ERROR("cannot perform conversion",
+ SC_REPORT_ERROR(sc_core::SC_ID_CANNOT_CONVERT_,
msg.str().c_str());
return std::string();
}