gem5
v20.1.0.0
systemc
channel
sc_event_queue.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/ext/channel/sc_event_queue.hh
"
29
#include "
systemc/ext/core/sc_main.hh
"
30
#include "
systemc/ext/core/sc_time.hh
"
31
32
namespace
sc_core
33
{
34
35
sc_event_queue::sc_event_queue
(
sc_module_name
name
) :
36
sc_interface
(),
sc_event_queue_if
(),
sc_module
(
name
)
37
{
38
SC_METHOD
(
_trigger
);
39
dont_initialize
();
40
sensitive
<<
_defaultEvent
;
41
}
42
43
sc_event_queue::~sc_event_queue
() {}
44
45
void
46
sc_event_queue::notify
(
double
d
,
sc_time_unit
tu
)
47
{
48
notify
(
sc_time
(
d
,
tu
));
49
}
50
51
void
52
sc_event_queue::notify
(
const
sc_time
&
t
)
53
{
54
_times
.push(
sc_time_stamp
() +
t
);
55
_defaultEvent
.
notify
(
_times
.top() -
sc_time_stamp
());
56
}
57
58
void
59
sc_event_queue::cancel_all
()
60
{
61
_defaultEvent
.
cancel
();
62
_times
= std::priority_queue<
63
sc_time
,
std::vector<sc_time>
, std::greater<sc_time> >();
64
}
65
66
const
sc_event
&
67
sc_event_queue::default_event
()
const
68
{
69
return
_defaultEvent
;
70
}
71
72
void
73
sc_event_queue::_trigger
()
74
{
75
_times
.pop();
76
if
(!
_times
.empty())
77
_defaultEvent
.
notify
(
_times
.top() -
sc_time_stamp
());
78
}
79
80
}
// namespace sc_core
MipsISA::tu
Bitfield< 30, 28 > tu
Definition:
pra_constants.hh:249
sc_core::sc_event_queue::~sc_event_queue
~sc_event_queue()
Definition:
sc_event_queue.cc:43
sc_core::sc_module
Definition:
sc_module.hh:97
sc_core::sc_event_queue::default_event
virtual const sc_event & default_event() const
Definition:
sc_event_queue.cc:67
sc_core
Definition:
messages.cc:31
sc_core::sc_time_unit
sc_time_unit
Definition:
sc_time.hh:40
sc_core::sc_interface
Definition:
sc_interface.hh:37
sc_core::sc_event_queue::_times
std::priority_queue< sc_time, std::vector< sc_time >, std::greater< sc_time > > _times
Definition:
sc_event_queue.hh:75
std::vector
STL vector class.
Definition:
stl.hh:37
sc_core::sc_event_queue::_defaultEvent
sc_gem5::InternalScEvent _defaultEvent
Definition:
sc_event_queue.hh:73
sc_core::sc_event_queue_if
Definition:
sc_event_queue.hh:45
sc_core::sc_module::dont_initialize
void dont_initialize()
Definition:
sc_module.cc:336
SC_METHOD
#define SC_METHOD(name)
Definition:
sc_module.hh:299
sc_core::sc_event
Definition:
sc_event.hh:169
ArmISA::d
Bitfield< 9 > d
Definition:
miscregs_types.hh:60
sc_main.hh
sc_event_queue.hh
sc_core::sc_time
Definition:
sc_time.hh:49
sc_core::sc_event_queue::notify
virtual void notify(double, sc_time_unit)
Definition:
sc_event_queue.cc:46
sc_core::sc_module_name
Definition:
sc_module_name.hh:41
name
const std::string & name()
Definition:
trace.cc:50
sc_core::sc_event::notify
void notify()
Definition:
sc_event.cc:337
sc_core::sc_event::cancel
void cancel()
Definition:
sc_event.cc:340
ArmISA::t
Bitfield< 5 > t
Definition:
miscregs_types.hh:67
sc_core::sc_event_queue::sc_event_queue
sc_event_queue(sc_module_name name=sc_module_name(sc_gen_unique_name("event_queue")))
Definition:
sc_event_queue.cc:35
sc_core::sc_event_queue::cancel_all
virtual void cancel_all()
Definition:
sc_event_queue.cc:59
sc_core::sc_module::sensitive
sc_sensitive sensitive
Definition:
sc_module.hh:206
sc_time.hh
sc_core::sc_time_stamp
const sc_time & sc_time_stamp()
Definition:
sc_main.cc:128
sc_core::sc_event_queue::_trigger
void _trigger()
Definition:
sc_event_queue.cc:73
Generated on Wed Sep 30 2020 14:02:14 for gem5 by
doxygen
1.8.17