event.cc (13303:045f002c325c) event.cc (13317:36c574a4036e)
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#include <algorithm>
33#include <cstring>
34#include <utility>
35
36#include "base/logging.hh"
37#include "sim/core.hh"
38#include "systemc/core/module.hh"
39#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

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

32#include <algorithm>
33#include <cstring>
34#include <utility>
35
36#include "base/logging.hh"
37#include "sim/core.hh"
38#include "systemc/core/module.hh"
39#include "systemc/core/scheduler.hh"
40#include "systemc/ext/core/messages.hh"
40#include "systemc/ext/core/sc_main.hh"
41#include "systemc/ext/core/sc_module.hh"
42
43namespace sc_gem5
44{
45
46Event::Event(sc_core::sc_event *_sc_event, bool internal) :
47 Event(_sc_event, nullptr, internal)

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

73 }
74
75 std::string path = parent ? (std::string(parent->name()) + ".") : "";
76
77 if (original_name != "" && _basename != original_name) {
78 std::string message = path + original_name +
79 ". Latter declaration will be renamed to " +
80 path + _basename;
41#include "systemc/ext/core/sc_main.hh"
42#include "systemc/ext/core/sc_module.hh"
43
44namespace sc_gem5
45{
46
47Event::Event(sc_core::sc_event *_sc_event, bool internal) :
48 Event(_sc_event, nullptr, internal)

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

74 }
75
76 std::string path = parent ? (std::string(parent->name()) + ".") : "";
77
78 if (original_name != "" && _basename != original_name) {
79 std::string message = path + original_name +
80 ". Latter declaration will be renamed to " +
81 path + _basename;
81 SC_REPORT_WARNING("(W505) object already exists", message.c_str());
82 SC_REPORT_WARNING(sc_core::SC_ID_INSTANCE_EXISTS_,
83 message.c_str());
82 }
83
84 _name = path + _basename;
85 }
86
87 allEvents.emplace(allEvents.end(), _sc_event);
88
89 // Determine if we're in the hierarchy (created once initialization starts

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

154 pos++;
155 }
156 senses.resize(size);
157}
158
159void
160Event::notify()
161{
84 }
85
86 _name = path + _basename;
87 }
88
89 allEvents.emplace(allEvents.end(), _sc_event);
90
91 // Determine if we're in the hierarchy (created once initialization starts

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

156 pos++;
157 }
158 senses.resize(size);
159}
160
161void
162Event::notify()
163{
162 if (scheduler.inUpdate()) {
163 SC_REPORT_ERROR("(E521) immediate notification is not allowed "
164 "during update phase or elaboration", "");
165 }
164 if (scheduler.inUpdate())
165 SC_REPORT_ERROR(sc_core::SC_ID_IMMEDIATE_NOTIFICATION_, "");
166
167 // An immediate notification overrides any pending delayed notification.
168 if (delayedNotify.scheduled())
169 scheduler.deschedule(&delayedNotify);
170
171 _triggeredStamp = scheduler.changeStamp();
172 notify(staticSenseMethod);
173 notify(dynamicSenseMethod);

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

185 scheduler.deschedule(&delayedNotify);
186 }
187 scheduler.schedule(&delayedNotify, t);
188}
189
190void
191Event::notifyDelayed(const sc_core::sc_time &t)
192{
166
167 // An immediate notification overrides any pending delayed notification.
168 if (delayedNotify.scheduled())
169 scheduler.deschedule(&delayedNotify);
170
171 _triggeredStamp = scheduler.changeStamp();
172 notify(staticSenseMethod);
173 notify(dynamicSenseMethod);

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

185 scheduler.deschedule(&delayedNotify);
186 }
187 scheduler.schedule(&delayedNotify, t);
188}
189
190void
191Event::notifyDelayed(const sc_core::sc_time &t)
192{
193 if (delayedNotify.scheduled()) {
194 SC_REPORT_ERROR("(E531) notify_delayed() cannot be called on events "
195 "that have pending notifications", "");
196 }
193 if (delayedNotify.scheduled())
194 SC_REPORT_ERROR(sc_core::SC_ID_NOTIFY_DELAYED_, "");
197 notify(t);
198}
199
200void
201Event::cancel()
202{
203 if (delayedNotify.scheduled())
204 scheduler.deschedule(&delayedNotify);

--- 33 unchanged lines hidden ---
195 notify(t);
196}
197
198void
199Event::cancel()
200{
201 if (delayedNotify.scheduled())
202 scheduler.deschedule(&delayedNotify);

--- 33 unchanged lines hidden ---