summaryrefslogtreecommitdiff
path: root/src/systemc/utils/sc_report.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-10-06 20:09:42 -0700
committerGabe Black <gabeblack@google.com>2018-10-16 01:06:54 +0000
commit5220003e388b75d45a57f3db83dd00212e3a4118 (patch)
treeb0b2031ba9dc34c632a22f343806b723a5e743bb /src/systemc/utils/sc_report.cc
parent7eb6ad4aaa3afb8a5625a4515cbcfd141d5ce45b (diff)
downloadgem5-5220003e388b75d45a57f3db83dd00212e3a4118.tar.xz
systemc: Handle integer based IDs like Accellera does.
This is actually not consistent with how it was handled in 2.0.1 which is supposedly what this is supposed to be backwards compatible with, in that in the earlier version on info and warning messages were suppressed. This is exposed by one of the tests, utils/sc_report/test01, which suppresses an integer ID and then reports an error with it. The "golden" output shows the message supressed, but the actual implementation makes no such distinction. This implementation duplicates Accelleras for now, but a future change will make it consistent with the old implementation so the test will pass. Change-Id: I8f959321151e2bb60b94000594f30531b80e2684 Reviewed-on: https://gem5-review.googlesource.com/c/13319 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/utils/sc_report.cc')
-rw-r--r--src/systemc/utils/sc_report.cc63
1 files changed, 50 insertions, 13 deletions
diff --git a/src/systemc/utils/sc_report.cc b/src/systemc/utils/sc_report.cc
index 77da92b57..83e066269 100644
--- a/src/systemc/utils/sc_report.cc
+++ b/src/systemc/utils/sc_report.cc
@@ -32,6 +32,7 @@
#include "base/logging.hh"
#include "systemc/ext/utils/sc_report.hh"
#include "systemc/ext/utils/sc_report_handler.hh"
+#include "systemc/utils/report.hh"
namespace sc_core
{
@@ -87,45 +88,81 @@ sc_report::what() const throw()
const char *
sc_report::get_message(int id)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
- return "";
+ auto it = sc_gem5::reportIdToMsgMap.find(id);
+ if (it == sc_gem5::reportIdToMsgMap.end())
+ return "unknown id";
+ else
+ return it->second.c_str();
}
bool
sc_report::is_suppressed(int id)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
- return false;
+ auto it = sc_gem5::reportIdToMsgMap.find(id);
+ if (it == sc_gem5::reportIdToMsgMap.end())
+ return false;
+
+ return sc_gem5::reportMsgInfoMap[it->second].actions == SC_DO_NOTHING;
}
void
-sc_report::make_warnings_errors(bool)
+sc_report::make_warnings_errors(bool val)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::reportWarningsAsErrors = val;
}
void
sc_report::register_id(int id, const char *msg)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ if (id < 0) {
+ SC_REPORT_ERROR("(E800) register_id failed", "invalid report id");
+ return;
+ }
+ if (!msg) {
+ SC_REPORT_ERROR("(E800) register_id failed", "invalid report message");
+ return;
+ }
+ auto p = sc_gem5::reportIdToMsgMap.insert(
+ std::pair<int, std::string>(id, msg));
+ if (!p.second) {
+ SC_REPORT_ERROR("(E800) register_id failed",
+ "report id already exists");
+ } else {
+ sc_gem5::reportMsgInfoMap[msg].id = id;
+ }
}
void
-sc_report::suppress_id(int id, bool)
+sc_report::suppress_id(int id, bool suppress)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ auto it = sc_gem5::reportIdToMsgMap.find(id);
+ if (it == sc_gem5::reportIdToMsgMap.end())
+ return;
+
+ if (suppress)
+ sc_gem5::reportMsgInfoMap[it->second].actions = SC_DO_NOTHING;
+ else
+ sc_gem5::reportMsgInfoMap[it->second].actions = SC_UNSPECIFIED;
}
void
-sc_report::suppress_infos(bool)
+sc_report::suppress_infos(bool suppress)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ if (suppress)
+ sc_gem5::reportSevInfos[SC_INFO].actions = SC_DO_NOTHING;
+ else
+ sc_gem5::reportSevInfos[SC_INFO].actions = SC_DEFAULT_INFO_ACTIONS;
}
void
-sc_report::suppress_warnings(bool)
+sc_report::suppress_warnings(bool suppress)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ if (suppress) {
+ sc_gem5::reportSevInfos[SC_WARNING].actions = SC_DO_NOTHING;
+ } else {
+ sc_gem5::reportSevInfos[SC_WARNING].actions =
+ SC_DEFAULT_WARNING_ACTIONS;
+ }
}
void