summaryrefslogtreecommitdiff
path: root/src/systemc/ext
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-08-16 19:10:09 -0700
committerGabe Black <gabeblack@google.com>2018-09-25 23:50:23 +0000
commitdf50b775cb04bb22fd583cee40af870f2c80b65e (patch)
treeef484ac37ee32438d19f7a64d34031deb38a7de2 /src/systemc/ext
parent440b143742ece282c2b0497c70818a5796f66f1a (diff)
downloadgem5-df50b775cb04bb22fd583cee40af870f2c80b65e.tar.xz
systemc: Implement a significant portion of sc_clock.
Change-Id: Ic195f46ac13b46a02c86a5fc8d90ba66a415a9c8 Reviewed-on: https://gem5-review.googlesource.com/12215 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/ext')
-rw-r--r--src/systemc/ext/channel/sc_clock.hh22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/systemc/ext/channel/sc_clock.hh b/src/systemc/ext/channel/sc_clock.hh
index 30895ced2..3713394b6 100644
--- a/src/systemc/ext/channel/sc_clock.hh
+++ b/src/systemc/ext/channel/sc_clock.hh
@@ -33,6 +33,13 @@
#include "../core/sc_time.hh"
#include "sc_signal.hh"
+namespace sc_gem5
+{
+
+class ClockTick;
+
+} // namespace sc_gem5
+
namespace sc_core
{
@@ -74,15 +81,28 @@ class sc_clock : public sc_signal<bool>
// Nonstandard
static const sc_time &time_stamp();
- virtual const char *kind() const;
+ virtual const char *kind() const { return "sc_clock"; }
protected:
virtual void before_end_of_elaboration();
private:
+ friend class ::sc_gem5::ClockTick;
+
// Disabled
sc_clock(const sc_clock &) : sc_interface(), sc_signal<bool>() {}
sc_clock &operator = (const sc_clock &) { return *this; }
+
+ sc_time _period;
+ double _dutyCycle;
+ sc_time _startTime;
+ bool _posedgeFirst;
+
+ ::sc_gem5::ClockTick *_gem5UpEdge;
+ ::sc_gem5::ClockTick *_gem5DownEdge;
+
+ void tickUp() { sc_signal<bool>::write(true); }
+ void tickDown() { sc_signal<bool>::write(false); }
};
typedef sc_in<bool> sc_in_clk;