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

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

82 virtual void throw_it(ExceptionWrapperBase &exc, bool inc_kids);
83
84 void injectException(ExceptionWrapperBase &exc);
85 ExceptionWrapperBase *excWrapper;
86
87 void syncResetOn(bool inc_kids);
88 void syncResetOff(bool inc_kids);
89
90 void signalReset(bool set, bool sync);
91
92 void incref() { refCount++; }
93 void decref() { refCount--; }
94
95 const ::sc_core::sc_event &resetEvent() { return _resetEvent; }
96 const ::sc_core::sc_event &terminatedEvent() { return _terminatedEvent; }
97
98 void setStackSize(size_t size) { stackSize = size; }
99
100 void run();
101
102 void addStatic(StaticSensitivity *);
103 void setDynamic(DynamicSensitivity *);
104 void clearDynamic() { setDynamic(nullptr); }
105 void addReset(ResetSensitivity *);
106
107 ScEvent timeoutEvent;
108 void setTimeout(::sc_core::sc_time t);
109 void cancelTimeout();
110
111 void satisfySensitivity(Sensitivity *);
112
113 void ready();
114
115 virtual Fiber *fiber() { return Fiber::primaryFiber(); }
116
117 static Process *newest() { return _newest; }
118
119 void lastReport(::sc_core::sc_report *report);
120 ::sc_core::sc_report *lastReport() const;
121
122 bool hasStaticSensitivities() { return !staticSensitivities.empty(); }
123 bool internal() { return _internal; }
124 bool timedOut() { return _timedOut; }
122 bool syncReset() { return _syncReset; }
125 bool inReset() { return _syncReset || syncResetCount || asyncResetCount; }
126
127 bool dontInitialize() { return _dontInitialize; }
128 void dontInitialize(bool di) { _dontInitialize = di; }
129
130 void joinWait(::sc_core::sc_join *join) { joinWaiters.push_back(join); }
131
132 void waitCount(int count) { _waitCount = count; }
133
134 protected:
135 void timeout();
136
137 Process(const char *name, ProcessFuncWrapper *func, bool internal=false);
138
139 static Process *_newest;
140
141 virtual ~Process()

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

170 void terminate();
171
172 bool _suspended;
173 bool _suspendedReady;
174 bool _disabled;
175
176 bool _syncReset;
177
178 int syncResetCount;
179 int asyncResetCount;
180
181 int _waitCount;
182
183 int refCount;
184
185 size_t stackSize;
186
187 StaticSensitivities staticSensitivities;
188 DynamicSensitivity *dynamicSensitivity;
189 ResetSensitivities resetSensitivities;
190
191 std::unique_ptr<::sc_core::sc_report> _lastReport;
192
193 std::vector<::sc_core::sc_join *> joinWaiters;
194};
195
196} // namespace sc_gem5
197
198#endif //__SYSTEMC_CORE_PROCESS_HH__