process.hh (12957:e54f9890363d) process.hh (12959:33d9a39e40a3)
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;
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();
55
56 public:
57 Sensitivity(Process *p) : process(p) {}
58 virtual ~Sensitivity() {}
59
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);
61 void notify(Event *e);
62 void notify() { notify(nullptr); }
63
64 const std::string name();
65};
66
67class SensitivityTimeout : virtual public Sensitivity
68{

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

285
286 void finalize();
287
288 void run();
289
290 void addStatic(PendingSensitivity *);
291 void setDynamic(Sensitivity *);
292
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
293 virtual Fiber *fiber() { return Fiber::primaryFiber(); }
294
295 static Process *newest() { return _newest; }
296
297 protected:
298 Process(const char *name, ProcessFuncWrapper *func, bool _dynamic);
299
300 static Process *_newest;

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

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