gem5
v20.1.0.0
|
Wrapper class to avoid having DRAMsim3 names like ClockDomain etc clashing with the normal gem5 world. More...
#include <dramsim3_wrapper.hh>
Public Member Functions | |
DRAMsim3Wrapper (const std::string &config_file, const std::string &working_dir, std::function< void(uint64_t)> read_cb, std::function< void(uint64_t)> write_cb) | |
Create an instance of the DRAMsim3 multi-channel memory controller using a specific config and system description. More... | |
~DRAMsim3Wrapper () | |
void | printStats () |
Print the stats gathered in DRAMsim3. More... | |
void | resetStats () |
Reset stats (useful for fastforwarding switch) More... | |
void | setCallbacks (std::function< void(uint64_t)> read_complete, std::function< void(uint64_t)> write_complete) |
Set the callbacks to use for read and write completion. More... | |
bool | canAccept (uint64_t addr, bool is_write) const |
Determine if the controller can accept a new packet or not. More... | |
void | enqueue (uint64_t addr, bool is_write) |
Enqueue a packet. More... | |
double | clockPeriod () const |
Get the internal clock period used by DRAMsim3, specified in ns. More... | |
unsigned int | queueSize () const |
Get the transaction queue size used by DRAMsim3. More... | |
unsigned int | burstSize () const |
Get the burst size in bytes used by DRAMsim3. More... | |
void | tick () |
Progress the memory controller one cycle. More... | |
Private Member Functions | |
template<typename T > | |
T | extractConfig (const std::string &field_name, const std::string &file_name) const |
Private Attributes | |
dramsim3::MemorySystem * | dramsim |
double | _clockPeriod |
unsigned int | _queueSize |
unsigned int | _burstSize |
Wrapper class to avoid having DRAMsim3 names like ClockDomain etc clashing with the normal gem5 world.
Many of the DRAMsim3 headers do not make use of namespaces, and quite a few also open up std. The only thing that needs to be exposed externally are the callbacks. This wrapper effectively avoids clashes by not including any of the conventional gem5 headers (e.g. Packet or SimObject).
Definition at line 67 of file dramsim3_wrapper.hh.
DRAMsim3Wrapper::DRAMsim3Wrapper | ( | const std::string & | config_file, |
const std::string & | working_dir, | ||
std::function< void(uint64_t)> | read_cb, | ||
std::function< void(uint64_t)> | write_cb | ||
) |
Create an instance of the DRAMsim3 multi-channel memory controller using a specific config and system description.
When building the debug binary, we need to undo the command-line definition of DEBUG not to clash with DRAMsim3 print macros that are included for no obvious reason.
config_file | Memory config file |
working_dir | Path pre-pended to config files |
Definition at line 58 of file dramsim3_wrapper.cc.
References _burstSize, _clockPeriod, _queueSize, dramsim, and fatal.
DRAMsim3Wrapper::~DRAMsim3Wrapper | ( | ) |
Definition at line 92 of file dramsim3_wrapper.cc.
References dramsim.
unsigned int DRAMsim3Wrapper::burstSize | ( | ) | const |
Get the burst size in bytes used by DRAMsim3.
Definition at line 143 of file dramsim3_wrapper.cc.
References _burstSize.
Referenced by DRAMsim3::init().
bool DRAMsim3Wrapper::canAccept | ( | uint64_t | addr, |
bool | is_write | ||
) | const |
Determine if the controller can accept a new packet or not.
Definition at line 118 of file dramsim3_wrapper.cc.
Referenced by DRAMsim3::recvTimingReq().
double DRAMsim3Wrapper::clockPeriod | ( | ) | const |
Get the internal clock period used by DRAMsim3, specified in ns.
Definition at line 131 of file dramsim3_wrapper.cc.
References _clockPeriod.
Referenced by DRAMsim3::tick().
void DRAMsim3Wrapper::enqueue | ( | uint64_t | addr, |
bool | is_write | ||
) |
Enqueue a packet.
This assumes that canAccept has returned true.
Definition at line 124 of file dramsim3_wrapper.cc.
Referenced by DRAMsim3::recvTimingReq().
|
private |
void DRAMsim3Wrapper::printStats | ( | ) |
Print the stats gathered in DRAMsim3.
Definition at line 99 of file dramsim3_wrapper.cc.
References dramsim.
unsigned int DRAMsim3Wrapper::queueSize | ( | ) | const |
Get the transaction queue size used by DRAMsim3.
Definition at line 137 of file dramsim3_wrapper.cc.
References _queueSize.
Referenced by DRAMsim3::recvTimingReq(), and DRAMsim3::tick().
void DRAMsim3Wrapper::resetStats | ( | ) |
Reset stats (useful for fastforwarding switch)
Definition at line 105 of file dramsim3_wrapper.cc.
References dramsim.
Referenced by DRAMsim3::resetStats().
void DRAMsim3Wrapper::setCallbacks | ( | std::function< void(uint64_t)> | read_complete, |
std::function< void(uint64_t)> | write_complete | ||
) |
Set the callbacks to use for read and write completion.
read_callback | Callback used for read completions |
write_callback | Callback used for write completions |
Definition at line 111 of file dramsim3_wrapper.cc.
References dramsim.
void DRAMsim3Wrapper::tick | ( | ) |
Progress the memory controller one cycle.
Definition at line 149 of file dramsim3_wrapper.cc.
References dramsim.
Referenced by DRAMsim3::tick().
|
private |
Definition at line 78 of file dramsim3_wrapper.hh.
Referenced by burstSize(), and DRAMsim3Wrapper().
|
private |
Definition at line 74 of file dramsim3_wrapper.hh.
Referenced by clockPeriod(), and DRAMsim3Wrapper().
|
private |
Definition at line 76 of file dramsim3_wrapper.hh.
Referenced by DRAMsim3Wrapper(), and queueSize().
|
private |
Definition at line 72 of file dramsim3_wrapper.hh.
Referenced by canAccept(), DRAMsim3Wrapper(), enqueue(), printStats(), resetStats(), setCallbacks(), tick(), and ~DRAMsim3Wrapper().