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

Simple physical register file class. More...

#include <regfile.hh>

Public Types

using IdRange = std::pair< PhysIds::iterator, PhysIds::iterator >
 

Public Member Functions

 PhysRegFile (unsigned _numPhysicalIntRegs, unsigned _numPhysicalFloatRegs, unsigned _numPhysicalVecRegs, unsigned _numPhysicalVecPredRegs, unsigned _numPhysicalCCRegs, VecMode vmode)
 Constructs a physical register file with the specified amount of integer and floating point registers. More...
 
 ~PhysRegFile ()
 Destructor to free resources. More...
 
void initFreeList (UnifiedFreeList *freeList)
 Initialize the free list. More...
 
unsigned numIntPhysRegs () const
 
unsigned numFloatPhysRegs () const
 
unsigned numVecPhysRegs () const
 
unsigned numPredPhysRegs () const
 
unsigned numVecElemPhysRegs () const
 
unsigned numCCPhysRegs () const
 
unsigned totalNumPhysRegs () const
 
PhysRegIdPtr getMiscRegId (RegIndex reg_idx)
 Gets a misc register PhysRegIdPtr. More...
 
RegVal readIntReg (PhysRegIdPtr phys_reg) const
 Reads an integer register. More...
 
RegVal readFloatReg (PhysRegIdPtr phys_reg) const
 
const VecRegContainerreadVecReg (PhysRegIdPtr phys_reg) const
 Reads a vector register. More...
 
VecRegContainergetWritableVecReg (PhysRegIdPtr phys_reg)
 Reads a vector register for modification. More...
 
template<typename VecElem , int LaneIdx>
VecLaneT< VecElem, true > readVecLane (PhysRegIdPtr phys_reg) const
 Reads a vector register lane. More...
 
template<typename VecElem >
VecLaneT< VecElem, true > readVecLane (PhysRegIdPtr phys_reg) const
 Reads a vector register lane. More...
 
template<typename LD >
void setVecLane (PhysRegIdPtr phys_reg, const LD &val)
 Get a vector register lane for modification. More...
 
const VecElemreadVecElem (PhysRegIdPtr phys_reg) const
 Reads a vector element. More...
 
const VecPredRegContainerreadVecPredReg (PhysRegIdPtr phys_reg) const
 Reads a predicate register. More...
 
VecPredRegContainergetWritableVecPredReg (PhysRegIdPtr phys_reg)
 
RegVal readCCReg (PhysRegIdPtr phys_reg)
 Reads a condition-code register. More...
 
void setIntReg (PhysRegIdPtr phys_reg, RegVal val)
 Sets an integer register to the given value. More...
 
void setFloatReg (PhysRegIdPtr phys_reg, RegVal val)
 
void setVecReg (PhysRegIdPtr phys_reg, const VecRegContainer &val)
 Sets a vector register to the given value. More...
 
void setVecElem (PhysRegIdPtr phys_reg, const VecElem val)
 Sets a vector register to the given value. More...
 
void setVecPredReg (PhysRegIdPtr phys_reg, const VecPredRegContainer &val)
 Sets a predicate register to the given value. More...
 
void setCCReg (PhysRegIdPtr phys_reg, RegVal val)
 Sets a condition-code register to the given value. More...
 
IdRange getRegElemIds (PhysRegIdPtr reg)
 Get the PhysRegIds of the elems of a vector register. More...
 
IdRange getRegIds (RegClass cls)
 Get the PhysRegIds of the elems of all vector registers. More...
 
PhysRegIdPtr getTrueId (PhysRegIdPtr reg)
 Get the true physical register id. More...
 

Private Types

using VecElem = TheISA::VecElem
 
using VecRegContainer = TheISA::VecRegContainer
 
using PhysIds = std::vector< PhysRegId >
 
using VecMode = Enums::VecRegRenameMode
 
using VecPredRegContainer = TheISA::VecPredRegContainer
 

Private Attributes

std::vector< RegValintRegFile
 Integer register file. More...
 
std::vector< PhysRegIdintRegIds
 
std::vector< RegValfloatRegFile
 Floating point register file. More...
 
std::vector< PhysRegIdfloatRegIds
 
std::vector< VecRegContainervectorRegFile
 Vector register file. More...
 
std::vector< PhysRegIdvecRegIds
 
std::vector< PhysRegIdvecElemIds
 
