systemc: Ensure the terminated event is notified in all cases.
[gem5.git] / src / systemc / channel / sc_clock.cc
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 * Authors: Gabe Black
28 */
29
30 #include "base/logging.hh"
31 #include "systemc/ext/channel/sc_clock.hh"
32 #include "systemc/ext/core/sc_module.hh" // for sc_gen_unique_name
33
34 namespace sc_core
35 {
36
37 sc_clock::sc_clock() :
38 sc_interface(), sc_signal<bool>(sc_gen_unique_name("clock"))
39 {
40 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
41 }
42
43 sc_clock::sc_clock(const char *name) : sc_interface(), sc_signal<bool>(name)
44 {
45 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
46 }
47
48 sc_clock::sc_clock(const char *name, const sc_time &period,
49 double duty_cycle, const sc_time &start_time,
50 bool posedge_first)
51 {
52 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
53 }
54
55 sc_clock::sc_clock(const char *name, double period_v, sc_time_unit period_tu,
56 double duty_cycle)
57 {
58 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
59 }
60
61 sc_clock::sc_clock(const char *name, double period_v, sc_time_unit period_tu,
62 double duty_cycle, double start_time_v,
63 sc_time_unit start_time_tu, bool posedge_first)
64 {
65 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
66 }
67
68 sc_clock::sc_clock(const char *name, double period, double duty_cycle,
69 double start_time, bool posedge_first)
70 {
71 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
72 }
73
74 sc_clock::~sc_clock() {}
75
76 void
77 sc_clock::write(const bool &)
78 {
79 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
80 }
81
82 const sc_time &
83 sc_clock::period() const
84 {
85 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
86 return *(const sc_time *)nullptr;
87 }
88
89 double
90 sc_clock::duty_cycle() const
91 {
92 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
93 return 0.0;
94 }
95
96 const sc_time &
97 sc_clock::start_time() const
98 {
99 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
100 return *(const sc_time *)nullptr;
101 }
102
103 bool
104 sc_clock::posedge_first() const
105 {
106 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
107 return false;
108 }
109
110 const sc_time &
111 sc_clock::time_stamp()
112 {
113 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
114 return *(const sc_time *)nullptr;
115 }
116
117 const char *sc_clock::kind() const { return "sc_clock"; }
118
119 void sc_clock::before_end_of_elaboration() {}
120
121 } // namespace sc_core