Deleted Added
sdiff udiff text old ( 12957:e54f9890363d ) new ( 12959:33d9a39e40a3 )
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

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

31
32#include "base/logging.hh"
33#include "systemc/core/event.hh"
34#include "systemc/core/scheduler.hh"
35
36namespace sc_gem5
37{
38
39void
40Sensitivity::satisfy()
41{
42 warn_once("Ignoring suspended status for now.\n");
43 process->setDynamic(nullptr);
44 scheduler.ready(process);
45}
46
47SensitivityTimeout::SensitivityTimeout(Process *p, ::sc_core::sc_time t) :
48 Sensitivity(p), timeoutEvent(this), timeout(t)
49{
50 Tick when = scheduler.eventQueue().getCurTick() + timeout.value();
51 scheduler.eventQueue().schedule(&timeoutEvent, when);
52}
53
54SensitivityTimeout::~SensitivityTimeout()

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

83}
84
85void
86SensitivityEventAndList::notifyWork(Event *e)
87{
88 e->delSensitivity(this);
89 count++;
90 if (count == list->events.size())
91 satisfy();
92}
93
94SensitivityEventOrList::SensitivityEventOrList(
95 Process *p, const ::sc_core::sc_event_or_list *list) :
96 Sensitivity(p), list(list)
97{
98 for (auto e: list->events)
99 Event::getFromScEvent(e)->addSensitivity(this);

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

145void
146Process::suspend(bool inc_kids)
147{
148 if (inc_kids)
149 forEachKid([](Process *p) { p->suspend(true); });
150
151 if (!_suspended) {
152 _suspended = true;
153 //TODO Suspend this process.
154 }
155
156 if (procKind() != ::sc_core::SC_METHOD_PROC_ &&
157 scheduler.current() == this) {
158 scheduler.yield();
159 }
160}
161
162void
163Process::resume(bool inc_kids)
164{
165 if (inc_kids)
166 forEachKid([](Process *p) { p->resume(true); });
167
168 if (_suspended) {
169 _suspended = false;
170 //TODO Resume this process.
171 }
172}
173
174void
175Process::disable(bool inc_kids)
176{
177 if (inc_kids)
178 forEachKid([](Process *p) { p->disable(true); });

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

304
305void
306Process::setDynamic(Sensitivity *s)
307{
308 delete dynamicSensitivity;
309 dynamicSensitivity = s;
310}
311
312Process::Process(const char *name, ProcessFuncWrapper *func, bool _dynamic) :
313 ::sc_core::sc_object(name), excWrapper(nullptr), func(func),
314 _running(false), _dynamic(_dynamic), _isUnwinding(false),
315 _terminated(false), _suspended(false), _disabled(false),
316 _syncReset(false), refCount(0), stackSize(::Fiber::DefaultStackSize),
317 dynamicSensitivity(nullptr)
318{
319 _newest = this;

--- 15 unchanged lines hidden ---