Deleted Added
sdiff udiff text old ( 13283:362061d5b968 ) new ( 13324:c8b709468e61 )
full compact
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/core/channel.hh"
32#include "systemc/core/scheduler.hh"
33#include "systemc/ext/channel/messages.hh"
34#include "systemc/ext/core/sc_main.hh"
35#include "systemc/ext/core/sc_prim.hh"
36
37namespace sc_gem5
38{
39
40uint64_t getChangeStamp() { return scheduler.changeStamp(); }
41
42} // namespace sc_gem5
43
44namespace sc_core
45{
46
47sc_prim_channel::sc_prim_channel() : _gem5_channel(nullptr)
48{
49 if (sc_is_running()) {
50 SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "simulation running");
51 }
52 if (::sc_gem5::scheduler.elaborationDone()) {
53 SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "elaboration done");
54 }
55 _gem5_channel = new sc_gem5::Channel(this);
56}
57
58sc_prim_channel::sc_prim_channel(const char *_name) :
59 sc_object(_name), _gem5_channel(nullptr)
60{
61 if (sc_is_running()) {
62 SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "simulation running");
63 }
64 if (::sc_gem5::scheduler.elaborationDone()) {
65 SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "elaboration done");
66 }
67 _gem5_channel = new sc_gem5::Channel(this);
68}
69
70sc_prim_channel::~sc_prim_channel() { delete _gem5_channel; }
71
72void
73sc_prim_channel::request_update()
74{
75 _gem5_channel->requestUpdate();
76}
77
78void
79sc_prim_channel::async_request_update()
80{
81 _gem5_channel->asyncRequestUpdate();
82}
83
84void
85sc_prim_channel::next_trigger()
86{
87 ::sc_core::next_trigger();
88}
89
90void
91sc_prim_channel::next_trigger(const sc_event &e)
92{
93 ::sc_core::next_trigger(e);
94}
95
96void
97sc_prim_channel::next_trigger(const sc_event_or_list &eol)
98{
99 ::sc_core::next_trigger(eol);
100}
101
102void
103sc_prim_channel::next_trigger(const sc_event_and_list &eal)
104{
105 ::sc_core::next_trigger(eal);
106}
107
108void
109sc_prim_channel::next_trigger(const sc_time &t)
110{
111 ::sc_core::next_trigger(t);
112}
113
114void
115sc_prim_channel::next_trigger(double d, sc_time_unit u)
116{
117 ::sc_core::next_trigger(d, u);
118}
119
120void
121sc_prim_channel::next_trigger(const sc_time &t, const sc_event &e)
122{
123 ::sc_core::next_trigger(t, e);
124}
125
126void
127sc_prim_channel::next_trigger(double d, sc_time_unit u, const sc_event &e)
128{
129 ::sc_core::next_trigger(d, u, e);
130}
131
132void
133sc_prim_channel::next_trigger(const sc_time &t, const sc_event_or_list &eol)
134{
135 ::sc_core::next_trigger(t, eol);
136}
137
138void
139sc_prim_channel::next_trigger(
140 double d, sc_time_unit u, const sc_event_or_list &eol)
141{
142 ::sc_core::next_trigger(d, u, eol);
143}
144
145void
146sc_prim_channel::next_trigger(const sc_time &t, const sc_event_and_list &eal)
147{
148 ::sc_core::next_trigger(t, eal);
149}
150
151void
152sc_prim_channel::next_trigger(
153 double d, sc_time_unit u, const sc_event_and_list &eal)
154{
155 ::sc_core::next_trigger(d, u, eal);
156}
157
158bool
159sc_prim_channel::timed_out()
160{
161 return ::sc_core::timed_out();
162}
163
164void
165sc_prim_channel::wait()
166{
167 ::sc_core::wait();
168}
169
170void
171sc_prim_channel::wait(int i)
172{
173 ::sc_core::wait(i);
174}
175
176void
177sc_prim_channel::wait(const sc_event &e)
178{
179 ::sc_core::wait(e);
180}
181
182void
183sc_prim_channel::wait(const sc_event_or_list &eol)
184{
185 ::sc_core::wait(eol);
186}
187
188void
189sc_prim_channel::wait(const sc_event_and_list &eal)
190{
191 ::sc_core::wait(eal);
192}
193
194void
195sc_prim_channel::wait(const sc_time &t)
196{
197 ::sc_core::wait(t);
198}
199
200void
201sc_prim_channel::wait(double d, sc_time_unit u)
202{
203 ::sc_core::wait(d, u);
204}
205
206void
207sc_prim_channel::wait(const sc_time &t, const sc_event &e)
208{
209 ::sc_core::wait(t, e);
210}
211
212void
213sc_prim_channel::wait(double d, sc_time_unit u, const sc_event &e)
214{
215 ::sc_core::wait(d, u, e);
216}
217
218void
219sc_prim_channel::wait(const sc_time &t, const sc_event_or_list &eol)
220{
221 ::sc_core::wait(t, eol);
222}
223
224void
225sc_prim_channel::wait(double d, sc_time_unit u, const sc_event_or_list &eol)
226{
227 ::sc_core::wait(d, u, eol);
228}
229
230void
231sc_prim_channel::wait(const sc_time &t, const sc_event_and_list &eal)
232{
233 ::sc_core::wait(t, eal);
234}
235
236void
237sc_prim_channel::wait(double d, sc_time_unit u, const sc_event_and_list &eal)
238{
239 ::sc_core::wait(d, u, eal);
240}
241
242} // namespace sc_core