gem5 v24.0.0.0
Loading...
Searching...
No Matches
peq_with_get.h
Go to the documentation of this file.
1/*****************************************************************************
2
3 Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4 more contributor license agreements. See the NOTICE file distributed
5 with this work for additional information regarding copyright ownership.
6 Accellera licenses this file to you under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with the
8 License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15 implied. See the License for the specific language governing
16 permissions and limitations under the License.
17
18 *****************************************************************************/
19
20// 12-Jan-2009 John Aynsley Bug fix. sc_time argument to notify should be const
21// 20-Mar-2009 John Aynsley Add cancel_all() method
22
23
24#ifndef __SYSTEMC_EXT_TLM_UTILS_PEQ_WITH_GET_H__
25#define __SYSTEMC_EXT_TLM_UTILS_PEQ_WITH_GET_H__
26
27#include <map>
28
29#include "../core/sc_event.hh"
30#include "../core/sc_main.hh"
31#include "../core/sc_object.hh"
32#include "../core/sc_time.hh"
33
34namespace tlm_utils
35{
36
37template <class PAYLOAD>
39{
40 public:
41 typedef PAYLOAD transaction_type;
43
44 public:
46
47 void
49 {
51 &trans));
52 m_event.notify(t);
53 }
54
55 void
57 {
59 m_event.notify(); // Immediate notification.
60 }
61
62 // Needs to be called until it returns NULL
65 {
66 if (m_scheduled_events.empty()) {
67 return nullptr;
68 }
69
71 if (m_scheduled_events.begin()->first <= now) {
72 transaction_type *trans = m_scheduled_events.begin()->second;
74 return trans;
75 }
76
77 m_event.notify(m_scheduled_events.begin()->first - now);
78
79 return nullptr;
80 }
81
83
84 // Cancel all events from the event queue.
85 void
87 {
88 m_scheduled_events.clear();
90 }
91
92 private:
93 std::multimap<const sc_core::sc_time, transaction_type *>
96};
97
98} // namespace tlm_utils
99
100#endif /* __SYSTEMC_EXT_TLM_UTILS_PEQ_WITH_GET_H__ */
const char * name() const
Definition sc_object.cc:44
STL pair class.
Definition stl.hh:58
transaction_type * get_next_transaction()
peq_with_get(const char *name)
void notify(transaction_type &trans)
sc_core::sc_event m_event
std::pair< const sc_core::sc_time, transaction_type * > pair_type
sc_core::sc_event & get_event()
std::multimap< const sc_core::sc_time, transaction_type * > m_scheduled_events
void notify(transaction_type &trans, const sc_core::sc_time &t)
const sc_time & sc_time_stamp()
Definition sc_main.cc:127

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