process.hh (13285:86dc66ffac35) | process.hh (13288:f1c04129f709) |
---|---|
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 --- 26 unchanged lines hidden (view full) --- 35#include <vector> 36 37#include "base/fiber.hh" 38#include "systemc/core/list.hh" 39#include "systemc/core/module.hh" 40#include "systemc/core/object.hh" 41#include "systemc/core/sched_event.hh" 42#include "systemc/core/sensitivity.hh" | 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 --- 26 unchanged lines hidden (view full) --- 35#include <vector> 36 37#include "base/fiber.hh" 38#include "systemc/core/list.hh" 39#include "systemc/core/module.hh" 40#include "systemc/core/object.hh" 41#include "systemc/core/sched_event.hh" 42#include "systemc/core/sensitivity.hh" |
43#include "systemc/ext/channel/sc_signal_in_if.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 | 44#include "systemc/ext/core/sc_event.hh" 45#include "systemc/ext/core/sc_module.hh" 46#include "systemc/ext/core/sc_process_handle.hh" 47 48namespace sc_core 49{ 50 51class sc_join; 52 53} // namespace sc_core 54 55namespace sc_gem5 56{ 57 58class ScHalt 59{}; 60 |
61class Process; 62class Reset; 63 |
|
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; } --- 30 unchanged lines hidden (view full) --- 98 99 void setStackSize(size_t size) { stackSize = size; } 100 101 void run(); 102 103 void addStatic(StaticSensitivity *); 104 void setDynamic(DynamicSensitivity *); 105 void clearDynamic() { setDynamic(nullptr); } | 64class Process : public ::sc_core::sc_process_b, public ListNode 65{ 66 public: 67 virtual ::sc_core::sc_curr_proc_kind procKind() const = 0; 68 bool needsStart() const { return _needsStart; } 69 void needsStart(bool ns) { _needsStart = ns; } 70 bool dynamic() const { return _dynamic; } 71 bool isUnwinding() const { return _isUnwinding; } --- 30 unchanged lines hidden (view full) --- 102 103 void setStackSize(size_t size) { stackSize = size; } 104 105 void run(); 106 107 void addStatic(StaticSensitivity *); 108 void setDynamic(DynamicSensitivity *); 109 void clearDynamic() { setDynamic(nullptr); } |
106 void addReset(ResetSensitivity *); | 110 void addReset(Reset *); |
107 108 ScEvent timeoutEvent; 109 void setTimeout(::sc_core::sc_time t); 110 void cancelTimeout(); 111 112 void satisfySensitivity(Sensitivity *); 113 114 void ready(); --- 69 unchanged lines hidden (view full) --- 184 int _waitCount; 185 186 int refCount; 187 188 size_t stackSize; 189 190 StaticSensitivities staticSensitivities; 191 DynamicSensitivity *dynamicSensitivity; | 111 112 ScEvent timeoutEvent; 113 void setTimeout(::sc_core::sc_time t); 114 void cancelTimeout(); 115 116 void satisfySensitivity(Sensitivity *); 117 118 void ready(); --- 69 unchanged lines hidden (view full) --- 188 int _waitCount; 189 190 int refCount; 191 192 size_t stackSize; 193 194 StaticSensitivities staticSensitivities; 195 DynamicSensitivity *dynamicSensitivity; |
192 ResetSensitivities resetSensitivities; | 196 std::vector<Reset *> resets; |
193 194 std::unique_ptr<::sc_core::sc_report> _lastReport; 195 196 std::vector<::sc_core::sc_join *> joinWaiters; 197 198 UniqueNameGen nameGen; 199}; 200 | 197 198 std::unique_ptr<::sc_core::sc_report> _lastReport; 199 200 std::vector<::sc_core::sc_join *> joinWaiters; 201 202 UniqueNameGen nameGen; 203}; 204 |
205class Reset 206{ 207 public: 208 Reset(Process *p, bool s, bool v) : 209 _process(p), _signal(nullptr), _sync(s), _value(v) 210 {} 211 212 bool 213 install(const sc_core::sc_signal_in_if<bool> *s) 214 { 215 _signal = s; 216 217 if (_signal->_addReset(this)) { 218 _process->addReset(this); 219 if (_signal->read() == _value) 220 update(); 221 return true; 222 } 223 return false; 224 } 225 void update() { _process->signalReset(_signal->read() == _value, _sync); } 226 227 Process *process() { return _process; } 228 const sc_core::sc_signal_in_if<bool> *signal() { return _signal; } 229 bool sync() { return _sync; } 230 bool value() { return _value; } 231 232 private: 233 Process *_process; 234 const sc_core::sc_signal_in_if<bool> *_signal; 235 bool _sync; 236 bool _value; 237}; 238 239void newReset(const sc_core::sc_port_base *pb, Process *p, bool s, bool v); 240void newReset(const sc_core::sc_signal_in_if<bool> *sig, Process *p, 241 bool s, bool v); 242 |
|
201} // namespace sc_gem5 202 203#endif //__SYSTEMC_CORE_PROCESS_HH__ | 243} // namespace sc_gem5 244 245#endif //__SYSTEMC_CORE_PROCESS_HH__ |