sensitivity.cc (13260:4d18f1d20093) sensitivity.cc (13262:ef4b783f84f7)
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

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

53 process->satisfySensitivity(this);
54}
55
56bool
57Sensitivity::notify(Event *e)
58{
59 if (process->disabled())
60 return false;
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

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

53 process->satisfySensitivity(this);
54}
55
56bool
57Sensitivity::notify(Event *e)
58{
59 if (process->disabled())
60 return false;
61 return notifyWork(e);
61 satisfy();
62 return true;
62}
63
64bool
65Sensitivity::ofMethod()
66{
67 return process->procKind() == sc_core::SC_METHOD_PROC_;
68}
69

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

208
209
210DynamicSensitivityEventOrList::DynamicSensitivityEventOrList(
211 Process *p, const sc_core::sc_event_or_list *eol) :
212 Sensitivity(p), DynamicSensitivity(p), SensitivityEvents(p, eol->events)
213{}
214
215bool
63}
64
65bool
66Sensitivity::ofMethod()
67{
68 return process->procKind() == sc_core::SC_METHOD_PROC_;
69}
70

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

209
210
211DynamicSensitivityEventOrList::DynamicSensitivityEventOrList(
212 Process *p, const sc_core::sc_event_or_list *eol) :
213 Sensitivity(p), DynamicSensitivity(p), SensitivityEvents(p, eol->events)
214{}
215
216bool
216DynamicSensitivityEventOrList::notifyWork(Event *e)
217DynamicSensitivityEventOrList::notify(Event *e)
217{
218{
219 if (process->disabled())
220 return false;
221
218 events.erase(e->sc_event());
219
220 // All the other events need this deleted from their lists since this
221 // sensitivity has been satisfied without them triggering.
222 for (auto le: events)
223 delFromEvent(le);
224
225 satisfy();
226 return true;
227}
228
229DynamicSensitivityEventAndList::DynamicSensitivityEventAndList(
230 Process *p, const sc_core::sc_event_and_list *eal) :
231 Sensitivity(p), DynamicSensitivity(p), SensitivityEvents(p, eal->events)
232{}
233
234bool
222 events.erase(e->sc_event());
223
224 // All the other events need this deleted from their lists since this
225 // sensitivity has been satisfied without them triggering.
226 for (auto le: events)
227 delFromEvent(le);
228
229 satisfy();
230 return true;
231}
232
233DynamicSensitivityEventAndList::DynamicSensitivityEventAndList(
234 Process *p, const sc_core::sc_event_and_list *eal) :
235 Sensitivity(p), DynamicSensitivity(p), SensitivityEvents(p, eal->events)
236{}
237
238bool
235DynamicSensitivityEventAndList::notifyWork(Event *e)
239DynamicSensitivityEventAndList::notify(Event *e)
236{
240{
241 if (process->disabled())
242 return false;
243
237 events.erase(e->sc_event());
238
239 // This sensitivity is satisfied if all events have triggered.
240 if (events.empty())
241 satisfy();
242
243 return true;
244}

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

289 SensitivityEvent(p, signal ? &signal->value_changed_event() : nullptr),
290 _signal(signal)
291{
292 if (signal && signal->read() == val())
293 process->signalReset(true, sync());
294}
295
296bool
244 events.erase(e->sc_event());
245
246 // This sensitivity is satisfied if all events have triggered.
247 if (events.empty())
248 satisfy();
249
250 return true;
251}

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

296 SensitivityEvent(p, signal ? &signal->value_changed_event() : nullptr),
297 _signal(signal)
298{
299 if (signal && signal->read() == val())
300 process->signalReset(true, sync());
301}
302
303bool
297ResetSensitivitySignal::notifyWork(Event *e)
304ResetSensitivitySignal::notify(Event *e)
298{
299 process->signalReset(_signal->read() == val(), sync());
300 return true;
301}
302
303void
304ResetSensitivityPort::setSignal(const ::sc_core::sc_signal_in_if<bool> *signal)
305{
306 _signal = signal;
307 event = &_signal->value_changed_event();
308 addToEvent(event);
309 if (signal->read() == val())
310 process->signalReset(true, sync());
311}
312
313} // namespace sc_gem5
305{
306 process->signalReset(_signal->read() == val(), sync());
307 return true;
308}
309
310void
311ResetSensitivityPort::setSignal(const ::sc_core::sc_signal_in_if<bool> *signal)
312{
313 _signal = signal;
314 event = &_signal->value_changed_event();
315 addToEvent(event);
316 if (signal->read() == val())
317 process->signalReset(true, sync());
318}
319
320} // namespace sc_gem5