process.hh (13180:79e680f62779) process.hh (13189:057566bc8fd6)
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

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

59{
60 protected:
61 Process *process;
62
63 public:
64 Sensitivity(Process *p) : process(p) {}
65 virtual ~Sensitivity() {}
66
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

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

59{
60 protected:
61 Process *process;
62
63 public:
64 Sensitivity(Process *p) : process(p) {}
65 virtual ~Sensitivity() {}
66
67 virtual void notifyWork(Event *e);
67 void satisfy(bool timedOut=false);
68
69 virtual void notifyWork(Event *e) { satisfy(); }
68 void notify(Event *e);
69 void notify() { notify(nullptr); }
70
71 const std::string name();
72};
73
74class SensitivityTimeout : virtual public Sensitivity
75{

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

125class SensitivityTimeoutAndEvent :
126 public SensitivityTimeout, public SensitivityEvent
127{
128 public:
129 SensitivityTimeoutAndEvent(
130 Process *p, ::sc_core::sc_time t, const ::sc_core::sc_event *e) :
131 Sensitivity(p), SensitivityTimeout(p, t), SensitivityEvent(p, e)
132 {}
70 void notify(Event *e);
71 void notify() { notify(nullptr); }
72
73 const std::string name();
74};
75
76class SensitivityTimeout : virtual public Sensitivity
77{

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

127class SensitivityTimeoutAndEvent :
128 public SensitivityTimeout, public SensitivityEvent
129{
130 public:
131 SensitivityTimeoutAndEvent(
132 Process *p, ::sc_core::sc_time t, const ::sc_core::sc_event *e) :
133 Sensitivity(p), SensitivityTimeout(p, t), SensitivityEvent(p, e)
134 {}
135
136 void notifyWork(Event *e) override { satisfy(e == nullptr); }
133};
134
135class SensitivityTimeoutAndEventAndList :
136 public SensitivityTimeout, public SensitivityEventAndList
137{
138 public:
139 SensitivityTimeoutAndEventAndList(
140 Process *p, ::sc_core::sc_time t,

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

151{
152 public:
153 SensitivityTimeoutAndEventOrList(
154 Process *p, ::sc_core::sc_time t,
155 const ::sc_core::sc_event_or_list *eol) :
156 Sensitivity(p), SensitivityTimeout(p, t),
157 SensitivityEventOrList(p, eol)
158 {}
137};
138
139class SensitivityTimeoutAndEventAndList :
140 public SensitivityTimeout, public SensitivityEventAndList
141{
142 public:
143 SensitivityTimeoutAndEventAndList(
144 Process *p, ::sc_core::sc_time t,

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

155{
156 public:
157 SensitivityTimeoutAndEventOrList(
158 Process *p, ::sc_core::sc_time t,
159 const ::sc_core::sc_event_or_list *eol) :
160 Sensitivity(p), SensitivityTimeout(p, t),
161 SensitivityEventOrList(p, eol)
162 {}
163
164 void notifyWork(Event *e) override { satisfy(e == nullptr); }
159};
160
161typedef std::vector<Sensitivity *> Sensitivities;
162
163
164/*
165 * Pending sensitivities. These are records of sensitivities to install later,
166 * once all the information to configure them is available.

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

333
334 static Process *newest() { return _newest; }
335
336 void lastReport(::sc_core::sc_report *report);
337 ::sc_core::sc_report *lastReport() const;
338
339 bool hasStaticSensitivities() { return !staticSensitivities.empty(); }
340 bool internal() { return _internal; }
165};
166
167typedef std::vector<Sensitivity *> Sensitivities;
168
169
170/*
171 * Pending sensitivities. These are records of sensitivities to install later,
172 * once all the information to configure them is available.

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

339
340 static Process *newest() { return _newest; }
341
342 void lastReport(::sc_core::sc_report *report);
343 ::sc_core::sc_report *lastReport() const;
344
345 bool hasStaticSensitivities() { return !staticSensitivities.empty(); }
346 bool internal() { return _internal; }
347 bool timedOut() { return _timedOut; }
348 void timedOut(bool to) { _timedOut = to; }
341
342 protected:
343 Process(const char *name, ProcessFuncWrapper *func, bool internal=false);
344
345 static Process *_newest;
346
347 virtual ~Process()
348 {

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

355 ::sc_core::sc_event _resetEvent;
356 ::sc_core::sc_event _terminatedEvent;
357
358 ProcessFuncWrapper *func;
359 sc_core::sc_curr_proc_kind _procKind;
360
361 bool _internal;
362
349
350 protected:
351 Process(const char *name, ProcessFuncWrapper *func, bool internal=false);
352
353 static Process *_newest;
354
355 virtual ~Process()
356 {

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

363 ::sc_core::sc_event _resetEvent;
364 ::sc_core::sc_event _terminatedEvent;
365
366 ProcessFuncWrapper *func;
367 sc_core::sc_curr_proc_kind _procKind;
368
369 bool _internal;
370
371 // Needed to support the deprecated "timed_out" function.
372 bool _timedOut;
373
363 bool _needsStart;
364 bool _dynamic;
365 bool _isUnwinding;
366 bool _terminated;
367
368 void terminate();
369
370 bool _suspended;

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

381 PendingSensitivities pendingStaticSensitivities;
382
383 Sensitivity *dynamicSensitivity;
384
385 std::unique_ptr<::sc_core::sc_report> _lastReport;
386};
387
388inline void
374 bool _needsStart;
375 bool _dynamic;
376 bool _isUnwinding;
377 bool _terminated;
378
379 void terminate();
380
381 bool _suspended;

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

392 PendingSensitivities pendingStaticSensitivities;
393
394 Sensitivity *dynamicSensitivity;
395
396 std::unique_ptr<::sc_core::sc_report> _lastReport;
397};
398
399inline void
389Sensitivity::notifyWork(Event *e)
400Sensitivity::satisfy(bool timedOut)
390{
401{
402 process->timedOut(timedOut);
391 process->satisfySensitivity(this);
392}
393
394inline void
395Sensitivity::notify(Event *e)
396{
397 if (!process->disabled())
398 notifyWork(e);
399}
400
401inline const std::string
402Sensitivity::name()
403{
404 return std::string(process->name()) + ".timeout";
405}
406
407} // namespace sc_gem5
408
409#endif //__SYSTEMC_CORE_PROCESS_HH__
403 process->satisfySensitivity(this);
404}
405
406inline void
407Sensitivity::notify(Event *e)
408{
409 if (!process->disabled())
410 notifyWork(e);
411}
412
413inline const std::string
414Sensitivity::name()
415{
416 return std::string(process->name()) + ".timeout";
417}
418
419} // namespace sc_gem5
420
421#endif //__SYSTEMC_CORE_PROCESS_HH__