summaryrefslogtreecommitdiff
path: root/src/systemc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-07-16 16:25:32 -0700
committerGabe Black <gabeblack@google.com>2018-09-05 06:06:33 +0000
commiteb3b52b56c7caa20e7814ceab0005d63eeac3f6f (patch)
treefa980b48149e7b20c7d149244c522618efe2a42c /src/systemc
parentf2ab5e7a9e11783da3b9d7338775cf4b5fe2c29c (diff)
downloadgem5-eb3b52b56c7caa20e7814ceab0005d63eeac3f6f.tar.xz
systemc: Implement next_trigger and wait.
These set up dynamic sensitivity. Change-Id: I6cf2c2e4f93fe001eb7df8377753d51846b57d32 Reviewed-on: https://gem5-review.googlesource.com/11714 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc')
-rw-r--r--src/systemc/core/sc_module.cc93
1 files changed, 61 insertions, 32 deletions
diff --git a/src/systemc/core/sc_module.cc b/src/systemc/core/sc_module.cc
index 90139a166..20cc4d288 100644
--- a/src/systemc/core/sc_module.cc
+++ b/src/systemc/core/sc_module.cc
@@ -421,31 +421,36 @@ sc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
void
next_trigger()
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(nullptr);
}
void
-next_trigger(const sc_event &)
+next_trigger(const sc_event &e)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
}
void
-next_trigger(const sc_event_or_list &)
+next_trigger(const sc_event_or_list &eol)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
}
void
-next_trigger(const sc_event_and_list &)
+next_trigger(const sc_event_and_list &eal)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
}
void
-next_trigger(const sc_time &)
+next_trigger(const sc_time &t)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
}
void
@@ -455,9 +460,10 @@ next_trigger(double d, sc_time_unit u)
}
void
-next_trigger(const sc_time &, const sc_event &)
+next_trigger(const sc_time &t, const sc_event &e)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
}
void
@@ -467,9 +473,11 @@ next_trigger(double d, sc_time_unit u, const sc_event &e)
}
void
-next_trigger(const sc_time &, const sc_event_or_list &)
+next_trigger(const sc_time &t, const sc_event_or_list &eol)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(
+ new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
}
void
@@ -479,9 +487,11 @@ next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol)
}
void
-next_trigger(const sc_time &, const sc_event_and_list &)
+next_trigger(const sc_time &t, const sc_event_and_list &eal)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(
+ new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
}
void
@@ -501,37 +511,48 @@ timed_out()
void
wait()
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(nullptr);
+ sc_gem5::scheduler.yield();
}
void
-wait(int)
+wait(int n)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ for (int i = 0; i < n; i++)
+ wait();
}
void
-wait(const sc_event &)
+wait(const sc_event &e)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e));
+ sc_gem5::scheduler.yield();
}
void
-wait(const sc_event_or_list &)
+wait(const sc_event_or_list &eol)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol));
+ sc_gem5::scheduler.yield();
}
void
-wait(const sc_event_and_list &)
+wait(const sc_event_and_list &eal)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal));
+ sc_gem5::scheduler.yield();
}
void
-wait(const sc_time &)
+wait(const sc_time &t)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t));
+ sc_gem5::scheduler.yield();
}
void
@@ -541,9 +562,11 @@ wait(double d, sc_time_unit u)
}
void
-wait(const sc_time &, const sc_event &)
+wait(const sc_time &t, const sc_event &e)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e));
+ sc_gem5::scheduler.yield();
}
void
@@ -553,9 +576,12 @@ wait(double d, sc_time_unit u, const sc_event &e)
}
void
-wait(const sc_time &, const sc_event_or_list &)
+wait(const sc_time &t, const sc_event_or_list &eol)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(
+ new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol));
+ sc_gem5::scheduler.yield();
}
void
@@ -565,9 +591,12 @@ wait(double d, sc_time_unit u, const sc_event_or_list &eol)
}
void
-wait(const sc_time &, const sc_event_and_list &)
+wait(const sc_time &t, const sc_event_and_list &eal)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ p->setDynamic(
+ new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal));
+ sc_gem5::scheduler.yield();
}
void