Import('*')
if env['USE_SYSTEMC']:
+ Source('messages.cc')
Source('sc_bit.cc')
Source('sc_bv_base.cc')
Source('sc_logic.cc')
--- /dev/null
+/*
+ * 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
#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"
{
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
}
{
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
}
#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"
{
// 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
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';
// 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();
}
} 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();
}
#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"
{
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
{
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);
}
#include <sstream>
+#include "systemc/ext/dt/bit/messages.hh"
#include "systemc/ext/dt/bit/sc_lv_base.hh"
#include "systemc/ext/utils/messages.hh"
{
// 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
Import('*')
if env['USE_SYSTEMC']:
+ Source('messages.cc')
Source('sc_fxcast_switch.cc')
Source('sc_fxdefs.cc')
Source('scfx_mant.cc')
--- /dev/null
+/*
+ * 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
#include <cmath>
+#include "systemc/ext/dt/fx/messages.hh"
#include "systemc/ext/dt/fx/sc_fxnum.hh"
namespace sc_dt
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();
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;
#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"
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();
Import('*')
if env['USE_SYSTEMC']:
+ Source('messages.cc')
Source('sc_int_base.cc')
Source('sc_int_mask.cc')
Source('sc_length_param.cc')
--- /dev/null
+/*
+ * 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
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;
} 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;
}
#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"
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());
}
}
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;
}
// 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;
}
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;
}
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;
}
// 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;
}
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;
}
{
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;
}
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;
}
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;
}
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;
}
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;
}
#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"
{
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());
}
// ----------------------------------------------------------------------------
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();
} 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;
}
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;
} 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;
}
#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"
{
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());
}
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();
} 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;
}
#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"
{
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
{
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;
}
{
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;
}
{
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;
}
{
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;
}
{
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
{
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
{
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
{
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
#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"
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__
--- /dev/null
+/*
+ * 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__
#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"
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);
}
}
#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"
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) {
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);
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;
#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"
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__
--- /dev/null
+/*
+ * 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__
#include "../../core/sc_process_handle.hh"
#include "../../utils/sc_report_handler.hh"
+#include "messages.hh"
namespace sc_dt
{
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);
}
}
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);
}
}
#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
#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_)
// ----------------------------------------------------------------------------
#include <iostream>
#include "../bit/sc_lv_base.hh"
+#include "messages.hh"
#include "sc_fxnum_observer.hh"
#include "sc_fxval.hh"
#include "scfx_params.hh"
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);
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());
}
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());
}
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());
}
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());
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());
}
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());
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());
}
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());
}
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());
}
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());
}
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());
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());
}
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());
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());
}
#include "../int/sc_signed.hh"
#include "../int/sc_uint_base.hh"
#include "../int/sc_unsigned.hh"
+#include "messages.hh"
namespace sc_dt
{
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
#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"
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
}
}
#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"
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__
--- /dev/null
+/*
+ * 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__
#include <ostream>
#include "../../utils/sc_report_handler.hh"
+#include "../bit/messages.hh"
+#include "messages.hh"
#include "sc_nbdefs.hh"
namespace sc_dt
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
}
{
// 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");
}