gem5  v20.1.0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DRAMSim2Wrapper Class Reference

Wrapper class to avoid having DRAMSim2 names like ClockDomain etc clashing with the normal gem5 world. More...

#include <dramsim2_wrapper.hh>

Public Member Functions

 DRAMSim2Wrapper (const std::string &config_file, const std::string &system_file, const std::string &working_dir, const std::string &trace_file, unsigned int memory_size_mb, bool enable_debug)
 Create an instance of the DRAMSim2 multi-channel memory controller using a specific config and system description. More...
 
 ~DRAMSim2Wrapper ()
 
void printStats ()
 Print the stats gathered in DRAMsim2. More...
 
void setCallbacks (DRAMSim::TransactionCompleteCB *read_callback, DRAMSim::TransactionCompleteCB *write_callback)
 Set the callbacks to use for read and write completion. More...
 
bool canAccept () const
 Determine if the controller can accept a new packet or not. More...
 
void enqueue (bool is_write, uint64_t addr)
 Enqueue a packet. More...
 
double clockPeriod () const
 Get the internal clock period used by DRAMSim2, specified in ns. More...
 
unsigned int queueSize () const
 Get the transaction queue size used by DRAMSim2. More...
 
unsigned int burstSize () const
 Get the burst size in bytes used by DRAMSim2. 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

DRAMSim::MultiChannelMemorySystem * dramsim
 
double _clockPeriod
 
unsigned int _queueSize
 
unsigned int _burstSize
 

Detailed Description

Wrapper class to avoid having DRAMSim2 names like ClockDomain etc clashing with the normal gem5 world.

Many of the DRAMSim2 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 dramsim2_wrapper.hh.

Constructor & Destructor Documentation

◆ DRAMSim2Wrapper()

DRAMSim2Wrapper::DRAMSim2Wrapper ( const std::string &  config_file,
const std::string &  system_file,
const std::string &  working_dir,
const std::string &  trace_file,
unsigned int  memory_size_mb,
bool  enable_debug 
)

Create an instance of the DRAMSim2 multi-channel memory controller using a specific config and system description.

Parameters
config_fileMemory config file
system_fileController config file
working_dirPath pre-pended to config files
trace_fileOutput trace file
memory_size_mbTotal memory size in MByte
enable_debugEnable debug output

Definition at line 64 of file dramsim2_wrapper.cc.

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

◆ ~DRAMSim2Wrapper()

DRAMSim2Wrapper::~DRAMSim2Wrapper ( )

Definition at line 113 of file dramsim2_wrapper.cc.

References dramsim.

Member Function Documentation

◆ burstSize()

unsigned int DRAMSim2Wrapper::burstSize ( ) const

Get the burst size in bytes used by DRAMSim2.

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

Definition at line 189 of file dramsim2_wrapper.cc.

References _burstSize.

Referenced by DRAMSim2::init().

◆ canAccept()

bool DRAMSim2Wrapper::canAccept ( ) const

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

Returns
true if the controller can accept transactions

Definition at line 164 of file dramsim2_wrapper.cc.

References dramsim.

Referenced by DRAMSim2::recvTimingReq().

◆ clockPeriod()

double DRAMSim2Wrapper::clockPeriod ( ) const

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

Returns
The clock period of the DRAM interface in ns

Definition at line 177 of file dramsim2_wrapper.cc.

References _clockPeriod.

Referenced by DRAMSim2::readComplete(), DRAMSim2::tick(), and DRAMSim2::writeComplete().

◆ enqueue()

void DRAMSim2Wrapper::enqueue ( bool  is_write,
uint64_t  addr 
)

Enqueue a packet.

This assumes that canAccept has returned true.

Parameters
pktPacket to turn into a DRAMSim2 transaction

Definition at line 170 of file dramsim2_wrapper.cc.

References addr, and dramsim.

Referenced by DRAMSim2::recvTimingReq().

◆ extractConfig()

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

Definition at line 120 of file dramsim2_wrapper.cc.

References fatal.

◆ printStats()

void DRAMSim2Wrapper::printStats ( )

Print the stats gathered in DRAMsim2.

Definition at line 150 of file dramsim2_wrapper.cc.

References dramsim.

◆ queueSize()

unsigned int DRAMSim2Wrapper::queueSize ( ) const

Get the transaction queue size used by DRAMSim2.

Returns
The queue size counted in number of transactions

Definition at line 183 of file dramsim2_wrapper.cc.

References _queueSize.

Referenced by DRAMSim2::recvTimingReq(), and DRAMSim2::tick().

◆ setCallbacks()

void DRAMSim2Wrapper::setCallbacks ( DRAMSim::TransactionCompleteCB *  read_callback,
DRAMSim::TransactionCompleteCB *  write_callback 
)

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 156 of file dramsim2_wrapper.cc.

References dramsim.

◆ tick()

void DRAMSim2Wrapper::tick ( )

Progress the memory controller one cycle.

Definition at line 195 of file dramsim2_wrapper.cc.

References dramsim.

Referenced by DRAMSim2::tick().

Member Data Documentation

◆ _burstSize

unsigned int DRAMSim2Wrapper::_burstSize
private

Definition at line 78 of file dramsim2_wrapper.hh.

Referenced by burstSize(), and DRAMSim2Wrapper().

◆ _clockPeriod

double DRAMSim2Wrapper::_clockPeriod
private

Definition at line 74 of file dramsim2_wrapper.hh.

Referenced by clockPeriod(), and DRAMSim2Wrapper().

◆ _queueSize

unsigned int DRAMSim2Wrapper::_queueSize
private

Definition at line 76 of file dramsim2_wrapper.hh.

Referenced by DRAMSim2Wrapper(), and queueSize().

◆ dramsim

DRAMSim::MultiChannelMemorySystem* DRAMSim2Wrapper::dramsim
private

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

Generated on Wed Sep 30 2020 14:02:23 for gem5 by doxygen 1.8.17