std::vector< VecPredRegContainervecPredRegFile
 Predicate register file. More...
 
std::vector< PhysRegIdvecPredRegIds
 
std::vector< RegValccRegFile
 Condition-code register file. More...
 
std::vector< PhysRegIdccRegIds
 
std::vector< PhysRegIdmiscRegIds
 Misc Reg Ids. More...
 
unsigned numPhysicalIntRegs
 Number of physical general purpose registers. More...
 
unsigned numPhysicalFloatRegs
 Number of physical floating point registers. More...
 
unsigned numPhysicalVecRegs
 Number of physical vector registers. More...
 
unsigned numPhysicalVecElemRegs
 Number of physical vector element registers. More...
 
unsigned numPhysicalVecPredRegs
 Number of physical predicate registers. More...
 
unsigned numPhysicalCCRegs
 Number of physical CC registers. More...
 
unsigned totalNumRegs
 Total number of physical registers. More...
 
VecMode vecMode
 Mode in which vector registers are addressed. More...
 

Static Private Attributes

static constexpr auto NumVecElemPerVecReg = TheISA::NumVecElemPerVecReg
 

Detailed Description

Simple physical register file class.

Definition at line 59 of file regfile.hh.

Member Typedef Documentation

◆ IdRange

using PhysRegFile::IdRange = std::pair<PhysIds::iterator, PhysIds::iterator>

Definition at line 70 of file regfile.hh.

◆ PhysIds

Definition at line 65 of file regfile.hh.

◆ VecElem

using PhysRegFile::VecElem = TheISA::VecElem
private

Definition at line 63 of file regfile.hh.

◆ VecMode

using PhysRegFile::VecMode = Enums::VecRegRenameMode
private

Definition at line 66 of file regfile.hh.

◆ VecPredRegContainer

using PhysRegFile::VecPredRegContainer = TheISA::VecPredRegContainer
private

Definition at line 67 of file regfile.hh.

◆ VecRegContainer

using PhysRegFile::VecRegContainer = TheISA::VecRegContainer
private

Definition at line 64 of file regfile.hh.

Constructor & Destructor Documentation

◆ PhysRegFile()

PhysRegFile::PhysRegFile ( unsigned  _numPhysicalIntRegs,
unsigned  _numPhysicalFloatRegs,
unsigned  _numPhysicalVecRegs,
unsigned  _numPhysicalVecPredRegs,
unsigned  _numPhysicalCCRegs,
VecMode  vmode 
)

◆ ~PhysRegFile()

PhysRegFile::~PhysRegFile ( )
inline

Destructor to free resources.

Definition at line 150 of file regfile.hh.

Member Function Documentation

◆ getMiscRegId()

PhysRegIdPtr PhysRegFile::getMiscRegId ( RegIndex  reg_idx)
inline

Gets a misc register PhysRegIdPtr.

Definition at line 175 of file regfile.hh.

References miscRegIds.

Referenced by UnifiedRenameMap::lookup().

◆ getRegElemIds()

PhysRegFile::IdRange PhysRegFile::getRegElemIds ( PhysRegIdPtr  reg)

Get the PhysRegIds of the elems of a vector register.

Auxiliary function to transition from Full vector mode to Elem mode.

Definition at line 184 of file regfile.cc.

References NumVecElemPerVecReg, panic_if, X86ISA::reg, and vecElemIds.

Referenced by UnifiedRenameMap::switchFreeList(), and UnifiedRenameMap::switchMode().

◆ getRegIds()

PhysRegFile::IdRange PhysRegFile::getRegIds ( RegClass  cls)

Get the PhysRegIds of the elems of all vector registers.

Auxiliary function to transition from Full vector mode to Elem mode and to initialise the rename map.

Definition at line 195 of file regfile.cc.

References CCRegClass, ccRegIds, FloatRegClass, floatRegIds, IntRegClass, intRegIds, MiscRegClass, miscRegIds, VecElemClass, vecElemIds, VecPredRegClass, vecPredRegIds, VecRegClass, and vecRegIds.

Referenced by UnifiedRenameMap::switchFreeList(), and UnifiedRenameMap::switchMode().

◆ getTrueId()

PhysRegIdPtr PhysRegFile::getTrueId ( PhysRegIdPtr  reg)

Get the true physical register id.

As many parts work with PhysRegIdPtr, we need to be able to produce the pointer out of just class and register idx.

