gem5  v21.1.0.2
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
gem5::BaseGen Class Referenceabstract

Base class for all generators, with the shared functionality and virtual functions for entering, executing and leaving the generator. More...

#include <base_gen.hh>

Inheritance diagram for gem5::BaseGen:
gem5::ExitGen gem5::HybridGen gem5::IdleGen gem5::StochasticGen gem5::TraceGen gem5::LinearGen gem5::RandomGen gem5::StridedGen gem5::DramGen gem5::NvmGen gem5::DramRotGen

Public Member Functions

 BaseGen (SimObject &obj, RequestorID requestor_id, Tick _duration)
 Create a base generator. More...
 
virtual ~BaseGen ()
 
std::string name () const
 Get the name, useful for DPRINTFs. More...
 
virtual void enter ()=0
 Enter this generator state. More...
 
virtual PacketPtr getNextPacket ()=0
 Get the next generated packet. More...
 
virtual void exit ()
 Exit this generator state. More...
 
virtual Tick nextPacketTick (bool elastic, Tick delay) const =0
 Determine the tick when the next packet is available. More...
 

Public Attributes

const Tick duration
 Time to spend in this state. More...
 

Protected Member Functions

PacketPtr getPacket (Addr addr, unsigned size, const MemCmd &cmd, Request::FlagsType flags=0)
 Generate a new request and associated packet. More...
 

Protected Attributes

const std::string _name
 Name to use for status and debug printing. More...
 
const RequestorID requestorId
 The RequestorID used for generating requests. More...
 

Detailed Description

Base class for all generators, with the shared functionality and virtual functions for entering, executing and leaving the generator.

Definition at line 64 of file base_gen.hh.

Constructor & Destructor Documentation

◆ BaseGen()

gem5::BaseGen::BaseGen ( SimObject obj,
RequestorID  requestor_id,
Tick  _duration 
)

Create a base generator.

Parameters
objsimobject owning the generator
requestor_idRequestorID set on each request
_durationduration of this state before transitioning

Definition at line 48 of file base_gen.cc.

◆ ~BaseGen()

virtual gem5::BaseGen::~BaseGen ( )
inlinevirtual

Definition at line 100 of file base_gen.hh.

Member Function Documentation

◆ enter()

virtual void gem5::BaseGen::enter ( )
pure virtual

◆ exit()

virtual void gem5::BaseGen::exit ( )
inlinevirtual

Exit this generator state.

By default do nothing.

Reimplemented in gem5::TraceGen.

Definition at line 124 of file base_gen.hh.

◆ getNextPacket()

virtual PacketPtr gem5::BaseGen::getNextPacket ( )
pure virtual

Get the next generated packet.

Returns
A packet to be sent at the current tick

Implemented in gem5::TraceGen, gem5::HybridGen, gem5::DramRotGen, gem5::StridedGen, gem5::DramGen, gem5::LinearGen, gem5::NvmGen, gem5::RandomGen, gem5::IdleGen, and gem5::ExitGen.

◆ getPacket()

PacketPtr gem5::BaseGen::getPacket ( Addr  addr,
unsigned  size,
const MemCmd cmd,
Request::FlagsType  flags = 0 
)
protected

Generate a new request and associated packet.

Parameters
addrPhysical address to use
sizeSize of the request
cmdMemory command to send
flagsOptional request flags

Definition at line 55 of file base_gen.cc.

References gem5::X86ISA::addr, gem5::Packet::dataDynamic(), gem5::MemCmd::isWrite(), and requestorId.

Referenced by gem5::RandomGen::getNextPacket(), gem5::LinearGen::getNextPacket(), gem5::NvmGen::getNextPacket(), gem5::DramGen::getNextPacket(), gem5::StridedGen::getNextPacket(), gem5::DramRotGen::getNextPacket(), gem5::HybridGen::getNextPacket(), and gem5::TraceGen::getNextPacket().

◆ name()

std::string gem5::BaseGen::name ( ) const
inline

Get the name, useful for DPRINTFs.

Returns
the given name

Definition at line 107 of file base_gen.hh.

References _name.

Referenced by gem5::ExitGen::enter(), gem5::TraceGen::exit(), gem5::HybridGen::HybridGen(), and gem5::StochasticGen::StochasticGen().

◆ nextPacketTick()

virtual Tick gem5::BaseGen::nextPacketTick ( bool  elastic,
Tick  delay 
) const
pure virtual

Determine the tick when the next packet is available.

MaxTick means that there will not be any further packets in the current activation cycle of the generator.

Parameters
elasticshould the injection respond to flow control or not
delaytime the previous packet spent waiting
Returns
next tick when a packet is available

Implemented in gem5::TraceGen, gem5::HybridGen, gem5::StridedGen, gem5::LinearGen, gem5::RandomGen, gem5::IdleGen, and gem5::ExitGen.

Member Data Documentation

◆ _name

const std::string gem5::BaseGen::_name
protected

Name to use for status and debug printing.

Definition at line 70 of file base_gen.hh.

Referenced by gem5::DramRotGen::DramRotGen(), and name().

◆ duration

const Tick gem5::BaseGen::duration

Time to spend in this state.

Definition at line 89 of file base_gen.hh.

◆ requestorId

const RequestorID gem5::BaseGen::requestorId
protected

The RequestorID used for generating requests.

Definition at line 73 of file base_gen.hh.

Referenced by getPacket().


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

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