Deleted Added
sdiff udiff text old ( 12988:df70e73818e4 ) new ( 13063:c9905ead0041 )
full compact
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

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

39#include "systemc/core/scheduler.hh"
40
41namespace sc_gem5
42{
43
44Event::Event(sc_core::sc_event *_sc_event) : Event(_sc_event, "") {}
45
46Event::Event(sc_core::sc_event *_sc_event, const char *_basename) :
47 _sc_event(_sc_event), _basename(_basename), delayedNotifyEvent(this)
48{
49 Module *p = currentModule();
50
51 if (p)
52 parent = p->obj()->sc_obj();
53 else if (scheduler.current())
54 parent = scheduler.current();
55 else

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

85 std::swap(*it, topLevelEvents.back());
86 topLevelEvents.pop_back();
87 }
88
89 EventsIt it = findEvent(_name);
90 std::swap(*it, allEvents.back());
91 allEvents.pop_back();
92
93 if (delayedNotifyEvent.scheduled())
94 scheduler.deschedule(&delayedNotifyEvent);
95}
96
97const std::string &
98Event::name() const
99{
100 return _name;
101}
102

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

122Event::notify()
123{
124 auto local_sensitivities = sensitivities;
125 for (auto s: local_sensitivities)
126 s->notify(this);
127}
128
129void
130Event::delayedNotify()
131{
132 scheduler.eventHappened();
133 notify();
134}
135
136void
137Event::notify(const sc_core::sc_time &t)
138{
139 //XXX We're assuming the systemc time resolution is in ps.
140 Tick new_tick = t.value() * SimClock::Int::ps + scheduler.getCurTick();
141 if (delayedNotifyEvent.scheduled()) {
142 Tick old_tick = delayedNotifyEvent.when();
143
144 if (new_tick >= old_tick)
145 return;
146
147 scheduler.deschedule(&delayedNotifyEvent);
148 }
149
150 scheduler.schedule(&delayedNotifyEvent, new_tick);
151}
152
153void
154Event::cancel()
155{
156 if (delayedNotifyEvent.scheduled())
157 scheduler.deschedule(&delayedNotifyEvent);
158}
159
160bool
161Event::triggered() const
162{
163 return false;
164}
165

--- 15 unchanged lines hidden ---