gem5  v22.1.0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
gem5::branch_prediction::ReturnAddrStack Class Reference

Return address stack class, implements a simple RAS. More...

#include <ras.hh>

Public Member Functions

 ReturnAddrStack ()
 Creates a return address stack, but init() must be called prior to use. More...
 
void init (unsigned numEntries)
 Initializes RAS with a specified number of entries. More...
 
void reset ()
 
const PCStateBasetop ()
 Returns the top address on the RAS. More...
 
unsigned topIdx ()
 Returns the index of the top of the RAS. More...
 
void push (const PCStateBase &return_addr)
 Pushes an address onto the RAS. More...
 
void pop ()
 Pops the top address from the RAS. More...
 
void restore (unsigned top_entry_idx, const PCStateBase *restored)
 Changes index to the top of the RAS, and replaces the top address with a new target. More...
 
bool empty ()
 
bool full ()
 

Private Member Functions

void incrTos ()
 Increments the top of stack index. More...
 
void decrTos ()
 Decrements the top of stack index. More...
 

Private Attributes

std::vector< std::unique_ptr< PCStateBase > > addrStack
 The RAS itself. More...
 
unsigned numEntries
 The number of entries in the RAS. More...
 
unsigned usedEntries
 The number of used entries in the RAS. More...
 
unsigned tos
 The top of stack index. More...
 

Detailed Description

Return address stack class, implements a simple RAS.

Definition at line 44 of file ras.hh.

Constructor & Destructor Documentation

◆ ReturnAddrStack()

gem5::branch_prediction::ReturnAddrStack::ReturnAddrStack ( )
inline

Creates a return address stack, but init() must be called prior to use.

Definition at line 50 of file ras.hh.

Member Function Documentation

◆ decrTos()

void gem5::branch_prediction::ReturnAddrStack::decrTos ( )
inlineprivate

Decrements the top of stack index.

Definition at line 92 of file ras.hh.

References numEntries, and tos.

Referenced by pop().

◆ empty()

bool gem5::branch_prediction::ReturnAddrStack::empty ( )
inline

Definition at line 78 of file ras.hh.

References usedEntries.

◆ full()

bool gem5::branch_prediction::ReturnAddrStack::full ( )
inline

Definition at line 80 of file ras.hh.

References numEntries, and usedEntries.

◆ incrTos()

void gem5::branch_prediction::ReturnAddrStack::incrTos ( )
inlineprivate

Increments the top of stack index.

Definition at line 84 of file ras.hh.

References numEntries, and tos.

Referenced by push().

◆ init()

void gem5::branch_prediction::ReturnAddrStack::init ( unsigned  numEntries)

Initializes RAS with a specified number of entries.

Parameters
numEntriesNumber of entries in the RAS.

Definition at line 38 of file ras.cc.

References addrStack, numEntries, and reset().

◆ pop()

void gem5::branch_prediction::ReturnAddrStack::pop ( )

Pops the top address from the RAS.

Definition at line 65 of file ras.cc.

References decrTos(), and usedEntries.

◆ push()

void gem5::branch_prediction::ReturnAddrStack::push ( const PCStateBase return_addr)

Pushes an address onto the RAS.

Definition at line 53 of file ras.cc.

References addrStack, incrTos(), numEntries, gem5::ArmISA::set, tos, and usedEntries.

◆ reset()

void gem5::branch_prediction::ReturnAddrStack::reset ( )

Definition at line 46 of file ras.cc.

References tos, and usedEntries.

Referenced by init().

◆ restore()

void gem5::branch_prediction::ReturnAddrStack::restore ( unsigned  top_entry_idx,
const PCStateBase restored 
)

Changes index to the top of the RAS, and replaces the top address with a new target.

Parameters
top_entry_idxThe index of the RAS that will now be the top.
restoredThe new target address of the new top of the RAS.

Definition at line 75 of file ras.cc.

References addrStack, numEntries, gem5::ArmISA::set, tos, and usedEntries.

◆ top()

const PCStateBase* gem5::branch_prediction::ReturnAddrStack::top ( )
inline

Returns the top address on the RAS.

Definition at line 60 of file ras.hh.

References addrStack, and tos.

◆ topIdx()

unsigned gem5::branch_prediction::ReturnAddrStack::topIdx ( )
inline

Returns the index of the top of the RAS.

Definition at line 63 of file ras.hh.

References tos.

Member Data Documentation

◆ addrStack

std::vector<std::unique_ptr<PCStateBase> > gem5::branch_prediction::ReturnAddrStack::addrStack
private

The RAS itself.

Definition at line 98 of file ras.hh.

Referenced by init(), push(), restore(), and top().

◆ numEntries

unsigned gem5::branch_prediction::ReturnAddrStack::numEntries
private

The number of entries in the RAS.

Definition at line 101 of file ras.hh.

Referenced by decrTos(), full(), incrTos(), init(), push(), and restore().

◆ tos

unsigned gem5::branch_prediction::ReturnAddrStack::tos
private

The top of stack index.

Definition at line 107 of file ras.hh.

Referenced by decrTos(), incrTos(), push(), reset(), restore(), top(), and topIdx().

◆ usedEntries

unsigned gem5::branch_prediction::ReturnAddrStack::usedEntries
private

The number of used entries in the RAS.

Definition at line 104 of file ras.hh.

Referenced by empty(), full(), pop(), push(), reset(), and restore().


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

Generated on Wed Dec 21 2022 10:23:38 for gem5 by doxygen 1.9.1