From df50b775cb04bb22fd583cee40af870f2c80b65e Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 16 Aug 2018 19:10:09 -0700 Subject: systemc: Implement a significant portion of sc_clock. Change-Id: Ic195f46ac13b46a02c86a5fc8d90ba66a415a9c8 Reviewed-on: https://gem5-review.googlesource.com/12215 Reviewed-by: Gabe Black Maintainer: Gabe Black --- src/systemc/ext/channel/sc_clock.hh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/systemc/ext') 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 // 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() {} 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::write(true); } + void tickDown() { sc_signal::write(false); } }; typedef sc_in sc_in_clk; -- cgit v1.2.3