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 --- 19 unchanged lines hidden (view full) --- 28 */ 29 30#ifndef __SYSTEMC_CORE_PROCESS_HH__ 31#define __SYSTEMC_CORE_PROCESS_HH__ 32 33#include <functional> 34 35#include "base/fiber.hh" |
36#include "systemc/core/list.hh" |
37#include "systemc/core/object.hh" 38#include "systemc/ext/core/sc_event.hh" 39#include "systemc/ext/core/sc_module.hh" 40#include "systemc/ext/core/sc_process_handle.hh" 41 42namespace sc_gem5 43{ 44 |
45class Process : public ::sc_core::sc_object, public ListNode |
46{ 47 public: 48 virtual ::sc_core::sc_curr_proc_kind procKind() const = 0; |
49 bool running() const { return _running; } |
50 bool dynamic() const { return _dynamic; } 51 bool isUnwinding() const { return _isUnwinding; } 52 bool terminated() const { return _terminated; } 53 54 void forEachKid(const std::function<void(Process *)> &work); 55 56 bool suspended() const { return _suspended; } 57 bool disabled() const { return _disabled; } --- 14 unchanged lines hidden (view full) --- 72 void syncResetOff(bool inc_kids); 73 74 void incref() { refCount++; } 75 void decref() { refCount--; } 76 77 const ::sc_core::sc_event &resetEvent() { return _resetEvent; } 78 const ::sc_core::sc_event &terminatedEvent() { return _terminatedEvent; } 79 |
80 // This should only be called before initialization. 81 void dontInitialize() { popListNode(); } 82 83 void setStackSize(size_t size) { stackSize = size; } 84 85 void run(); 86 87 virtual Fiber *fiber() { return Fiber::primaryFiber(); } 88 89 static Process *newest() { return _newest; } 90 |
91 protected: |
92 Process(const char *name, ProcessFuncWrapper *func, bool _dynamic); |
93 |
94 static Process *_newest; 95 |
96 virtual ~Process() { delete func; } 97 98 ::sc_core::sc_event _resetEvent; 99 ::sc_core::sc_event _terminatedEvent; 100 101 ProcessFuncWrapper *func; 102 sc_core::sc_curr_proc_kind _procKind; |
103 bool _running; |
104 bool _dynamic; 105 bool _isUnwinding; 106 bool _terminated; 107 108 bool _suspended; 109 bool _disabled; 110 111 bool _syncReset; 112 113 int refCount; |
114 |
115 size_t stackSize; |
116}; 117 |
118} // namespace sc_gem5 119 120#endif //__SYSTEMC_CORE_PROCESS_HH__ |