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>
This commit is contained in:
Gabe Black
2018-08-16 19:10:09 -07:00
parent 440b143742
commit df50b775cb
2 changed files with 122 additions and 55 deletions

View File

@@ -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;