Definition at line 220 of file regfile.cc.

References NumVecElemPerVecReg, panic_if, X86ISA::reg, VecElemClass, vecElemIds, VecRegClass, and vecRegIds.

Referenced by UnifiedRenameMap::switchMode().

◆ getWritableVecPredReg()

VecPredRegContainer& PhysRegFile::getWritableVecPredReg ( PhysRegIdPtr  phys_reg)
inline

Definition at line 280 of file regfile.hh.

References readVecPredReg().

◆ getWritableVecReg()

VecRegContainer& PhysRegFile::getWritableVecReg ( PhysRegIdPtr  phys_reg)
inline

Reads a vector register for modification.

Definition at line 218 of file regfile.hh.

References readVecReg().

◆ initFreeList()

void PhysRegFile::initFreeList ( UnifiedFreeList freeList)

◆ numCCPhysRegs()

unsigned PhysRegFile::numCCPhysRegs ( ) const
inline
Returns
the number of condition-code physical registers.

Definition at line 169 of file regfile.hh.

References numPhysicalCCRegs.

◆ numFloatPhysRegs()

unsigned PhysRegFile::numFloatPhysRegs ( ) const
inline
Returns
the number of floating-point physical registers.

Definition at line 159 of file regfile.hh.

References numPhysicalFloatRegs.

◆ numIntPhysRegs()

unsigned PhysRegFile::numIntPhysRegs ( ) const
inline
Returns
the number of integer physical registers.

Definition at line 156 of file regfile.hh.

References numPhysicalIntRegs.

◆ numPredPhysRegs()

unsigned PhysRegFile::numPredPhysRegs ( ) const
inline
Returns
the number of predicate physical registers.

Definition at line 163 of file regfile.hh.

References numPhysicalVecPredRegs.

◆ numVecElemPhysRegs()

unsigned PhysRegFile::numVecElemPhysRegs ( ) const
inline
Returns
the number of vector physical registers.

Definition at line 166 of file regfile.hh.

References numPhysicalVecElemRegs.

Referenced by UnifiedRenameMap::switchFreeList().

◆ numVecPhysRegs()

unsigned PhysRegFile::numVecPhysRegs ( ) const
inline
Returns
the number of vector physical registers.

Definition at line 161 of file regfile.hh.

References numPhysicalVecRegs.

Referenced by UnifiedRenameMap::switchFreeList().

◆ readCCReg()

RegVal PhysRegFile::readCCReg ( PhysRegIdPtr  phys_reg)
inline

Reads a condition-code register.

Definition at line 288 of file regfile.hh.

References ccRegFile, DPRINTF, PhysRegId::index(), and PhysRegId::isCCPhysReg().

◆ readFloatReg()

RegVal PhysRegFile::readFloatReg ( PhysRegIdPtr  phys_reg) const
inline

Definition at line 191 of file regfile.hh.

References DPRINTF, floatRegFile, PhysRegId::index(), and PhysRegId::isFloatPhysReg().

◆ readIntReg()

RegVal PhysRegFile::readIntReg ( PhysRegIdPtr  phys_reg) const
inline

Reads an integer register.

Definition at line 181 of file regfile.hh.

References DPRINTF, PhysRegId::index(), intRegFile, and PhysRegId::isIntPhysReg().

◆ readVecElem()

const VecElem& PhysRegFile::readVecElem ( PhysRegIdPtr  phys_reg) const
inline

Reads a vector element.

Definition at line 256 of file regfile.hh.

References DPRINTF, PhysRegId::elemIndex(), PhysRegId::index(), PhysRegId::isVectorPhysElem(), X86ISA::val, and vectorRegFile.

Referenced by UnifiedRenameMap::switchMode().

◆ readVecLane() [1/2]

template<typename VecElem , int LaneIdx>
VecLaneT<VecElem, true> PhysRegFile::readVecLane ( PhysRegIdPtr  phys_reg) const
inline

Reads a vector register lane.

Definition at line 227 of file regfile.hh.

References VecRegContainer< SIZE >::laneView(), and readVecReg().

Referenced by FullO3CPU< O3CPUImpl >::readVecLane().

◆ readVecLane() [2/2]

template<typename VecElem >
VecLaneT<VecElem, true> PhysRegFile::readVecLane ( PhysRegIdPtr  phys_reg) const
inline

Reads a vector register lane.

Definition at line 235 of file regfile.hh.

