event.hh (13193:37816241c855) event.hh (13206:c944ef4abb48)
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

--- 23 unchanged lines hidden (view full) ---

32
33#include <list>
34#include <string>
35#include <vector>
36
37#include "sim/eventq.hh"
38#include "systemc/core/list.hh"
39#include "systemc/core/object.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

--- 23 unchanged lines hidden (view full) ---

32
33#include <list>
34#include <string>
35#include <vector>
36
37#include "sim/eventq.hh"
38#include "systemc/core/list.hh"
39#include "systemc/core/object.hh"
40#include "systemc/core/process.hh"
40#include "systemc/core/sched_event.hh"
41#include "systemc/core/sched_event.hh"
42#include "systemc/core/sensitivity.hh"
41#include "systemc/ext/core/sc_prim.hh"
42#include "systemc/ext/core/sc_time.hh"
43
44namespace sc_core
45{
46
47class sc_event;
48

--- 39 unchanged lines hidden (view full) ---

88 }
89
90 static const Event *
91 getFromScEvent(const sc_core::sc_event *e)
92 {
93 return e->_gem5_event;
94 }
95
43#include "systemc/ext/core/sc_prim.hh"
44#include "systemc/ext/core/sc_time.hh"
45
46namespace sc_core
47{
48
49class sc_event;
50

--- 39 unchanged lines hidden (view full) ---

90 }
91
92 static const Event *
93 getFromScEvent(const sc_core::sc_event *e)
94 {
95 return e->_gem5_event;
96 }
97
96 void addSensitivity(Sensitivity *s) const { sensitivities.push_back(s); }
97 void delSensitivity(Sensitivity *s) const { sensitivities.remove(s); }
98 void
99 addSensitivity(StaticSensitivity *s) const
100 {
101 // Insert static sensitivities in reverse order to match Accellera's
102 // implementation.
103 staticSensitivities.insert(staticSensitivities.begin(), s);
104 }
105 void
106 delSensitivity(StaticSensitivity *s) const
107 {
108 for (auto &t: staticSensitivities) {
109 if (t == s) {
110 t = staticSensitivities.back();
111 staticSensitivities.pop_back();
112 break;
113 }
114 }
115 }
116 void
117 addSensitivity(DynamicSensitivity *s) const
118 {
119 dynamicSensitivities.push_back(s);
120 }
121 void
122 delSensitivity(DynamicSensitivity *s) const
123 {
124 for (auto &t: dynamicSensitivities) {
125 if (t == s) {
126 t = dynamicSensitivities.back();
127 dynamicSensitivities.pop_back();
128 break;
129 }
130 }
131 }
98
99 private:
100 sc_core::sc_event *_sc_event;
101
102 std::string _basename;
103 std::string _name;
104 bool _inHierarchy;
105
106 sc_core::sc_object *parent;
107
108 ScEvent delayedNotify;
109
132
133 private:
134 sc_core::sc_event *_sc_event;
135
136 std::string _basename;
137 std::string _name;
138 bool _inHierarchy;
139
140 sc_core::sc_object *parent;
141
142 ScEvent delayedNotify;
143
110 mutable std::list<Sensitivity *> sensitivities;
144 mutable StaticSensitivities staticSensitivities;
145 mutable DynamicSensitivities dynamicSensitivities;
111};
112
113extern Events topLevelEvents;
114extern Events allEvents;
115
116EventsIt findEvent(const std::string &name);
117
118} // namespace sc_gem5
119
120#endif //__SYSTEMC_CORE_EVENT_HH__
146};
147
148extern Events topLevelEvents;
149extern Events allEvents;
150
151EventsIt findEvent(const std::string &name);
152
153} // namespace sc_gem5
154
155#endif //__SYSTEMC_CORE_EVENT_HH__