gem5
v20.1.0.0
|
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 VecRegContainer & | readVecReg (PhysRegIdPtr phys_reg) const |
Reads a vector register. More... | |
VecRegContainer & | getWritableVecReg (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 VecElem & | readVecElem (PhysRegIdPtr phys_reg) const |
Reads a vector element. More... | |
const VecPredRegContainer & | readVecPredReg (PhysRegIdPtr phys_reg) const |
Reads a predicate register. More... | |
VecPredRegContainer & | getWritableVecPredReg (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< RegVal > | intRegFile |
Integer register file. More... | |
std::vector< PhysRegId > | intRegIds |
std::vector< RegVal > | floatRegFile |
Floating point register file. More... | |
std::vector< PhysRegId > | floatRegIds |
std::vector< VecRegContainer > | vectorRegFile |
Vector register file. More... | |
std::vector< PhysRegId > | vecRegIds |
std::vector< PhysRegId > | vecElemIds |
std::vector< VecPredRegContainer > | vecPredRegFile |
Predicate register file. More... | |
std::vector< PhysRegId > | vecPredRegIds |
std::vector< RegVal > | ccRegFile |
Condition-code register file. More... | |
std::vector< PhysRegId > | ccRegIds |
std::vector< PhysRegId > | miscRegIds |
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 |
Simple physical register file class.
Definition at line 59 of file regfile.hh.
using PhysRegFile::IdRange = std::pair<PhysIds::iterator, PhysIds::iterator> |
Definition at line 70 of file regfile.hh.
|
private |
Definition at line 65 of file regfile.hh.
|
private |
Definition at line 63 of file regfile.hh.
|
private |
Definition at line 66 of file regfile.hh.
|
private |
Definition at line 67 of file regfile.hh.
|
private |
Definition at line 64 of file regfile.hh.
PhysRegFile::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.
Definition at line 48 of file regfile.cc.
References CCRegClass, ccRegIds, FloatRegClass, floatRegIds, IntRegClass, intRegIds, MiscRegClass, miscRegIds, ArmISA::NumCCRegs, ArmISA::NumMiscRegs, numPhysicalCCRegs, numPhysicalFloatRegs, numPhysicalIntRegs, numPhysicalVecPredRegs, numPhysicalVecRegs, NumVecElemPerVecReg, VecElemClass, vecElemIds, VecPredRegClass, vecPredRegIds, VecRegClass, vecRegIds, vectorRegFile, and warn.
|
inline |
Destructor to free resources.
Definition at line 150 of file regfile.hh.
|
inline |
Gets a misc register PhysRegIdPtr.
Definition at line 175 of file regfile.hh.
References miscRegIds.
Referenced by UnifiedRenameMap::lookup().
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().
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().
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().
|
inline |
Definition at line 280 of file regfile.hh.
References readVecPredReg().
|
inline |
Reads a vector register for modification.
Definition at line 218 of file regfile.hh.
References readVecReg().
void PhysRegFile::initFreeList | ( | UnifiedFreeList * | freeList | ) |
Initialize the free list.
Definition at line 131 of file regfile.cc.
References UnifiedFreeList::addRegs(), ccRegIds, floatRegIds, MipsISA::index, intRegIds, numPhysicalCCRegs, numPhysicalFloatRegs, numPhysicalIntRegs, numPhysicalVecPredRegs, numPhysicalVecRegs, NumVecElemPerVecReg, vecElemIds, vecMode, vecPredRegIds, and vecRegIds.
Referenced by UnifiedFreeList::UnifiedFreeList().
|
inline |
Definition at line 169 of file regfile.hh.
References numPhysicalCCRegs.
|
inline |
Definition at line 159 of file regfile.hh.
References numPhysicalFloatRegs.
|
inline |
Definition at line 156 of file regfile.hh.
References numPhysicalIntRegs.
|
inline |
Definition at line 163 of file regfile.hh.
References numPhysicalVecPredRegs.
|
inline |
Definition at line 166 of file regfile.hh.
References numPhysicalVecElemRegs.
Referenced by UnifiedRenameMap::switchFreeList().
|
inline |
Definition at line 161 of file regfile.hh.
References numPhysicalVecRegs.
Referenced by UnifiedRenameMap::switchFreeList().
|
inline |
Reads a condition-code register.
Definition at line 288 of file regfile.hh.
References ccRegFile, DPRINTF, PhysRegId::index(), and PhysRegId::isCCPhysReg().
|
inline |
Definition at line 191 of file regfile.hh.
References DPRINTF, floatRegFile, PhysRegId::index(), and PhysRegId::isFloatPhysReg().
|
inline |
Reads an integer register.
Definition at line 181 of file regfile.hh.
References DPRINTF, PhysRegId::index(), intRegFile, and PhysRegId::isIntPhysReg().
|
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().
|
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().
|
inline |
Reads a vector register lane.
Definition at line 235 of file regfile.hh.
References PhysRegId::elemIndex(), VecRegContainer< SIZE >::laneView(), and readVecReg().
|
inline |
Reads a predicate register.
Definition at line 269 of file regfile.hh.
References DPRINTF, PhysRegId::index(), PhysRegId::isVecPredPhysReg(), and vecPredRegFile.
Referenced by getWritableVecPredReg().
|
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().
|
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.
|
inline |
Definition at line 313 of file regfile.hh.
References DPRINTF, floatRegFile, PhysRegId::index(), PhysRegId::isFloatPhysReg(), PhysRegId::isZeroReg(), and X86ISA::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.
|
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.
|
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().
|
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.
|
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().
|
inline |
Definition at line 172 of file regfile.hh.
References totalNumRegs.
|
private |
Condition-code register file.
Definition at line 92 of file regfile.hh.
Referenced by readCCReg(), and setCCReg().
|
private |
Definition at line 93 of file regfile.hh.
Referenced by getRegIds(), initFreeList(), and PhysRegFile().
|
private |
Floating point register file.
Definition at line 79 of file regfile.hh.
Referenced by readFloatReg(), and setFloatReg().
|
private |
Definition at line 80 of file regfile.hh.
Referenced by getRegIds(), initFreeList(), and PhysRegFile().
|
private |
Integer register file.
Definition at line 75 of file regfile.hh.
Referenced by readIntReg(), and setIntReg().
|
private |
Definition at line 76 of file regfile.hh.
Referenced by getRegIds(), initFreeList(), and PhysRegFile().
|
private |
Misc Reg Ids.
Definition at line 96 of file regfile.hh.
Referenced by getMiscRegId(), getRegIds(), and PhysRegFile().
|
private |
Number of physical CC registers.
Definition at line 126 of file regfile.hh.
Referenced by initFreeList(), numCCPhysRegs(), and PhysRegFile().
|
private |
Number of physical floating point registers.
Definition at line 106 of file regfile.hh.
Referenced by initFreeList(), numFloatPhysRegs(), and PhysRegFile().
|
private |
Number of physical general purpose registers.
Definition at line 101 of file regfile.hh.
Referenced by initFreeList(), numIntPhysRegs(), and PhysRegFile().
|
private |
Number of physical vector element registers.
Definition at line 116 of file regfile.hh.
Referenced by numVecElemPhysRegs().
|
private |
Number of physical predicate registers.
Definition at line 121 of file regfile.hh.
Referenced by initFreeList(), numPredPhysRegs(), and PhysRegFile().
|
private |
Number of physical vector registers.
Definition at line 111 of file regfile.hh.
Referenced by initFreeList(), numVecPhysRegs(), and PhysRegFile().
|
staticconstexprprivate |
Definition at line 72 of file regfile.hh.
Referenced by getRegElemIds(), getTrueId(), initFreeList(), and PhysRegFile().
|
private |
Total number of physical registers.
Definition at line 129 of file regfile.hh.
Referenced by totalNumPhysRegs().
|
private |
Definition at line 85 of file regfile.hh.
Referenced by getRegElemIds(), getRegIds(), getTrueId(), initFreeList(), and PhysRegFile().
|
private |
Mode in which vector registers are addressed.
Definition at line 132 of file regfile.hh.
Referenced by initFreeList().
|
private |
Predicate register file.
Definition at line 88 of file regfile.hh.
Referenced by readVecPredReg(), and setVecPredReg().
|
private |
Definition at line 89 of file regfile.hh.
Referenced by getRegIds(), initFreeList(), and PhysRegFile().
|
private |
Definition at line 84 of file regfile.hh.
Referenced by getRegIds(), getTrueId(), initFreeList(), and PhysRegFile().
|
private |
Vector register file.
Definition at line 83 of file regfile.hh.
Referenced by PhysRegFile(), readVecElem(), readVecReg(), setVecElem(), setVecLane(), and setVecReg().