Deleted Added
sdiff udiff text old ( 13196:4b5ab2c22743 ) new ( 13206:c944ef4abb48 )
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

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

30#ifndef __SYSTEMC_CORE_PROCESS_HH__
31#define __SYSTEMC_CORE_PROCESS_HH__
32
33#include <functional>
34#include <memory>
35#include <vector>
36
37#include "base/fiber.hh"
38#include "systemc/core/bindinfo.hh"
39#include "systemc/core/list.hh"
40#include "systemc/core/object.hh"
41#include "systemc/core/sched_event.hh"
42#include "systemc/core/sensitivity.hh"
43#include "systemc/ext/core/sc_event.hh"
44#include "systemc/ext/core/sc_module.hh"
45#include "systemc/ext/core/sc_process_handle.hh"
46
47namespace sc_core
48{
49
50class sc_join;
51
52} // namespace sc_core
53
54namespace sc_gem5
55{
56
57class ScHalt
58{};
59
60class Process : public ::sc_core::sc_process_b, public ListNode
61{
62 public:
63 virtual ::sc_core::sc_curr_proc_kind procKind() const = 0;
64 bool needsStart() const { return _needsStart; }
65 void needsStart(bool ns) { _needsStart = ns; }
66 bool dynamic() const { return _dynamic; }
67 bool isUnwinding() const { return _isUnwinding; }

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

95 const ::sc_core::sc_event &terminatedEvent() { return _terminatedEvent; }
96
97 void setStackSize(size_t size) { stackSize = size; }
98
99 void finalize();
100
101 void run();
102
103 void addStatic(StaticSensitivity *);
104 void setDynamic(DynamicSensitivity *);
105 void clearDynamic() { setDynamic(nullptr); }
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; }
125
126 bool dontInitialize() { return _dontInitialize; }
127 void dontInitialize(bool di) { _dontInitialize = di; }
128
129 void joinWait(::sc_core::sc_join *join) { joinWaiters.push_back(join); }
130
131 protected:
132 void timeout();
133
134 Process(const char *name, ProcessFuncWrapper *func, bool internal=false);
135
136 static Process *_newest;
137
138 virtual ~Process()
139 {
140 popListNode();
141 delete func;
142 for (auto s: staticSensitivities) {
143 s->clear();
144 delete s;
145 }
146 clearDynamic();
147 }
148
149 ::sc_core::sc_event _resetEvent;
150 ::sc_core::sc_event _terminatedEvent;
151
152 ProcessFuncWrapper *func;
153 sc_core::sc_curr_proc_kind _procKind;
154

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

171 bool _disabled;
172
173 bool _syncReset;
174
175 int refCount;
176
177 size_t stackSize;
178
179 StaticSensitivities staticSensitivities;
180 DynamicSensitivity *dynamicSensitivity;
181
182 std::unique_ptr<::sc_core::sc_report> _lastReport;
183
184 std::vector<::sc_core::sc_join *> joinWaiters;
185};
186
187} // namespace sc_gem5
188
189#endif //__SYSTEMC_CORE_PROCESS_HH__