summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/systemc/dt/bit/SConscript1
-rw-r--r--src/systemc/dt/bit/messages.cc76
-rw-r--r--src/systemc/dt/bit/sc_bit.cc5
-rw-r--r--src/systemc/dt/bit/sc_bv_base.cc13
-rw-r--r--src/systemc/dt/bit/sc_logic.cc16
-rw-r--r--src/systemc/dt/bit/sc_lv_base.cc3
-rw-r--r--src/systemc/dt/fx/SConscript1
-rw-r--r--src/systemc/dt/fx/messages.cc69
-rw-r--r--src/systemc/dt/fx/sc_fxnum.cc5
-rw-r--r--src/systemc/dt/fx/scfx_rep.cc3
-rw-r--r--src/systemc/dt/int/SConscript1
-rw-r--r--src/systemc/dt/int/messages.cc53
-rw-r--r--src/systemc/dt/int/sc_int_base.cc6
-rw-r--r--src/systemc/dt/int/sc_nbutils.cc30
-rw-r--r--src/systemc/dt/int/sc_signed.cc9
-rw-r--r--src/systemc/dt/int/sc_uint_base.cc6
-rw-r--r--src/systemc/dt/int/sc_unsigned.cc9
-rw-r--r--src/systemc/dt/misc/sc_value_base.cc19
-rw-r--r--src/systemc/ext/dt/bit/_bit.hh1
-rw-r--r--src/systemc/ext/dt/bit/_using.hh14
-rw-r--r--src/systemc/ext/dt/bit/messages.hh52
-rw-r--r--src/systemc/ext/dt/bit/sc_bv_base.hh3
-rw-r--r--src/systemc/ext/dt/bit/sc_proxy.hh11
-rw-r--r--src/systemc/ext/dt/fx/_fx.hh1
-rw-r--r--src/systemc/ext/dt/fx/_using.hh12
-rw-r--r--src/systemc/ext/dt/fx/messages.hh50
-rw-r--r--src/systemc/ext/dt/fx/sc_context.hh5
-rw-r--r--src/systemc/ext/dt/fx/sc_fxdefs.hh12
-rw-r--r--src/systemc/ext/dt/fx/sc_fxnum.hh51
-rw-r--r--src/systemc/ext/dt/fx/scfx_other_defs.hh33
-rw-r--r--src/systemc/ext/dt/fx/scfx_params.hh5
-rw-r--r--src/systemc/ext/dt/int/_int.hh1
-rw-r--r--src/systemc/ext/dt/int/_using.hh5
-rw-r--r--src/systemc/ext/dt/int/messages.hh43
-rw-r--r--src/systemc/ext/dt/int/sc_nbutils.hh6
35 files changed, 513 insertions, 117 deletions
diff --git a/src/systemc/dt/bit/SConscript b/src/systemc/dt/bit/SConscript
index ed6eb35a0..e44a9d81f 100644
--- a/src/systemc/dt/bit/SConscript
+++ b/src/systemc/dt/bit/SConscript
@@ -28,6 +28,7 @@
Import('*')
if env['USE_SYSTEMC']:
+ Source('messages.cc')
Source('sc_bit.cc')
Source('sc_bv_base.cc')
Source('sc_logic.cc')
diff --git a/src/systemc/dt/bit/messages.cc b/src/systemc/dt/bit/messages.cc
new file mode 100644
index 000000000..8609b806b
--- /dev/null
+++ b/src/systemc/dt/bit/messages.cc
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2018 Google, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Gabe Black
+ */
+
+#include "systemc/ext/dt/bit/messages.hh"
+#include "systemc/utils/report.hh"
+
+namespace sc_core
+{
+
+const char SC_ID_LENGTH_MISMATCH_[] =
+ "length mismatch in bit/logic vector assignment";
+const char SC_ID_INCOMPATIBLE_TYPES_[] = "incompatible types";
+const char SC_ID_CANNOT_CONVERT_[] = "cannot perform conversion";
+const char SC_ID_INCOMPATIBLE_VECTORS_[] = "incompatible vectors";
+const char SC_ID_VALUE_NOT_VALID_[] = "value is not valid";
+const char SC_ID_ZERO_LENGTH_[] = "zero length";
+const char SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_[] =
+ "vector contains 4-value logic";
+const char SC_ID_SC_BV_CANNOT_CONTAIN_X_AND_Z_[] =
+ "sc_bv cannot contain values X and Z";
+const char SC_ID_VECTOR_TOO_LONG_[] = "vector is too long: truncated";
+const char SC_ID_VECTOR_TOO_SHORT_[] = "vector is too short: 0-padded";
+const char SC_ID_WRONG_VALUE_[] = "wrong value";
+const char SC_ID_LOGIC_Z_TO_BOOL_[] =
+ "sc_logic value 'Z' cannot be converted to bool";
+const char SC_ID_LOGIC_X_TO_BOOL_[] =
+ "sc_logic value 'X' cannot be converted to bool";
+
+namespace
+{
+
+sc_gem5::DefaultReportMessages predefinedMessages{
+ {200, SC_ID_LENGTH_MISMATCH_},
+ {201, SC_ID_INCOMPATIBLE_TYPES_},
+ {202, SC_ID_CANNOT_CONVERT_},
+ {203, SC_ID_INCOMPATIBLE_VECTORS_},
+ {204, SC_ID_VALUE_NOT_VALID_},
+ {205, SC_ID_ZERO_LENGTH_},
+ {206, SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_},
+ {207, SC_ID_SC_BV_CANNOT_CONTAIN_X_AND_Z_},
+ {208, SC_ID_VECTOR_TOO_LONG_},
+ {209, SC_ID_VECTOR_TOO_SHORT_},
+ {210, SC_ID_WRONG_VALUE_},
+ {211, SC_ID_LOGIC_Z_TO_BOOL_},
+ {212, SC_ID_LOGIC_X_TO_BOOL_}
+};
+
+} // anonymous namespace
+
+} // namespace sc_core
diff --git a/src/systemc/dt/bit/sc_bit.cc b/src/systemc/dt/bit/sc_bit.cc
index e2e157905..e386b190d 100644
--- a/src/systemc/dt/bit/sc_bit.cc
+++ b/src/systemc/dt/bit/sc_bit.cc
@@ -58,6 +58,7 @@
#include <sstream>
+#include "systemc/ext/dt/bit/messages.hh"
#include "systemc/ext/dt/bit/sc_bit.hh"
#include "systemc/ext/dt/bit/sc_logic.hh"
#include "systemc/ext/utils/messages.hh"
@@ -79,7 +80,7 @@ sc_bit::invalid_value(char c)
{
std::stringstream msg;
msg << "sc_bit( '" << c << "' )";
- SC_REPORT_ERROR("(E204) value is not valid", msg.str().c_str());
+ SC_REPORT_ERROR(sc_core::SC_ID_VALUE_NOT_VALID_, msg.str().c_str());
sc_core::sc_abort(); // can't recover from here
}
@@ -88,7 +89,7 @@ sc_bit::invalid_value(int i)
{
std::stringstream msg;
msg << "sc_bit( " << i << " )";
- SC_REPORT_ERROR("(E204) value is not valid", msg.str().c_str());
+ SC_REPORT_ERROR(sc_core::SC_ID_VALUE_NOT_VALID_, msg.str().c_str());
sc_core::sc_abort(); // can't recover from here
}
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();
}
diff --git a/src/systemc/dt/bit/sc_logic.cc b/src/systemc/dt/bit/sc_logic.cc
index 4943d3df1..876fd3570 100644
--- a/src/systemc/dt/bit/sc_logic.cc
+++ b/src/systemc/dt/bit/sc_logic.cc
@@ -48,6 +48,7 @@
#include <sstream>
+#include "systemc/ext/dt/bit/messages.hh"
#include "systemc/ext/dt/bit/sc_logic.hh"
#include "systemc/ext/utils/sc_report_handler.hh"
@@ -72,7 +73,7 @@ sc_logic::invalid_value(char c)
{
std::stringstream msg;
msg << "sc_logic('" << c << "')";
- SC_REPORT_ERROR("(E204) value is not valid", msg.str().c_str());
+ SC_REPORT_ERROR(sc_core::SC_ID_VALUE_NOT_VALID_, msg.str().c_str());
}
void
@@ -80,20 +81,17 @@ sc_logic::invalid_value(int i)
{
std::stringstream msg;
msg << "sc_logic(" << i << ")";
- SC_REPORT_ERROR("(E204) value is not valid", msg.str().c_str());
+ SC_REPORT_ERROR(sc_core::SC_ID_VALUE_NOT_VALID_, msg.str().c_str());
}
void
sc_logic::invalid_01() const
{
- if ((int)m_val == Log_Z) {
- SC_REPORT_WARNING(
- "(W211) sc_logic value 'Z' cannot be converted to bool", 0);
- } else {
- SC_REPORT_WARNING(
- "(W212) sc_logic value 'X' cannot be converted to bool", 0);
- }
+ if ((int)m_val == Log_Z)
+ SC_REPORT_WARNING(sc_core::SC_ID_LOGIC_Z_TO_BOOL_, 0);
+ else
+ SC_REPORT_WARNING(sc_core::SC_ID_LOGIC_X_TO_BOOL_, 0);
}
diff --git a/src/systemc/dt/bit/sc_lv_base.cc b/src/systemc/dt/bit/sc_lv_base.cc
index de2d655db..ae5d52a8a 100644
--- a/src/systemc/dt/bit/sc_lv_base.cc
+++ b/src/systemc/dt/bit/sc_lv_base.cc
@@ -50,6 +50,7 @@
#include <sstream>
+#include "systemc/ext/dt/bit/messages.hh"
#include "systemc/ext/dt/bit/sc_lv_base.hh"
#include "systemc/ext/utils/messages.hh"
@@ -90,7 +91,7 @@ sc_lv_base::init(int length_, const sc_logic& 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
diff --git a/src/systemc/dt/fx/SConscript b/src/systemc/dt/fx/SConscript
index 698496cf4..824e47d6f 100644
--- a/src/systemc/dt/fx/SConscript
+++ b/src/systemc/dt/fx/SConscript
@@ -28,6 +28,7 @@
Import('*')
if env['USE_SYSTEMC']:
+ Source('messages.cc')
Source('sc_fxcast_switch.cc')
Source('sc_fxdefs.cc')
Source('scfx_mant.cc')
diff --git a/src/systemc/dt/fx/messages.cc b/src/systemc/dt/fx/messages.cc
new file mode 100644
index 000000000..f1034db13
--- /dev/null
+++ b/src/systemc/dt/fx/messages.cc
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2018 Google, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Gabe Black
+ */
+
+#include "systemc/ext/dt/fx/messages.hh"
+#include "systemc/utils/report.hh"
+
+namespace sc_core
+{
+
+const char SC_ID_INVALID_WL_[] = "total wordlength <= 0 is not valid";
+const char SC_ID_INVALID_N_BITS_[] = "number of bits < 0 is not valid";
+const char SC_ID_INVALID_DIV_WL_[] = "division wordlength <= 0 is not valid";
+const char SC_ID_INVALID_CTE_WL_[] = "constant wordlength <= 0 is not valid";
+const char SC_ID_INVALID_MAX_WL_[] =
+ "maximum wordlength <= 0 and != -1 is not valid";
+const char SC_ID_INVALID_FX_VALUE_[] = "invalid fixed-point value";
+const char SC_ID_INVALID_O_MODE_[] = "invalid overflow mode";
+const char SC_ID_OUT_OF_RANGE_[] = "index out of range";
+const char SC_ID_CONTEXT_BEGIN_FAILED_[] = "context begin failed";
+const char SC_ID_CONTEXT_END_FAILED_[] = "context end failed";
+const char SC_ID_WRAP_SM_NOT_DEFINED_[] =
+ "SC_WRAP_SM not defined for unsigned numbers";
+
+namespace
+{
+
+sc_gem5::DefaultReportMessages predefinedMessages{
+ {300, SC_ID_INVALID_WL_},
+ {301, SC_ID_INVALID_N_BITS_},
+ {302, SC_ID_INVALID_DIV_WL_},
+ {303, SC_ID_INVALID_CTE_WL_},
+ {304, SC_ID_INVALID_MAX_WL_},
+ {305, SC_ID_INVALID_FX_VALUE_},
+ {306, SC_ID_INVALID_O_MODE_},
+ {307, SC_ID_OUT_OF_RANGE_},
+ {308, SC_ID_CONTEXT_BEGIN_FAILED_},
+ {309, SC_ID_CONTEXT_END_FAILED_},
+ {310, SC_ID_WRAP_SM_NOT_DEFINED_}
+};
+
+} // anonymous namespace
+
+} // namespace sc_core
diff --git a/src/systemc/dt/fx/sc_fxnum.cc b/src/systemc/dt/fx/sc_fxnum.cc
index f47b4d342..d11a28774 100644
--- a/src/systemc/dt/fx/sc_fxnum.cc
+++ b/src/systemc/dt/fx/sc_fxnum.cc
@@ -53,6 +53,7 @@
#include <cmath>
+#include "systemc/ext/dt/fx/messages.hh"
#include "systemc/ext/dt/fx/sc_fxnum.hh"
namespace sc_dt
@@ -503,7 +504,7 @@ overflow(double &c, const scfx_params &params, bool &o_flag)
case SC_WRAP_SM: // sign magnitude wrap-around
{
SC_ERROR_IF_(params.enc() == SC_US_,
- "SC_WRAP_SM not defined for unsigned numbers");
+ sc_core::SC_ID_WRAP_SM_NOT_DEFINED_);
int n_bits = params.n_bits();
@@ -564,7 +565,7 @@ void
sc_fxnum_fast::cast()
{
scfx_ieee_double id(m_val);
- SC_ERROR_IF_(id.is_nan() || id.is_inf(), "invalid fixed-point value");
+ SC_ERROR_IF_(id.is_nan() || id.is_inf(), sc_core::SC_ID_INVALID_FX_VALUE_);
if (m_params.cast_switch() == SC_ON) {
m_q_flag = false;
diff --git a/src/systemc/dt/fx/scfx_rep.cc b/src/systemc/dt/fx/scfx_rep.cc
index f94c5eae0..3666e6a0f 100644
--- a/src/systemc/dt/fx/scfx_rep.cc
+++ b/src/systemc/dt/fx/scfx_rep.cc
@@ -66,6 +66,7 @@
#include "base/compiler.hh"
#include "systemc/ext/dt/bit/sc_bv_base.hh"
#include "systemc/ext/dt/bit/sc_lv_base.hh"
+#include "systemc/ext/dt/fx/messages.hh"
#include "systemc/ext/dt/fx/scfx_ieee.hh"
#include "systemc/ext/dt/fx/scfx_pow10.hh"
#include "systemc/ext/dt/fx/scfx_rep.hh"
@@ -1963,7 +1964,7 @@ scfx_rep::overflow(const scfx_params &params, bool &o_flag)
case SC_WRAP_SM: // sign magnitude wrap-around
{
SC_ERROR_IF_(enc == SC_US_,
- "SC_WRAP_SM not defined for unsigned numbers");
+ sc_core::SC_ID_WRAP_SM_NOT_DEFINED_);
int n_bits = params.n_bits();
diff --git a/src/systemc/dt/int/SConscript b/src/systemc/dt/int/SConscript
index 93e01b243..3721c2f08 100644
--- a/src/systemc/dt/int/SConscript
+++ b/src/systemc/dt/int/SConscript
@@ -28,6 +28,7 @@
Import('*')
if env['USE_SYSTEMC']:
+ Source('messages.cc')
Source('sc_int_base.cc')
Source('sc_int_mask.cc')
Source('sc_length_param.cc')
diff --git a/src/systemc/dt/int/messages.cc b/src/systemc/dt/int/messages.cc
new file mode 100644
index 000000000..945f2cd0e
--- /dev/null
+++ b/src/systemc/dt/int/messages.cc
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2018 Google, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Gabe Black
+ */
+
+#include "systemc/ext/dt/int/messages.hh"
+#include "systemc/utils/report.hh"
+
+namespace sc_core
+{
+
+const char SC_ID_INIT_FAILED_[] = "initialization failed";
+const char SC_ID_ASSIGNMENT_FAILED_[] = "assignment failed";
+const char SC_ID_OPERATION_FAILED_[] = "operation failed";
+const char SC_ID_CONVERSION_FAILED_[] = "conversion failed";
+
+namespace
+{
+
+sc_gem5::DefaultReportMessages predefinedMessages{
+ {400, SC_ID_INIT_FAILED_},
+ {401, SC_ID_ASSIGNMENT_FAILED_},
+ {402, SC_ID_OPERATION_FAILED_},
+ {403, SC_ID_CONVERSION_FAILED_}
+};
+
+} // anonymous namespace
+
+} // namespace sc_core
diff --git a/src/systemc/dt/int/sc_int_base.cc b/src/systemc/dt/int/sc_int_base.cc
index 69b62d128..ec4e96b59 100644
--- a/src/systemc/dt/int/sc_int_base.cc
+++ b/src/systemc/dt/int/sc_int_base.cc
@@ -517,10 +517,10 @@ sc_int_base &
sc_int_base::operator = (const char *a)
{
if (a == 0) {
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
"character string is zero");
} else if (*a == 0) {
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
"character string is empty");
} else try {
int len = m_len;
@@ -529,7 +529,7 @@ sc_int_base::operator = (const char *a)
} catch(const sc_core::sc_report &) {
std::stringstream msg;
msg << "character string '" << a << "' is not valid";
- SC_REPORT_ERROR("conversion failed", msg.str().c_str());
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_, msg.str().c_str());
}
return *this;
}
diff --git a/src/systemc/dt/int/sc_nbutils.cc b/src/systemc/dt/int/sc_nbutils.cc
index 5d2c50fc9..a78013d77 100644
--- a/src/systemc/dt/int/sc_nbutils.cc
+++ b/src/systemc/dt/int/sc_nbutils.cc
@@ -61,6 +61,8 @@
#include <cstring>
#include <sstream>
+#include "systemc/ext/dt/bit/messages.hh"
+#include "systemc/ext/dt/int/messages.hh"
#include "systemc/ext/dt/int/sc_nbutils.hh"
#include "systemc/ext/utils/functions.hh"
@@ -89,7 +91,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("(E204) value is not valid", msg.str().c_str() );
+ SC_REPORT_ERROR(sc_core::SC_ID_VALUE_NOT_VALID_, msg.str().c_str());
}
}
@@ -233,7 +235,7 @@ get_base_and_sign(const char *v, small_type &b, small_type &s)
static const char msg[] =
"get_base_and_sign( const char* v, small_type&, small_type& ) : "
"v = \"\" is not valid";
- SC_REPORT_ERROR("conversion failed", msg);
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_, msg);
}
return v;
}
@@ -264,12 +266,12 @@ parse_binary_bits(const char *src_p, int dst_n,
// MAKE SURE WE HAVE A STRING TO PARSE:
if (src_p == 0) {
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
"character string is zero");
return;
}
if (*src_p == 0) {
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
"character string is empty");
return;
}
@@ -321,7 +323,7 @@ parse_binary_bits(const char *src_p, int dst_n,
std::stringstream msg;
msg << "character string '" << src_p <<
"' is not valid";
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
msg.str().c_str());
return;
}
@@ -352,7 +354,7 @@ parse_binary_bits(const char *src_p, int dst_n,
std::stringstream msg;
msg << "character string '" << src_p <<
"' is not valid";
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
msg.str().c_str());
return;
}
@@ -393,12 +395,12 @@ parse_hex_bits(const char *src_p, int dst_n,
// MAKE SURE WE HAVE A STRING TO PARSE:
if (src_p == 0) {
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
"character string is zero");
return;
}
if (*src_p == 0) {
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
"character string is empty");
return;
}
@@ -468,7 +470,7 @@ parse_hex_bits(const char *src_p, int dst_n,
std::stringstream msg;
msg << "character string '" << src_p <<
"' is not valid";
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
msg.str().c_str());
return;
}
@@ -518,7 +520,7 @@ parse_hex_bits(const char *src_p, int dst_n,
{
std::stringstream msg;
msg << "character string '" << src_p << "' is not valid";
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
msg.str().c_str() );
return;
}
@@ -561,7 +563,7 @@ vec_from_str(int unb, int und, sc_digit *u, const char *v, sc_numrep base)
msg << "vec_from_str( int, int, sc_digit*, const char*, " <<
"sc_numrep base ) : base = " << base <<
" does not match the default base";
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
msg.str().c_str());
return 0;
}
@@ -584,7 +586,7 @@ vec_from_str(int unb, int und, sc_digit *u, const char *v, sc_numrep base)
msg << "vec_from_str( int, int, sc_digit*, const char*, " <<
"sc_numrep base ) : '" << *v << "' is not a valid " <<
"digit in base " << b;
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
msg.str().c_str());
return 0;
}
@@ -599,7 +601,7 @@ vec_from_str(int unb, int und, sc_digit *u, const char *v, sc_numrep base)
msg << "vec_from_str( int, int, sc_digit*, const char*, " <<
"sc_numrep base ) : '" << *v << "' is not a valid " <<
"digit in base " << b;
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
msg.str().c_str());
return 0;
}
@@ -1703,7 +1705,7 @@ vec_reverse(int unb, int und, sc_digit *ud, int l, int r)
std::stringstream msg;
msg << "vec_reverse( int, int, sc_digit*, int l, int r ) : " <<
"l = " << l << " < r = " << r << " is not valid",
- SC_REPORT_ERROR("conversion failed", msg.str().c_str());
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_, msg.str().c_str());
return;
}
diff --git a/src/systemc/dt/int/sc_signed.cc b/src/systemc/dt/int/sc_signed.cc
index cbb688523..97dd8eb8f 100644
--- a/src/systemc/dt/int/sc_signed.cc
+++ b/src/systemc/dt/int/sc_signed.cc
@@ -82,6 +82,7 @@
#include "systemc/ext/dt/bit/sc_lv_base.hh"
#include "systemc/ext/dt/fx/sc_fix.hh"
#include "systemc/ext/dt/fx/scfx_other_defs.hh"
+#include "systemc/ext/dt/int/messages.hh"
#include "systemc/ext/dt/int/sc_int_base.hh"
#include "systemc/ext/dt/int/sc_signed.hh"
#include "systemc/ext/dt/int/sc_uint_base.hh"
@@ -110,7 +111,7 @@ sc_signed::invalid_init(const char *type_name, int nb) const
{
std::stringstream msg;
msg << "sc_signed("<< type_name << ") : nb = " << nb << " is not valid";
- SC_REPORT_ERROR("initialization failed", msg.str().c_str());
+ SC_REPORT_ERROR(sc_core::SC_ID_INIT_FAILED_, msg.str().c_str());
}
// ----------------------------------------------------------------------------
@@ -440,10 +441,10 @@ const sc_signed &
sc_signed::operator = (const char *a)
{
if (a == 0) {
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
"character string is zero");
} else if (*a == 0) {
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
"character string is empty");
} else try {
int len = length();
@@ -452,7 +453,7 @@ sc_signed::operator = (const char *a)
} catch(const sc_core::sc_report &) {
std::stringstream msg;
msg << "character string '" << a << "' is not valid";
- SC_REPORT_ERROR("conversion failed", msg.str().c_str());
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_, msg.str().c_str());
}
return *this;
}
diff --git a/src/systemc/dt/int/sc_uint_base.cc b/src/systemc/dt/int/sc_uint_base.cc
index a6053813f..fc6107f12 100644
--- a/src/systemc/dt/int/sc_uint_base.cc
+++ b/src/systemc/dt/int/sc_uint_base.cc
@@ -503,10 +503,10 @@ sc_uint_base &
sc_uint_base::operator = (const char *a)
{
if (a == 0) {
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
"character string is zero");
} else if (*a == 0) {
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
"character string is empty");
} else try {
int len = m_len;
@@ -515,7 +515,7 @@ sc_uint_base::operator = (const char *a)
} catch(const sc_core::sc_report &) {
std::stringstream msg;
msg << "character string '" << a << "' is not valid";
- SC_REPORT_ERROR("conversion failed", msg.str().c_str());
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_, msg.str().c_str());
}
return *this;
}
diff --git a/src/systemc/dt/int/sc_unsigned.cc b/src/systemc/dt/int/sc_unsigned.cc
index b358c5cd3..63e9f366b 100644
--- a/src/systemc/dt/int/sc_unsigned.cc
+++ b/src/systemc/dt/int/sc_unsigned.cc
@@ -84,6 +84,7 @@
#include "systemc/ext/dt/bit/sc_lv_base.hh"
#include "systemc/ext/dt/fx/sc_ufix.hh"
#include "systemc/ext/dt/fx/scfx_other_defs.hh"
+#include "systemc/ext/dt/int/messages.hh"
#include "systemc/ext/dt/int/sc_int_base.hh"
#include "systemc/ext/dt/int/sc_signed.hh"
#include "systemc/ext/dt/int/sc_uint_base.hh"
@@ -118,7 +119,7 @@ sc_unsigned::invalid_init(const char *type_name, int nb) const
{
std::stringstream msg;
msg << "sc_unsigned("<< type_name << ") : nb = " << nb << " is not valid";
- SC_REPORT_ERROR("initialization failed", msg.str().c_str());
+ SC_REPORT_ERROR(sc_core::SC_ID_INIT_FAILED_, msg.str().c_str());
}
@@ -438,10 +439,10 @@ const sc_unsigned &
sc_unsigned::operator = (const char *a)
{
if (a == 0) {
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
"character string is zero");
} else if (*a == 0) {
- SC_REPORT_ERROR("conversion failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
"character string is empty");
} else try {
int len = length();
@@ -450,7 +451,7 @@ sc_unsigned::operator = (const char *a)
} catch(const sc_core::sc_report &) {
std::stringstream msg;
msg << "character string '" << a << "' is not valid";
- SC_REPORT_ERROR("conversion failed", msg.str().c_str());
+ SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_, msg.str().c_str());
}
return *this;
}
diff --git a/src/systemc/dt/misc/sc_value_base.cc b/src/systemc/dt/misc/sc_value_base.cc
index 774f58391..ecd822e4d 100644
--- a/src/systemc/dt/misc/sc_value_base.cc
+++ b/src/systemc/dt/misc/sc_value_base.cc
@@ -52,6 +52,7 @@
#include <cstdio>
#include <cstdlib>
+#include "systemc/ext/dt/int/messages.hh"
#include "systemc/ext/dt/misc/sc_value_base.hh"
#include "systemc/ext/utils/sc_report_handler.hh"
@@ -63,7 +64,7 @@ sc_value_base::concat_clear_data(bool /* to_ones */)
{
static const char error_message[] =
"concat_clear_data method not supported by this type";
- SC_REPORT_ERROR("operation failed", error_message);
+ SC_REPORT_ERROR(sc_core::SC_ID_OPERATION_FAILED_, error_message);
}
bool
@@ -71,7 +72,7 @@ sc_value_base::concat_get_ctrl(sc_digit * /*dst_p*/, int /*low_i*/) const
{
static const char error_message[] =
"concat_get_ctrl method not supported by this type";
- SC_REPORT_ERROR("operation failed", error_message);
+ SC_REPORT_ERROR(sc_core::SC_ID_OPERATION_FAILED_, error_message);
return false;
}
@@ -80,7 +81,7 @@ sc_value_base::concat_get_data(sc_digit * /*dst_p*/, int /*low_i*/) const
{
static const char error_message[] =
"concat_get_data method not supported by this type";
- SC_REPORT_ERROR("operation failed", error_message);
+ SC_REPORT_ERROR(sc_core::SC_ID_OPERATION_FAILED_, error_message);
return false;
}
@@ -89,7 +90,7 @@ sc_value_base::concat_get_uint64() const
{
static const char error_message[] =
"concat_get_uint64 method not supported by this type";
- SC_REPORT_ERROR("operation failed", error_message);
+ SC_REPORT_ERROR(sc_core::SC_ID_OPERATION_FAILED_, error_message);
return 0;
}
@@ -98,7 +99,7 @@ sc_value_base::concat_length(bool * /*xz_present_p*/) const
{
static const char error_message[] =
"concat_length method not supported by this type";
- SC_REPORT_ERROR("operation failed", error_message);
+ SC_REPORT_ERROR(sc_core::SC_ID_OPERATION_FAILED_, error_message);
return 0;
}
@@ -107,7 +108,7 @@ sc_value_base::concat_set(int64 /*src*/, int /*low_i*/)
{
static const char error_message[] =
"concat_set(int64) method not supported by this type";
- SC_REPORT_ERROR("operation failed", error_message);
+ SC_REPORT_ERROR(sc_core::SC_ID_OPERATION_FAILED_, error_message);
}
void
@@ -115,7 +116,7 @@ sc_value_base::concat_set(const sc_signed &/*src*/, int /*low_i*/)
{
static const char error_message[] =
"concat_set(sc_signed) method not supported by this type";
- SC_REPORT_ERROR("operation failed", error_message);
+ SC_REPORT_ERROR(sc_core::SC_ID_OPERATION_FAILED_, error_message);
}
void
@@ -123,7 +124,7 @@ sc_value_base::concat_set(const sc_unsigned &/*src*/, int /*low_i*/)
{
static const char error_message[] =
"concat_set(sc_unsigned) method not supported by this type";
- SC_REPORT_ERROR("operation failed", error_message);
+ SC_REPORT_ERROR(sc_core::SC_ID_OPERATION_FAILED_, error_message);
}
void
@@ -131,7 +132,7 @@ sc_value_base::concat_set(uint64 /*src*/, int /*low_i*/)
{
static const char error_message[] =
"concat_set(uint64) method not supported by this type";
- SC_REPORT_ERROR("operation failed", error_message);
+ SC_REPORT_ERROR(sc_core::SC_ID_OPERATION_FAILED_, error_message);
}
} // namespace sc_dt
diff --git a/src/systemc/ext/dt/bit/_bit.hh b/src/systemc/ext/dt/bit/_bit.hh
index b549e2828..503c44df5 100644
--- a/src/systemc/ext/dt/bit/_bit.hh
+++ b/src/systemc/ext/dt/bit/_bit.hh
@@ -30,6 +30,7 @@
#ifndef __SYSTEMC_EXT_DT_BIT__BIT_HH__
#define __SYSTEMC_EXT_DT_BIT__BIT_HH__
+#include "messages.hh"
#include "sc_bit.hh"
#include "sc_bit_proxies.hh"
#include "sc_bv.hh"
diff --git a/src/systemc/ext/dt/bit/_using.hh b/src/systemc/ext/dt/bit/_using.hh
index 8bc747957..4d7251a18 100644
--- a/src/systemc/ext/dt/bit/_using.hh
+++ b/src/systemc/ext/dt/bit/_using.hh
@@ -42,4 +42,18 @@ using sc_dt::sc_bv_base;
using sc_dt::sc_lv;
using sc_dt::sc_lv_base;
+using sc_core::SC_ID_LENGTH_MISMATCH_;
+using sc_core::SC_ID_INCOMPATIBLE_TYPES_;
+using sc_core::SC_ID_CANNOT_CONVERT_;
+using sc_core::SC_ID_INCOMPATIBLE_VECTORS_;
+using sc_core::SC_ID_VALUE_NOT_VALID_;
+using sc_core::SC_ID_ZERO_LENGTH_;
+using sc_core::SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_;
+using sc_core::SC_ID_SC_BV_CANNOT_CONTAIN_X_AND_Z_;
+using sc_core::SC_ID_VECTOR_TOO_LONG_;
+using sc_core::SC_ID_VECTOR_TOO_SHORT_;
+using sc_core::SC_ID_WRONG_VALUE_;
+using sc_core::SC_ID_LOGIC_Z_TO_BOOL_;
+using sc_core::SC_ID_LOGIC_X_TO_BOOL_;
+
#endif //__SYSTEMC_EXT_DT_BIT__USING_HH__
diff --git a/src/systemc/ext/dt/bit/messages.hh b/src/systemc/ext/dt/bit/messages.hh
new file mode 100644
index 000000000..4a8fafa49
--- /dev/null
+++ b/src/systemc/ext/dt/bit/messages.hh
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2018 Google, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Gabe Black
+ */
+
+#ifndef __SYSTEMC_EXT_DT_BIT_MESSAGES_HH__
+#define __SYSTEMC_EXT_DT_BIT_MESSAGES_HH__
+
+namespace sc_core
+{
+
+extern const char SC_ID_LENGTH_MISMATCH_[];
+extern const char SC_ID_INCOMPATIBLE_TYPES_[];
+extern const char SC_ID_CANNOT_CONVERT_[];
+extern const char SC_ID_INCOMPATIBLE_VECTORS_[];
+extern const char SC_ID_VALUE_NOT_VALID_[];
+extern const char SC_ID_ZERO_LENGTH_[];
+extern const char SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_[];
+extern const char SC_ID_SC_BV_CANNOT_CONTAIN_X_AND_Z_[];
+extern const char SC_ID_VECTOR_TOO_LONG_[];
+extern const char SC_ID_VECTOR_TOO_SHORT_[];
+extern const char SC_ID_WRONG_VALUE_[];
+extern const char SC_ID_LOGIC_Z_TO_BOOL_[];
+extern const char SC_ID_LOGIC_X_TO_BOOL_[];
+
+} // namespace sc_core
+
+#endif // __SYSTEMC_EXT_DT_BIT_MESSAGES_HH__
diff --git a/src/systemc/ext/dt/bit/sc_bv_base.hh b/src/systemc/ext/dt/bit/sc_bv_base.hh
index ffb3c5a03..fdc234db3 100644
--- a/src/systemc/ext/dt/bit/sc_bv_base.hh
+++ b/src/systemc/ext/dt/bit/sc_bv_base.hh
@@ -54,6 +54,7 @@
#define __SYSTEMC_EXT_DT_BIT_SC_BV_BASE_HH__
#include "../int/sc_length_param.hh"
+#include "messages.hh"
#include "sc_bit_proxies.hh"
#include "sc_proxy.hh"
@@ -264,7 +265,7 @@ inline void
sc_bv_base::set_cword(int /*i*/, sc_digit w)
{
if (w) {
- SC_REPORT_WARNING("(W207) sc_bv cannot contain values X and Z", 0);
+ SC_REPORT_WARNING(sc_core::SC_ID_SC_BV_CANNOT_CONTAIN_X_AND_Z_, 0);
}
}
diff --git a/src/systemc/ext/dt/bit/sc_proxy.hh b/src/systemc/ext/dt/bit/sc_proxy.hh
index 12e10725a..c20813926 100644
--- a/src/systemc/ext/dt/bit/sc_proxy.hh
+++ b/src/systemc/ext/dt/bit/sc_proxy.hh
@@ -68,6 +68,7 @@
#include "../int/sc_signed.hh"
#include "../int/sc_uint_base.hh"
#include "../int/sc_unsigned.hh"
+#include "messages.hh"
#include "sc_bit.hh"
#include "sc_logic.hh"
@@ -1261,7 +1262,7 @@ sc_proxy<X>::to_anything_unsigned() const
const X &x = back_cast();
int len = x.length();
if (x.get_cword(0) != SC_DIGIT_ZERO) {
- SC_REPORT_WARNING("vector contains 4-value logic", 0);
+ SC_REPORT_WARNING(sc_core::SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_, 0);
}
sc_digit w = x.get_word(0);
if (len >= SC_DIGIT_SIZE) {
@@ -1279,12 +1280,12 @@ sc_proxy<X>::to_uint64() const
const X &x = back_cast();
int len = x.length();
if (x.get_cword(0) != SC_DIGIT_ZERO) {
- SC_REPORT_WARNING("vector contains 4-value logic", 0);
+ SC_REPORT_WARNING(sc_core::SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_, 0);
}
uint64 w = x.get_word(0);
if (len > SC_DIGIT_SIZE) {
if (x.get_cword(1) != SC_DIGIT_ZERO) {
- SC_REPORT_WARNING("vector contains 4-value logic", 0);
+ SC_REPORT_WARNING(sc_core::SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_, 0);
}
uint64 w1 = x.get_word(1);
w = w | (w1 << SC_DIGIT_SIZE);
@@ -1306,11 +1307,11 @@ sc_proxy<X>::to_anything_signed() const
if (len > SC_DIGIT_SIZE) {
if (x.get_cword(1) != SC_DIGIT_ZERO)
- SC_REPORT_WARNING("vector contains 4-value logic", 0);
+ SC_REPORT_WARNING(sc_core::SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_, 0);
w = x.get_word(1);
}
if (x.get_cword(0) != SC_DIGIT_ZERO)
- SC_REPORT_WARNING("vector contains 4-value logic", 0);
+ SC_REPORT_WARNING(sc_core::SC_ID_VECTOR_CONTAINS_LOGIC_VALUE_, 0);
w = (w << SC_DIGIT_SIZE) | x.get_word(0);
if (len >= 64) {
return w;
diff --git a/src/systemc/ext/dt/fx/_fx.hh b/src/systemc/ext/dt/fx/_fx.hh
index e21acb657..85f9841f8 100644
--- a/src/systemc/ext/dt/fx/_fx.hh
+++ b/src/systemc/ext/dt/fx/_fx.hh
@@ -30,6 +30,7 @@
#ifndef __SYSTEMC_EXT_CORE_DT_FX__FX_HH__
#define __SYSTEMC_EXT_CORE_DT_FX__FX_HH__
+#include "messages.hh"
#include "sc_context.hh"
#include "sc_fix.hh"
#include "sc_fixed.hh"
diff --git a/src/systemc/ext/dt/fx/_using.hh b/src/systemc/ext/dt/fx/_using.hh
index d6b17f386..97fe540a3 100644
--- a/src/systemc/ext/dt/fx/_using.hh
+++ b/src/systemc/ext/dt/fx/_using.hh
@@ -73,4 +73,16 @@ using sc_dt::sc_context_begin;
using sc_dt::SC_NOW;
using sc_dt::SC_LATER;
+using sc_core::SC_ID_INVALID_WL_;
+using sc_core::SC_ID_INVALID_N_BITS_;
+using sc_core::SC_ID_INVALID_DIV_WL_;
+using sc_core::SC_ID_INVALID_CTE_WL_;
+using sc_core::SC_ID_INVALID_MAX_WL_;
+using sc_core::SC_ID_INVALID_FX_VALUE_;
+using sc_core::SC_ID_INVALID_O_MODE_;
+using sc_core::SC_ID_OUT_OF_RANGE_;
+using sc_core::SC_ID_CONTEXT_BEGIN_FAILED_;
+using sc_core::SC_ID_CONTEXT_END_FAILED_;
+using sc_core::SC_ID_WRAP_SM_NOT_DEFINED_;
+
#endif //__SYSTEMC_EXT_DT_FX__USING_HH__
diff --git a/src/systemc/ext/dt/fx/messages.hh b/src/systemc/ext/dt/fx/messages.hh
new file mode 100644
index 000000000..3ddd964bd
--- /dev/null
+++ b/src/systemc/ext/dt/fx/messages.hh
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2018 Google, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Gabe Black
+ */
+
+#ifndef __SYSTEMC_EXT_DT_FX_MESSAGES_HH__
+#define __SYSTEMC_EXT_DT_FX_MESSAGES_HH__
+
+namespace sc_core
+{
+
+extern const char SC_ID_INVALID_WL_[];
+extern const char SC_ID_INVALID_N_BITS_[];
+extern const char SC_ID_INVALID_DIV_WL_[];
+extern const char SC_ID_INVALID_CTE_WL_[];
+extern const char SC_ID_INVALID_MAX_WL_[];
+extern const char SC_ID_INVALID_FX_VALUE_[];
+extern const char SC_ID_INVALID_O_MODE_[];
+extern const char SC_ID_OUT_OF_RANGE_[];
+extern const char SC_ID_CONTEXT_BEGIN_FAILED_[];
+extern const char SC_ID_CONTEXT_END_FAILED_[];
+extern const char SC_ID_WRAP_SM_NOT_DEFINED_[];
+
+} // namespace sc_core
+
+#endif // __SYSTEMC_EXT_DT_FX_MESSAGES_HH__
diff --git a/src/systemc/ext/dt/fx/sc_context.hh b/src/systemc/ext/dt/fx/sc_context.hh
index 075d38401..23c3fbbd7 100644
--- a/src/systemc/ext/dt/fx/sc_context.hh
+++ b/src/systemc/ext/dt/fx/sc_context.hh
@@ -62,6 +62,7 @@
#include "../../core/sc_process_handle.hh"
#include "../../utils/sc_report_handler.hh"
+#include "messages.hh"
namespace sc_dt
{
@@ -245,7 +246,7 @@ sc_context<T>::begin()
m_old_value_ptr = m_def_value_ptr;
m_def_value_ptr = &m_value;
} else {
- SC_REPORT_ERROR("context begin failed", 0);
+ SC_REPORT_ERROR(sc_core::SC_ID_CONTEXT_BEGIN_FAILED_, 0);
}
}
@@ -257,7 +258,7 @@ sc_context<T>::end()
m_def_value_ptr = m_old_value_ptr;
m_old_value_ptr = 0;
} else {
- SC_REPORT_ERROR("context end failed", 0);
+ SC_REPORT_ERROR(sc_core::SC_ID_CONTEXT_END_FAILED_, 0);
}
}
diff --git a/src/systemc/ext/dt/fx/sc_fxdefs.hh b/src/systemc/ext/dt/fx/sc_fxdefs.hh
index f31867ebc..f563a78ab 100644
--- a/src/systemc/ext/dt/fx/sc_fxdefs.hh
+++ b/src/systemc/ext/dt/fx/sc_fxdefs.hh
@@ -50,6 +50,7 @@
#include "../../utils/messages.hh"
#include "../../utils/sc_report_handler.hh"
#include "../int/sc_nbutils.hh"
+#include "messages.hh"
#if ULONG_MAX > 0xffffffffUL
# define SC_LONG_64 1
@@ -249,21 +250,20 @@ 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, \
- "(E300) total wordlength <= 0 is not valid")
+#define SC_CHECK_WL_(wl) SC_ERROR_IF_((wl) <= 0, sc_core::SC_ID_INVALID_WL_)
#define SC_CHECK_N_BITS_(n_bits) \
- SC_ERROR_IF_((n_bits) < 0, "number of bits < 0 is not valid")
+ SC_ERROR_IF_((n_bits) < 0, sc_core::SC_ID_INVALID_N_BITS_)
#define SC_CHECK_DIV_WL_(div_wl) \
- SC_ERROR_IF_((div_wl) <= 0, "division wordlength <= 0 is not valid")
+ SC_ERROR_IF_((div_wl) <= 0, sc_core::SC_ID_INVALID_DIV_WL_)
#define SC_CHECK_CTE_WL_(cte_wl) \
- SC_ERROR_IF_((cte_wl) <= 0, "constant wordlength <= 0 is not valid")
+ SC_ERROR_IF_((cte_wl) <= 0, sc_core::SC_ID_INVALID_CTE_WL_)
#define SC_CHECK_MAX_WL_(max_wl) \
SC_ERROR_IF_((max_wl) <= 0 && (max_wl) != -1, \
- "maximum wordlength <= 0 and != -1 is not valid")
+ sc_core::SC_ID_INVALID_MAX_WL_)
// ----------------------------------------------------------------------------
diff --git a/src/systemc/ext/dt/fx/sc_fxnum.hh b/src/systemc/ext/dt/fx/sc_fxnum.hh
index 8a0b7f612..24006f7a3 100644
--- a/src/systemc/ext/dt/fx/sc_fxnum.hh
+++ b/src/systemc/ext/dt/fx/sc_fxnum.hh
@@ -62,6 +62,7 @@
#include <iostream>
#include "../bit/sc_lv_base.hh"
+#include "messages.hh"
#include "sc_fxnum_observer.hh"
#include "sc_fxval.hh"
#include "scfx_params.hh"
@@ -2174,7 +2175,7 @@ sc_fxnum::observer() const
inline void
sc_fxnum::cast()
{
- SC_ERROR_IF_(!m_rep->is_normal(), "invalid fixed-point value");
+ SC_ERROR_IF_(!m_rep->is_normal(), sc_core::SC_ID_INVALID_FX_VALUE_);
if (m_params.cast_switch() == SC_ON)
m_rep->cast(m_params, m_q_flag, m_o_flag);
@@ -2818,7 +2819,7 @@ sc_fxnum::operator -- ()
inline const sc_fxnum_bitref
sc_fxnum::operator [] (int i) const
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_bitref(const_cast<sc_fxnum &>(*this),
i - m_params.fwl());
}
@@ -2826,14 +2827,14 @@ sc_fxnum::operator [] (int i) const
inline sc_fxnum_bitref
sc_fxnum::operator [] (int i)
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_bitref(*this, i - m_params.fwl());
}
inline const sc_fxnum_bitref
sc_fxnum::bit(int i) const
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_bitref(const_cast<sc_fxnum &>(*this),
i - m_params.fwl());
}
@@ -2841,7 +2842,7 @@ sc_fxnum::bit(int i) const
inline sc_fxnum_bitref
sc_fxnum::bit(int i)
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_bitref(*this, i - m_params.fwl());
}
@@ -2850,8 +2851,8 @@ sc_fxnum::bit(int i)
inline const sc_fxnum_subref
sc_fxnum::operator () (int i, int j) const
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
- SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
+ SC_ERROR_IF_(j < 0 || j >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_subref(const_cast<sc_fxnum &>(*this),
i - m_params.fwl(), j - m_params.fwl());
@@ -2860,8 +2861,8 @@ sc_fxnum::operator () (int i, int j) const
inline sc_fxnum_subref
sc_fxnum::operator () (int i, int j)
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
- SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
+ SC_ERROR_IF_(j < 0 || j >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_subref(*this, i - m_params.fwl(), j - m_params.fwl());
}
@@ -2869,8 +2870,8 @@ sc_fxnum::operator () (int i, int j)
inline const sc_fxnum_subref
sc_fxnum::range(int i, int j) const
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
- SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
+ SC_ERROR_IF_(j < 0 || j >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_subref(const_cast<sc_fxnum &>(*this),
i - m_params.fwl(), j - m_params.fwl());
@@ -2879,8 +2880,8 @@ sc_fxnum::range(int i, int j) const
inline sc_fxnum_subref
sc_fxnum::range(int i, int j)
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
- SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
+ SC_ERROR_IF_(j < 0 || j >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_subref(*this, i - m_params.fwl(), j - m_params.fwl());
}
@@ -3773,7 +3774,7 @@ sc_fxnum_fast::operator -- ()
inline const sc_fxnum_fast_bitref
sc_fxnum_fast::operator [] (int i) const
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_fast_bitref(const_cast<sc_fxnum_fast &>(*this),
i - m_params.fwl());
}
@@ -3781,14 +3782,14 @@ sc_fxnum_fast::operator [] (int i) const
inline sc_fxnum_fast_bitref
sc_fxnum_fast::operator [] (int i)
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_fast_bitref(*this, i - m_params.fwl());
}
inline const sc_fxnum_fast_bitref
sc_fxnum_fast::bit(int i) const
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_fast_bitref(const_cast<sc_fxnum_fast &>(*this),
i - m_params.fwl());
}
@@ -3796,7 +3797,7 @@ sc_fxnum_fast::bit(int i) const
inline sc_fxnum_fast_bitref
sc_fxnum_fast::bit(int i)
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_fast_bitref(*this, i - m_params.fwl());
}
@@ -3804,8 +3805,8 @@ sc_fxnum_fast::bit(int i)
inline const sc_fxnum_fast_subref
sc_fxnum_fast::operator () (int i, int j) const
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
- SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
+ SC_ERROR_IF_(j < 0 || j >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_fast_subref(const_cast<sc_fxnum_fast &>(*this),
i - m_params.fwl(), j - m_params.fwl());
@@ -3814,8 +3815,8 @@ sc_fxnum_fast::operator () (int i, int j) const
inline sc_fxnum_fast_subref
sc_fxnum_fast::operator () (int i, int j)
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
- SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
+ SC_ERROR_IF_(j < 0 || j >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_fast_subref(*this, i - m_params.fwl(), j - m_params.fwl());
}
@@ -3823,8 +3824,8 @@ sc_fxnum_fast::operator () (int i, int j)
inline const sc_fxnum_fast_subref
sc_fxnum_fast::range(int i, int j) const
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
- SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
+ SC_ERROR_IF_(j < 0 || j >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_fast_subref(const_cast<sc_fxnum_fast &>(*this),
i - m_params.fwl(), j - m_params.fwl());
@@ -3833,8 +3834,8 @@ sc_fxnum_fast::range(int i, int j) const
inline sc_fxnum_fast_subref
sc_fxnum_fast::range(int i, int j)
{
- SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
- SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
+ SC_ERROR_IF_(i < 0 || i >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
+ SC_ERROR_IF_(j < 0 || j >= m_params.wl(), sc_core::SC_ID_OUT_OF_RANGE_);
return sc_fxnum_fast_subref(*this, i - m_params.fwl(), j - m_params.fwl());
}
diff --git a/src/systemc/ext/dt/fx/scfx_other_defs.hh b/src/systemc/ext/dt/fx/scfx_other_defs.hh
index 71eec9ff8..7af2181cd 100644
--- a/src/systemc/ext/dt/fx/scfx_other_defs.hh
+++ b/src/systemc/ext/dt/fx/scfx_other_defs.hh
@@ -51,6 +51,7 @@
#include "../int/sc_signed.hh"
#include "../int/sc_uint_base.hh"
#include "../int/sc_unsigned.hh"
+#include "messages.hh"
namespace sc_dt
{
@@ -64,7 +65,7 @@ inline const sc_signed &
sc_signed::operator = (const sc_fxval &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_signed::operator = ( const sc_fxval& )");
return *this;
}
@@ -78,7 +79,7 @@ inline const sc_signed &
sc_signed::operator = (const sc_fxval_fast &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_signed::operator = ( const sc_fxval_fast& )");
return *this;
}
@@ -93,7 +94,7 @@ inline const sc_signed &
sc_signed::operator = (const sc_fxnum &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_signed::operator = ( const sc_fxnum& )");
return *this;
}
@@ -108,7 +109,7 @@ inline const sc_signed &
sc_signed::operator = (const sc_fxnum_fast &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_signed::operator = ( const sc_fxnum_fast& )");
return *this;
}
@@ -130,7 +131,7 @@ inline const sc_unsigned &
sc_unsigned::operator = (const sc_fxval &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_unsigned::operator = ( const sc_fxval& )");
return *this;
}
@@ -145,7 +146,7 @@ inline const sc_unsigned &
sc_unsigned::operator = (const sc_fxval_fast &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_unsigned::operator = ( const sc_fxval_fast& )");
return *this;
}
@@ -160,7 +161,7 @@ inline const sc_unsigned &
sc_unsigned::operator = (const sc_fxnum &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_unsigned::operator = ( const sc_fxnum& )" );
return *this;
}
@@ -175,7 +176,7 @@ inline const sc_unsigned &
sc_unsigned::operator = (const sc_fxnum_fast &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_unsigned::operator = ( const sc_fxnum_fast& )" );
return *this;
}
@@ -197,7 +198,7 @@ inline sc_int_base &
sc_int_base::operator = (const sc_fxval &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_int_base::operator = ( const sc_fxval& )");
return *this;
}
@@ -212,7 +213,7 @@ inline sc_int_base &
sc_int_base::operator = (const sc_fxval_fast &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_int_base::operator = ( const sc_fxval_fast& )");
return *this;
}
@@ -227,7 +228,7 @@ inline sc_int_base &
sc_int_base::operator = (const sc_fxnum &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_int_base::operator = ( const sc_fxnum& )");
return *this;
}
@@ -242,7 +243,7 @@ inline sc_int_base &
sc_int_base::operator = (const sc_fxnum_fast &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_int_base::operator = ( const sc_fxnum_fast& )");
return *this;
}
@@ -263,7 +264,7 @@ inline sc_uint_base &
sc_uint_base::operator = (const sc_fxval &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_uint_base::operator = ( const sc_fxval& )");
return *this;
}
@@ -278,7 +279,7 @@ inline sc_uint_base &
sc_uint_base::operator = (const sc_fxval_fast &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_uint_base::operator = ( const sc_fxval_fast& )");
return *this;
}
@@ -293,7 +294,7 @@ inline sc_uint_base &
sc_uint_base::operator = (const sc_fxnum &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_uint_base::operator = ( const sc_fxnum& )");
return *this;
}
@@ -308,7 +309,7 @@ inline sc_uint_base &
sc_uint_base::operator = (const sc_fxnum_fast &v)
{
if (!v.is_normal()) { /* also triggers OBSERVER_READ call */
- SC_REPORT_ERROR("invalid fixed-point value",
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_FX_VALUE_,
"sc_uint_base::operator = ( const sc_fxnum_fast& )");
return *this;
}
diff --git a/src/systemc/ext/dt/fx/scfx_params.hh b/src/systemc/ext/dt/fx/scfx_params.hh
index dd5c9b695..eabc9a05d 100644
--- a/src/systemc/ext/dt/fx/scfx_params.hh
+++ b/src/systemc/ext/dt/fx/scfx_params.hh
@@ -47,6 +47,7 @@
#ifndef __SYSTEMC_EXT_DT_FX_SCFX_PARAMS_HH__
#define __SYSTEMC_EXT_DT_FX_SCFX_PARAMS_HH__
+#include "messages.hh"
#include "sc_fxcast_switch.hh"
#include "sc_fxtype_params.hh"
@@ -101,8 +102,8 @@ inline scfx_params::scfx_params(const sc_fxtype_params &type_params_,
m_type_params(type_params_), m_enc(enc_), m_cast_switch(cast_sw)
{
if (m_enc == SC_US_ && m_type_params.o_mode() == SC_WRAP_SM) {
- SC_REPORT_ERROR("invalid overflow mode",
- "SC_WRAP_SM not defined for unsigned numbers");
+ SC_REPORT_ERROR(sc_core::SC_ID_INVALID_O_MODE_,
+ sc_core::SC_ID_WRAP_SM_NOT_DEFINED_);
// may continue, if suppressed
}
}
diff --git a/src/systemc/ext/dt/int/_int.hh b/src/systemc/ext/dt/int/_int.hh
index dfbcf6ebd..ad08a2408 100644
--- a/src/systemc/ext/dt/int/_int.hh
+++ b/src/systemc/ext/dt/int/_int.hh
@@ -30,6 +30,7 @@
#ifndef __SYSTEMC_EXT_CORE_DT_INT__INT_HH__
#define __SYSTEMC_EXT_CORE_DT_INT__INT_HH__
+#include "messages.hh"
#include "sc_bigint.hh"
#include "sc_biguint.hh"
#include "sc_int.hh"
diff --git a/src/systemc/ext/dt/int/_using.hh b/src/systemc/ext/dt/int/_using.hh
index 82f64dd25..27840e82e 100644
--- a/src/systemc/ext/dt/int/_using.hh
+++ b/src/systemc/ext/dt/int/_using.hh
@@ -61,4 +61,9 @@ using sc_dt::sc_uint_base;
using sc_dt::sc_unsigned;
using sc_dt::uint64;
+using sc_core::SC_ID_INIT_FAILED_;
+using sc_core::SC_ID_ASSIGNMENT_FAILED_;
+using sc_core::SC_ID_OPERATION_FAILED_;
+using sc_core::SC_ID_CONVERSION_FAILED_;
+
#endif //__SYSTEMC_EXT_DT_INT__USING_HH__
diff --git a/src/systemc/ext/dt/int/messages.hh b/src/systemc/ext/dt/int/messages.hh
new file mode 100644
index 000000000..85537ab8a
--- /dev/null
+++ b/src/systemc/ext/dt/int/messages.hh
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2018 Google, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Gabe Black
+ */
+
+#ifndef __SYSTEMC_EXT_DT_INT_MESSAGES_HH__
+#define __SYSTEMC_EXT_DT_INT_MESSAGES_HH__
+
+namespace sc_core
+{
+
+extern const char SC_ID_INIT_FAILED_[];
+extern const char SC_ID_ASSIGNMENT_FAILED_[];
+extern const char SC_ID_OPERATION_FAILED_[];
+extern const char SC_ID_CONVERSION_FAILED_[];
+
+};
+
+#endif // __SYSTEMC_EXT_DT_INT_MESSAGES_HH__
diff --git a/src/systemc/ext/dt/int/sc_nbutils.hh b/src/systemc/ext/dt/int/sc_nbutils.hh
index 0d3a15cc6..3d7259503 100644
--- a/src/systemc/ext/dt/int/sc_nbutils.hh
+++ b/src/systemc/ext/dt/int/sc_nbutils.hh
@@ -69,6 +69,8 @@
#include <ostream>
#include "../../utils/sc_report_handler.hh"
+#include "../bit/messages.hh"
+#include "messages.hh"
#include "sc_nbdefs.hh"
namespace sc_dt
@@ -520,7 +522,7 @@ inline void
div_by_zero(Type s)
{
if (s == 0) {
- SC_REPORT_ERROR("operation failed",
+ SC_REPORT_ERROR(sc_core::SC_ID_OPERATION_FAILED_,
"div_by_zero<Type>(Type) : division by zero");
sc_core::sc_abort(); // can't recover from here
}
@@ -822,7 +824,7 @@ is_bad_double(double v)
{
// Windows throws exception.
if (is_nan(v) || is_inf(v))
- SC_REPORT_ERROR("(E204) value is not valid",
+ SC_REPORT_ERROR(sc_core::SC_ID_VALUE_NOT_VALID_,
"is_bad_double(double v) : "
"v is not finite - NaN or Inf");
}