References PhysRegId::elemIndex(), VecRegContainer< SIZE >::laneView(), and readVecReg().

◆ readVecPredReg()

const VecPredRegContainer& PhysRegFile::readVecPredReg ( PhysRegIdPtr  phys_reg) const
inline

Reads a predicate register.

Definition at line 269 of file regfile.hh.

References DPRINTF, PhysRegId::index(), PhysRegId::isVecPredPhysReg(), and vecPredRegFile.

Referenced by getWritableVecPredReg().

◆ readVecReg()

const VecRegContainer& PhysRegFile::readVecReg ( PhysRegIdPtr  phys_reg) const
inline

Reads a vector register.

Definition at line 205 of file regfile.hh.

References DPRINTF, PhysRegId::index(), PhysRegId::isVectorPhysReg(), and vectorRegFile.

Referenced by getWritableVecReg(), and readVecLane().

◆ setCCReg()

void PhysRegFile::setCCReg ( PhysRegIdPtr  phys_reg,
RegVal  val 
)
inline

Sets a condition-code register to the given value.

Definition at line 362 of file regfile.hh.

References ccRegFile, DPRINTF, PhysRegId::index(), PhysRegId::isCCPhysReg(), and X86ISA::val.

◆ setFloatReg()

void PhysRegFile::setFloatReg ( PhysRegIdPtr  phys_reg,
RegVal  val 
)
inline

◆ setIntReg()

void PhysRegFile::setIntReg ( PhysRegIdPtr  phys_reg,
RegVal  val 
)
inline

Sets an integer register to the given value.

Definition at line 301 of file regfile.hh.

References DPRINTF, PhysRegId::index(), intRegFile, PhysRegId::isIntPhysReg(), PhysRegId::isZeroReg(), and X86ISA::val.

◆ setVecElem()

void PhysRegFile::setVecElem ( PhysRegIdPtr  phys_reg,
const VecElem  val 
)
inline

Sets a vector register to the given value.

Definition at line 338 of file regfile.hh.

References DPRINTF, PhysRegId::elemIndex(), PhysRegId::index(), PhysRegId::isVectorPhysElem(), X86ISA::val, and vectorRegFile.

◆ setVecLane()

template<typename LD >
void PhysRegFile::setVecLane ( PhysRegIdPtr  phys_reg,
const LD &  val 
)
inline

Get a vector register lane for modification.

Definition at line 243 of file regfile.hh.

References DPRINTF, PhysRegId::elemIndex(), PhysRegId::index(), PhysRegId::isVectorPhysReg(), X86ISA::val, and vectorRegFile.

Referenced by FullO3CPU< O3CPUImpl >::setVecLane().

◆ setVecPredReg()

void PhysRegFile::setVecPredReg ( PhysRegIdPtr  phys_reg,
const VecPredRegContainer val 
)
inline

Sets a predicate register to the given value.

Definition at line 350 of file regfile.hh.

References DPRINTF, PhysRegId::index(), PhysRegId::isVecPredPhysReg(), X86ISA::val, and vecPredRegFile.

◆ setVecReg()

void PhysRegFile::setVecReg ( PhysRegIdPtr  phys_reg,
const VecRegContainer val 
)
inline

Sets a vector register to the given value.

Definition at line 326 of file regfile.hh.

References DPRINTF, PhysRegId::index(), PhysRegId::isVectorPhysReg(), X86ISA::val, and vectorRegFile.

Referenced by UnifiedRenameMap::switchMode().

◆ totalNumPhysRegs()

unsigned PhysRegFile::totalNumPhysRegs ( ) const
inline
Returns
the total number of physical registers.

Definition at line 172 of file regfile.hh.

References totalNumRegs.

Member Data Documentation

◆ ccRegFile

std::vector<RegVal> PhysRegFile::ccRegFile
private

Condition-code register file.

Definition at line 92 of file regfile.hh.

Referenced by readCCReg(), and setCCReg().

◆ ccRegIds

std::vector<PhysRegId> PhysRegFile::ccRegIds
private

Definition at line 93 of file regfile.hh.

Referenced by getRegIds(), initFreeList(), and PhysRegFile().

◆ floatRegFile

std::vector<RegVal> PhysRegFile::floatRegFile
private

Floating point register file.

Definition at line 79 of file regfile.hh.

Referenced by readFloatReg(), and setFloatReg().

◆ floatRegIds

