gem5  v21.1.0.2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
gem5::memory::DRAMsim3Wrapper Class Reference

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 >
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
 

Detailed Description

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 73 of file dramsim3_wrapper.hh.

Constructor & Destructor Documentation

◆ DRAMsim3Wrapper()

gem5::memory::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.

Parameters
config_fileMemory config file
working_dirPath pre-pended to config files

Definition at line 64 of file dramsim3_wrapper.cc.

References _burstSize, _clockPeriod, _queueSize, dramsim, and fatal.

◆ ~DRAMsim3Wrapper()

gem5::memory::DRAMsim3Wrapper::~DRAMsim3Wrapper ( )

Definition at line 98 of file dramsim3_wrapper.cc.

References dramsim.

Member Function Documentation

◆ burstSize()

unsigned int gem5::memory::DRAMsim3Wrapper::burstSize ( ) const

Get the burst size in bytes used by DRAMsim3.

Returns
The burst size in bytes (data width * burst length)

Definition at line 149 of file dramsim3_wrapper.cc.

References _burstSize.

Referenced by gem5::memory::DRAMsim3::init().

◆ canAccept()

bool gem5::memory::DRAMsim3Wrapper::canAccept ( uint64_t  addr,
bool  is_write 
) const

Determine if the controller can accept a new packet or not.

Returns
true if the controller can accept transactions

Definition at line 124 of file dramsim3_wrapper.cc.

References gem5::X86ISA::addr, and dramsim.

Referenced by gem5::memory::DRAMsim3::recvTimingReq().

◆ clockPeriod()

double gem5::memory::DRAMsim3Wrapper::clockPeriod ( ) const

Get the internal clock period used by DRAMsim3, specified in ns.

Returns
The clock period of the DRAM interface in ns

Definition at line 137 of file dramsim3_wrapper.cc.

References _clockPeriod.

Referenced by gem5::memory::DRAMsim3::tick().

◆ enqueue()

void gem5::memory::DRAMsim3Wrapper::enqueue ( uint64_t  addr,
bool  is_write 
)

Enqueue a packet.

This assumes that canAccept has returned true.

Parameters
pktPacket to turn into a DRAMsim3 transaction

Definition at line 130 of file dramsim3_wrapper.cc.

References gem5::X86ISA::addr, and dramsim.

Referenced by gem5::memory::DRAMsim3::recvTimingReq().

◆ extractConfig()

template<typename T >
T gem5::memory::DRAMsim3Wrapper::extractConfig ( const std::string &  field_name,
const std::string &  file_name 
) const
private

◆ printStats()

void gem5::memory::DRAMsim3Wrapper::printStats ( )

Print the stats gathered in DRAMsim3.

Definition at line 105 of file dramsim3_wrapper.cc.

References dramsim.

◆ queueSize()

unsigned int gem5::memory::DRAMsim3Wrapper::queueSize ( ) const

Get the transaction queue size used by DRAMsim3.

Returns
The queue size counted in number of transactions

Definition at line 143 of file dramsim3_wrapper.cc.

References _queueSize.

Referenced by gem5::memory::DRAMsim3::recvTimingReq(), and gem5::memory::DRAMsim3::tick().

◆ resetStats()

void gem5::memory::DRAMsim3Wrapper::resetStats ( )

Reset stats (useful for fastforwarding switch)

Definition at line 111 of file dramsim3_wrapper.cc.

References dramsim.

Referenced by gem5::memory::DRAMsim3::resetStats().

◆ setCallbacks()

void gem5::memory::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.

Parameters
read_callbackCallback used for read completions
write_callbackCallback used for write completions

Definition at line 117 of file dramsim3_wrapper.cc.

References dramsim.

◆ tick()

void gem5::memory::DRAMsim3Wrapper::tick ( )

Progress the memory controller one cycle.

Definition at line 155 of file dramsim3_wrapper.cc.

References dramsim.

Referenced by gem5::memory::DRAMsim3::tick().

Member Data Documentation

◆ _burstSize

unsigned int gem5::memory::DRAMsim3Wrapper::_burstSize
private

Definition at line 84 of file dramsim3_wrapper.hh.

Referenced by burstSize(), and DRAMsim3Wrapper().

◆ _clockPeriod

double gem5::memory::DRAMsim3Wrapper::_clockPeriod
private

Definition at line 80 of file dramsim3_wrapper.hh.

Referenced by clockPeriod(), and DRAMsim3Wrapper().

◆ _queueSize

unsigned int gem5::memory::DRAMsim3Wrapper::_queueSize
private

Definition at line 82 of file dramsim3_wrapper.hh.

Referenced by DRAMsim3Wrapper(), and queueSize().

◆ dramsim

dramsim3::MemorySystem* gem5::memory::DRAMsim3Wrapper::dramsim
private

The documentation for this class was generated from the following files:

Generated on Tue Sep 21 2021 12:31:27 for gem5 by doxygen 1.8.17