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

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

46
47namespace sc_gem5
48{
49
50class Sensitivity
51{
52 protected:
53 Process *process;
54 void satisfy();
54
55 public:
56 Sensitivity(Process *p) : process(p) {}
57 virtual ~Sensitivity() {}
58
60 virtual void notifyWork(Event *e) { satisfy(); }
59 virtual void notifyWork(Event *e);
60 void notify(Event *e);
61 void notify() { notify(nullptr); }
62
63 const std::string name();
64};
65
66class SensitivityTimeout : virtual public Sensitivity
67{

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

284
285 void finalize();
286
287 void run();
288
289 void addStatic(PendingSensitivity *);
290 void setDynamic(Sensitivity *);
291
292 void satisfySensitivity(Sensitivity *);
293
294 void ready();
295
296 virtual Fiber *fiber() { return Fiber::primaryFiber(); }
297
298 static Process *newest() { return _newest; }
299
300 protected:
301 Process(const char *name, ProcessFuncWrapper *func, bool _dynamic);
302
303 static Process *_newest;

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

315 ProcessFuncWrapper *func;
316 sc_core::sc_curr_proc_kind _procKind;
317 bool _running;
318 bool _dynamic;
319 bool _isUnwinding;
320 bool _terminated;
321
322 bool _suspended;
323 bool _suspendedReady;
324 bool _disabled;
325
326 bool _syncReset;
327
328 int refCount;
329
330 size_t stackSize;
331
332 Sensitivities staticSensitivities;
333 PendingSensitivities pendingStaticSensitivities;
334
335 Sensitivity *dynamicSensitivity;
336};
337
338inline void
339Sensitivity::notifyWork(Event *e)
340{
341 process->satisfySensitivity(this);
342}
343
344inline void
345Sensitivity::notify(Event *e)
346{
347 if (!process->disabled())
348 notifyWork(e);
349}
350
351inline const std::string
352Sensitivity::name()
353{
354 return std::string(process->name()) + ".timeout";
355}
356
357} // namespace sc_gem5
358
359#endif //__SYSTEMC_CORE_PROCESS_HH__