summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-09-01 18:53:23 -0700
committerGabe Black <gabeblack@google.com>2018-10-03 00:51:34 +0000
commit9da2cdd3783abecbc3ccf4a74b3b928eab65fae2 (patch)
treeaa62c43ce267601f658d91e480d251ae402861c3
parent026b3f909e6eb180f1fffb1a1c05317224f1ca29 (diff)
downloadgem5-9da2cdd3783abecbc3ccf4a74b3b928eab65fae2.tar.xz
systemc: Implement the nonstandard at_negedge and at_posedge.
Change-Id: I7ea5cfd309db4b9883df551fd7dcec186e4f38a3 Reviewed-on: https://gem5-review.googlesource.com/c/12467 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
-rw-r--r--src/systemc/core/sc_module.cc30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/systemc/core/sc_module.cc b/src/systemc/core/sc_module.cc
index 6be3818da..8418a3136 100644
--- a/src/systemc/core/sc_module.cc
+++ b/src/systemc/core/sc_module.cc
@@ -35,8 +35,10 @@
#include "systemc/core/kernel.hh"
#include "systemc/core/module.hh"
#include "systemc/core/process_types.hh"
+#include "systemc/ext/channel/sc_signal_in_if.hh"
#include "systemc/ext/core/sc_module.hh"
#include "systemc/ext/core/sc_module_name.hh"
+#include "systemc/ext/dt/bit/sc_logic.hh"
#include "systemc/ext/utils/sc_report_handler.hh"
namespace sc_gem5
@@ -672,27 +674,39 @@ halt()
}
void
-at_posedge(const sc_signal_in_if<bool> &)
+at_posedge(const sc_signal_in_if<bool> &s)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ while (s.read())
+ wait();
+ while (!s.read())
+ wait();
}
void
-at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &)
+at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ while (s.read() == sc_dt::Log_1)
+ wait();
+ while (s.read() == sc_dt::Log_0)
+ wait();
}
void
-at_negedge(const sc_signal_in_if<bool> &)
+at_negedge(const sc_signal_in_if<bool> &s)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ while (!s.read())
+ wait();
+ while (s.read())
+ wait();
}
void
-at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &)
+at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s)
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ while (s.read() == sc_dt::Log_0)
+ wait();
+ while (s.read() == sc_dt::Log_1)
+ wait();
}
const char *