Deleted Added
sdiff udiff text old ( 12957:e54f9890363d ) new ( 12962:004cc9133bd6 )
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

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

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

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

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

--- 15 unchanged lines hidden ---