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