summaryrefslogtreecommitdiff
path: root/src/systemc/ext/dt
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/ext/dt
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/ext/dt')
-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
17 files changed, 246 insertions, 59 deletions
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");
}