std::vector<PhysRegId> PhysRegFile::floatRegIds
private

Definition at line 80 of file regfile.hh.

Referenced by getRegIds(), initFreeList(), and PhysRegFile().

◆ intRegFile

std::vector<RegVal> PhysRegFile::intRegFile
private

Integer register file.

Definition at line 75 of file regfile.hh.

Referenced by readIntReg(), and setIntReg().

◆ intRegIds

std::vector<PhysRegId> PhysRegFile::intRegIds
private

Definition at line 76 of file regfile.hh.

Referenced by getRegIds(), initFreeList(), and PhysRegFile().

◆ miscRegIds

std::vector<PhysRegId> PhysRegFile::miscRegIds
private

Misc Reg Ids.

Definition at line 96 of file regfile.hh.

Referenced by getMiscRegId(), getRegIds(), and PhysRegFile().

◆ numPhysicalCCRegs

unsigned PhysRegFile::numPhysicalCCRegs
private

Number of physical CC registers.

Definition at line 126 of file regfile.hh.

Referenced by initFreeList(), numCCPhysRegs(), and PhysRegFile().

◆ numPhysicalFloatRegs

unsigned PhysRegFile::numPhysicalFloatRegs
private

Number of physical floating point registers.

Definition at line 106 of file regfile.hh.

Referenced by initFreeList(), numFloatPhysRegs(), and PhysRegFile().

◆ numPhysicalIntRegs

unsigned PhysRegFile::numPhysicalIntRegs
private

Number of physical general purpose registers.

Definition at line 101 of file regfile.hh.

Referenced by initFreeList(), numIntPhysRegs(), and PhysRegFile().

◆ numPhysicalVecElemRegs

unsigned PhysRegFile::numPhysicalVecElemRegs
private

Number of physical vector element registers.

Definition at line 116 of file regfile.hh.

Referenced by numVecElemPhysRegs().

◆ numPhysicalVecPredRegs

unsigned PhysRegFile::numPhysicalVecPredRegs
private

Number of physical predicate registers.

Definition at line 121 of file regfile.hh.

Referenced by initFreeList(), numPredPhysRegs(), and PhysRegFile().

◆ numPhysicalVecRegs

unsigned PhysRegFile::numPhysicalVecRegs
private

Number of physical vector registers.

Definition at line 111 of file regfile.hh.

Referenced by initFreeList(), numVecPhysRegs(), and PhysRegFile().

◆ NumVecElemPerVecReg

constexpr auto PhysRegFile::NumVecElemPerVecReg = TheISA::NumVecElemPerVecReg
staticconstexprprivate

Definition at line 72 of file regfile.hh.

Referenced by getRegElemIds(), getTrueId(), initFreeList(), and PhysRegFile().

◆ totalNumRegs

unsigned PhysRegFile::totalNumRegs
private

Total number of physical registers.

Definition at line 129 of file regfile.hh.

Referenced by totalNumPhysRegs().

◆ vecElemIds

std::vector<PhysRegId> PhysRegFile::vecElemIds
private

Definition at line 85 of file regfile.hh.

Referenced by getRegElemIds(), getRegIds(), getTrueId(), initFreeList(), and PhysRegFile().

◆ vecMode

VecMode PhysRegFile::vecMode
private

Mode in which vector registers are addressed.

Definition at line 132 of file regfile.hh.

Referenced by initFreeList().

◆ vecPredRegFile

std::vector<VecPredRegContainer> PhysRegFile::vecPredRegFile
private

Predicate register file.

Definition at line 88 of file regfile.hh.

Referenced by readVecPredReg(), and setVecPredReg().

◆ vecPredRegIds

std::vector<PhysRegId> PhysRegFile::vecPredRegIds
private

Definition at line 89 of file regfile.hh.

Referenced by getRegIds(), initFreeList(), and PhysRegFile().

◆ vecRegIds

std::vector<PhysRegId> PhysRegFile::vecRegIds
private

Definition at line 84 of file regfile.hh.

Referenced by getRegIds(), getTrueId(), initFreeList(), and PhysRegFile().

◆ vectorRegFile

std::vector<VecRegContainer> PhysRegFile::vectorRegFile
private

Vector register file.

Definition at line 83 of file regfile.hh.

Referenced by PhysRegFile(), readVecElem(), readVecReg(), setVecElem(), setVecLane(), and setVecReg().


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

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