gem5  v20.1.0.0
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
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 BaseGen:
ExitGen HybridGen IdleGen StochasticGen TraceGen LinearGen RandomGen DramGen NvmGen 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 57 of file base_gen.hh.

Constructor & Destructor Documentation

◆ BaseGen()

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 49 of file base_gen.cc.

◆ ~BaseGen()

virtual BaseGen::~BaseGen ( )
inlinevirtual

Definition at line 93 of file base_gen.hh.

Member Function Documentation

◆ enter()

virtual void BaseGen::enter ( )
pure virtual

Enter this generator state.

Implemented in TraceGen, HybridGen, LinearGen, RandomGen, IdleGen, and ExitGen.

◆ exit()

virtual void BaseGen::exit ( )
inlinevirtual

Exit this generator state.

By default do nothing.

Reimplemented in TraceGen.

Definition at line 117 of file base_gen.hh.

◆ getNextPacket()

virtual PacketPtr BaseGen::getNextPacket ( )
pure virtual

Get the next generated packet.

Returns
A packet to be sent at the current tick

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

◆ getPacket()

PacketPtr 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 56 of file base_gen.cc.

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

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

◆ name()

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

Get the name, useful for DPRINTFs.

Returns
the given name

Definition at line 100 of file base_gen.hh.

References _name.

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

◆ nextPacketTick()

virtual Tick 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 TraceGen, HybridGen, LinearGen, RandomGen, IdleGen, and ExitGen.

Member Data Documentation

◆ _name

const std::string BaseGen::_name
protected

Name to use for status and debug printing.

Definition at line 63 of file base_gen.hh.

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

◆ duration

const Tick BaseGen::duration

Time to spend in this state.

Definition at line 82 of file base_gen.hh.

◆ requestorId

const RequestorID BaseGen::requestorId
protected

The RequestorID used for generating requests.

Definition at line 66 of file base_gen.hh.

Referenced by getPacket().


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

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