gem5 v24.0.0.0
Loading...
Searching...
No Matches
sc_clock.hh
Go to the documentation of this file.
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution;
11 * neither the name of the copyright holders nor the names of its
12 * contributors may be used to endorse or promote products derived from
13 * this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef __SYSTEMC_EXT_CHANNEL_SC_CLOCK_HH__
29#define __SYSTEMC_EXT_CHANNEL_SC_CLOCK_HH__
30
31#include "../core/sc_time.hh"
32#include "sc_signal.hh"
33
34namespace sc_gem5
35{
36
37class ClockTick;
38
39} // namespace sc_gem5
40
41namespace sc_core
42{
43
44template <class T>
45class sc_in;
46
47class sc_time;
48
49class sc_clock : public sc_signal<bool>
50{
51 public:
52 sc_clock();
53 explicit sc_clock(const char *name);
54
55 sc_clock(const char *name, const sc_time &period,
56 double duty_cycle=0.5, const sc_time &start_time=SC_ZERO_TIME,
57 bool posedge_first=true);
58
59 sc_clock(const char *name, double period_v, sc_time_unit period_tu,
60 double duty_cycle=0.5);
61
62 sc_clock(const char *name, double period_v, sc_time_unit period_tu,
63 double duty_cycle, double start_time_v,
64 sc_time_unit start_time_tu, bool posedge_first=true);
65
66 // Deprecated.
67 sc_clock(const char *name, double period, double duty_cycle=0.5,
68 double start_time=0.0, bool posedge_first=true);
69
70 virtual ~sc_clock();
71
72 virtual void write(const bool &);
73
74 const sc_time &period() const;
75 double duty_cycle() const;
76 const sc_time &start_time() const;
77 bool posedge_first() const;
78
79 // Nonstandard
80 static const sc_time &time_stamp();
81
82 virtual const char *kind() const { return "sc_clock"; }
83
84 protected:
85 virtual void before_end_of_elaboration();
86
87 private:
88 friend class ::sc_gem5::ClockTick;
89
90 // Disabled
91 sc_clock(const sc_clock &) : sc_interface(), sc_signal<bool>() {}
92 sc_clock &operator = (const sc_clock &) { return *this; }
93
95 double _dutyCycle;
98
101
102 void
104 {
105 m_new_val = true;
107 }
108 void
110 {
111 m_new_val = false;
113 }
114};
115
117
118// Deprecated
121
122} // namespace sc_core
123
124#endif //__SYSTEMC_EXT_CHANNEL_SC_CLOCK_HH__
bool posedge_first() const
Definition sc_clock.cc:172
sc_clock & operator=(const sc_clock &)
Definition sc_clock.hh:92
::sc_gem5::ClockTick * _gem5UpEdge
Definition sc_clock.hh:99
::sc_gem5::ClockTick * _gem5DownEdge
Definition sc_clock.hh:100
static const sc_time & time_stamp()
Definition sc_clock.cc:175
const sc_time & period() const
Definition sc_clock.cc:169
sc_time _startTime
Definition sc_clock.hh:96
virtual const char * kind() const
Definition sc_clock.hh:82
double duty_cycle() const
Definition sc_clock.cc:170
virtual ~sc_clock()
Definition sc_clock.cc:153
virtual void before_end_of_elaboration()
Definition sc_clock.cc:181
const sc_time & start_time() const
Definition sc_clock.cc:171
sc_clock(const sc_clock &)
Definition sc_clock.hh:91
virtual void write(const bool &)
Definition sc_clock.cc:164
sc_inout< bool > sc_inout_clk
Definition sc_clock.hh:119
sc_out< bool > sc_out_clk
Definition sc_clock.hh:120
sc_time_unit
Definition sc_time.hh:40
sc_in< bool > sc_in_clk
Definition sc_clock.hh:116
const std::string & name()
Definition trace.cc:48

Generated on Tue Jun 18 2024 16:24:06 for gem5 by doxygen 1.11.0