gem5 v24.0.0.0
Loading...
Searching...
No Matches
sc_event.cc
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#include "systemc/core/event.hh"
31
32namespace sc_core
33{
34
35
36/*
37 * sc_event_and_list
38 */
39
40sc_event_and_list::sc_event_and_list() : autoDelete(false), busy(0) {}
41
43 events(eal.events), autoDelete(false), busy(0)
44{}
45
50
52 autoDelete(auto_delete), busy(0)
53{}
54
56
59{
60 events = eal.events;
61 return *this;
62}
63
64int
66{
67 return events.size();
68}
69
70void
75
78{
79 insert(e);
80 return *this;
81}
82
85{
86 insert(eal);
87 return *this;
88}
89
92{
94 expr.insert(*this);
95 expr.insert(e);
96 return expr;
97}
98
101{
103 expr.insert(*this);
104 expr.insert(eal);
105 return expr;
106}
107
108void
110{
111 events.insert(&e);
112}
113
114void
116{
117 events.insert(eal.events.begin(), eal.events.end());
118}
119
120
121/*
122 * sc_event_or_list
123 */
124
125sc_event_or_list::sc_event_or_list() : autoDelete(false), busy(0) {}
126
128 events(eol.events), autoDelete(false), busy(0)
129{}
130
135
137 autoDelete(auto_delete), busy(0)
138{}
139
142{
143 events = eol.events;
144 return *this;
145}
146
148
149int
151{
152 return events.size();
153}
154
155void
160
163{
164 insert(e);
165 return *this;
166}
167
170{
171 insert(eol);
172 return *this;
173}
174
177{
178 sc_event_or_expr expr;
179 expr.insert(*this);
180 expr.insert(e);
181 return expr;
182}
183
186{
187 sc_event_or_expr expr;
188 expr.insert(*this);
189 expr.insert(eol);
190 return expr;
191}
192
193void
195{
196 events.insert(&e);
197}
198
199void
201{
202 events.insert(eol.events.begin(), eol.events.end());
203}
204
205
206/*
207 * sc_event_and_expr
208 */
209
210// Move semantics
212 list(e.list)
213{
214 e.list = nullptr;
215}
216
217sc_event_and_expr::operator const sc_event_and_list &() const
218{
219 sc_event_and_list *temp = list;
220 list = nullptr;
221 return *temp;
222}
223
224void
226{
227 assert(list);
228 list->insert(e);
229}
230
231void
233{
234 assert(list);
235 list->insert(eal);
236}
237
239
241
244{
245 expr.insert(e);
246 return expr;
247}
248
249sc_event_and_expr
251{
252 expr.insert(eal);
253 return expr;
254}
255
256
257/*
258 * sc_event_or_expr
259 */
260
261// Move semantics
263 list(e.list)
264{
265 e.list = nullptr;
266}
267
268sc_event_or_expr::operator const sc_event_or_list &() const
269{
270 sc_event_or_list *temp = list;
271 list = NULL;
272 return *temp;
273}
274
275void
277{
278 assert(list);
279 list->insert(e);
280}
281
282void
284{
285 assert(list);
286 list->insert(eol);
287}
288
290
292
295{
296 expr.insert(e);
297 return expr;
298}
299
300sc_event_or_expr
302{
303 expr.insert(eol);
304 return expr;
305}
306
307
308/*
309 * sc_event
310 */
311
313 _gem5_event(new ::sc_gem5::Event(
314 this, sc_core::sc_gen_unique_name("event")))
315{}
316
317sc_event::sc_event(const char *_name) :
318 _gem5_event(new ::sc_gem5::Event(this, _name))
319{}
320
322
323const char *sc_event::name() const { return _gem5_event->name().c_str(); }
324const char *
326{
327 return _gem5_event->basename().c_str();
328}
330
331sc_object *
336
339void sc_event::notify(double d, sc_time_unit u) { _gem5_event->notify(d, u); }
341bool sc_event::triggered() const { return _gem5_event->triggered(); }
342void
344{
345 _gem5_event->notifyDelayed(SC_ZERO_TIME);
346}
347void
352
355{
357 expr.insert(*this);
358 expr.insert(e);
359 return expr;
360}
361
364{
366 expr.insert(*this);
367 expr.insert(eal);
368 return expr;
369}
370
373{
374 sc_event_or_expr expr;
375 expr.insert(*this);
376 expr.insert(e);
377 return expr;
378}
379
382{
383 sc_event_or_expr expr;
384 expr.insert(*this);
385 expr.insert(eol);
386 return expr;
387}
388
390 _gem5_event(new ::sc_gem5::Event(
391 this, sc_core::sc_gen_unique_name(
392 "$$$internal kernel event$$$"), true))
393{}
394
395sc_event::sc_event(bool, const char *_name) :
396 _gem5_event(new ::sc_gem5::Event(
397 this,
398 (std::string("$$$internal kernel event$$$") + _name).c_str(),
399 true))
400{}
401
404{
405 return ::sc_gem5::topLevelEvents;
406}
407
408sc_event *
409sc_find_event(const char *name)
410{
411 std::string str(name);
413 return it == ::sc_gem5::allEvents.end() ? nullptr : *it;
414}
415
416} // namespace sc_core
417
418namespace sc_gem5
419{
420
422InternalScEvent::InternalScEvent(const char *_name) : sc_event(true, _name) {}
423
424} // namespace sc_gem5
sc_event_and_list * list
Definition sc_event.hh:141
void insert(sc_event const &e) const
Definition sc_event.cc:225
void swap(sc_event_and_list &)
Definition sc_event.cc:71
void insert(sc_event const &e)
Definition sc_event.cc:109
sc_event_and_list & operator=(const sc_event_and_list &)
Definition sc_event.cc:58
sc_event_and_list & operator&=(const sc_event &)
Definition sc_event.cc:77
std::set< const sc_event * > events
Definition sc_event.hh:88
sc_event_and_expr operator&(const sc_event &) const
Definition sc_event.cc:91
void insert(sc_event const &e) const
Definition sc_event.cc:276
sc_event_or_list * list
Definition sc_event.hh:163
sc_event_or_expr operator|(const sc_event &) const
Definition sc_event.cc:176
sc_event_or_list & operator|=(const sc_event &)
Definition sc_event.cc:162
void insert(sc_event const &e)
Definition sc_event.cc:194
std::set< const sc_event * > events
Definition sc_event.hh:120
sc_event_or_list & operator=(const sc_event_or_list &)
Definition sc_event.cc:141
void swap(sc_event_or_list &)
Definition sc_event.cc:156
bool triggered() const
Definition sc_event.cc:341
const char * basename() const
Definition sc_event.cc:325
const char * name() const
Definition sc_event.cc:323
bool in_hierarchy() const
Definition sc_event.cc:329
sc_object * get_parent_object() const
Definition sc_event.cc:332
void notify_delayed()
Definition sc_event.cc:343
sc_event_or_expr operator|(const sc_event &) const
Definition sc_event.cc:372
::sc_gem5::Event * _gem5_event
Definition sc_event.hh:209
sc_event_and_expr operator&(const sc_event &) const
Definition sc_event.cc:354
void notify(StaticSensitivities &senses)
Definition event.cc:137
bool triggered() const
Definition event.cc:202
sc_core::sc_object * getParentObject() const
Definition event.cc:131
const std::string & basename() const
Definition event.cc:119
bool inHierarchy() const
Definition event.cc:125
void notifyDelayed(const sc_core::sc_time &t)
Definition event.cc:187
const std::string & name() const
Definition event.cc:113
void cancel()
Definition event.cc:195
STL vector class.
Definition stl.hh:37
sc_event_or_expr operator|(sc_event_or_expr expr, sc_event const &e)
Definition sc_event.cc:294
const std::vector< sc_event * > & sc_get_top_level_events()
Definition sc_event.cc:403
sc_event * sc_find_event(const char *name)
Definition sc_event.cc:409
sc_time_unit
Definition sc_time.hh:40
sc_event_and_expr operator&(sc_event_and_expr expr, sc_event const &e)
Definition sc_event.cc:243
Events::iterator EventsIt
Definition object.hh:45
Events allEvents
Definition event.cc:218
EventsIt findEvent(const std::string &name)
Definition event.cc:221
Overload hash function for BasicBlockRange type.
Definition binary32.hh:81
const std::string & name()
Definition trace.cc:48

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