summaryrefslogtreecommitdiff
path: root/src/systemc/dt
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/dt')
-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
18 files changed, 267 insertions, 58 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