gem5  v20.1.0.0
Public Types | Public Member Functions | Private Types | Static Private Member Functions | Private Attributes | Friends | List of all members
VecRegT< VecElem, NumElems, Const > Class Template Reference

Vector Register Abstraction This generic class is a view in a particularization of MVC, to vector registers. More...

#include <vec_reg.hh>

Public Types

using Container = typename std::conditional< Const, const VecRegContainer< size()>, VecRegContainer< size()> >::type
 Container type alias. More...
 

Public Member Functions

 VecRegT (Container &cnt)
 Constructor. More...
 
template<bool Condition = !Const>
std::enable_if< Condition, void >::type zero ()
 Zero the container. More...
 
template<bool Condition = !Const>
std::enable_if< Condition, MyClass & >::type operator= (const MyClass &that)
 
const VecElem & operator[] (size_t idx) const
 Index operator. More...
 
template<bool Condition = !Const>
std::enable_if< Condition, VecElem & >::type operator[] (size_t idx)
 Index operator. More...
 
template<typename VE2 , size_t NE2, bool C2>
bool operator== (const VecRegT< VE2, NE2, C2 > &that) const
 Equality operator. More...
 
template<typename VE2 , size_t NE2, bool C2>
bool operator!= (const VecRegT< VE2, NE2, C2 > &that) const
 Inequality operator. More...
 
const std::string print () const
 
 operator Container & ()
 Cast to VecRegContainer& It is useful to get the reference to the container for ISA tricks, because casting to reference prevents unnecessary copies. More...
 

Private Types

using MyClass = VecRegT< VecElem, NumElems, Const >
 My type alias. More...
 

Static Private Member Functions

static constexpr size_t size ()
 Size of the register in bytes. More...
 

Private Attributes

Containercontainer
 Reference to container. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const MyClass &vr)
 Output stream operator. More...
 

Detailed Description

template<typename VecElem, size_t NumElems, bool Const>
class VecRegT< VecElem, NumElems, Const >

Vector Register Abstraction This generic class is a view in a particularization of MVC, to vector registers.

There is a VecRegContainer that implements the model, and contains the data. To that model we can interpose different instantiations of VecRegT to view the container as a vector of NumElems elems of type VecElem.

Template Parameters
VecElemType of each element of the vector.
NumElemsAmount of components of the vector.
ConstIndicate if the underlying container can be modified through the view.

Definition at line 170 of file vec_reg.hh.

Member Typedef Documentation

◆ Container

template<typename VecElem , size_t NumElems, bool Const>
using VecRegT< VecElem, NumElems, Const >::Container = typename std::conditional<Const, const VecRegContainer<size()>, VecRegContainer<size()> >::type

Container type alias.

Definition at line 182 of file vec_reg.hh.

◆ MyClass

template<typename VecElem , size_t NumElems, bool Const>
using VecRegT< VecElem, NumElems, Const >::MyClass = VecRegT<VecElem, NumElems, Const>
private

My type alias.

Definition at line 185 of file vec_reg.hh.

Constructor & Destructor Documentation

◆ VecRegT()

template<typename VecElem , size_t NumElems, bool Const>
VecRegT< VecElem, NumElems, Const >::VecRegT ( Container cnt)
inline

Constructor.

Definition at line 191 of file vec_reg.hh.

Member Function Documentation

◆ operator Container &()

template<typename VecElem , size_t NumElems, bool Const>
VecRegT< VecElem, NumElems, Const >::operator Container & ( )
inline

Cast to VecRegContainer& It is useful to get the reference to the container for ISA tricks, because casting to reference prevents unnecessary copies.

Definition at line 257 of file vec_reg.hh.

References VecRegT< VecElem, NumElems, Const >::container.

◆ operator!=()

template<typename VecElem , size_t NumElems, bool Const>
template<typename VE2 , size_t NE2, bool C2>
bool VecRegT< VecElem, NumElems, Const >::operator!= ( const VecRegT< VE2, NE2, C2 > &  that) const
inline

Inequality operator.

Required to compare thread contexts.

Definition at line 234 of file vec_reg.hh.

References VecRegT< VecElem, NumElems, Const >::operator==().

◆ operator=()

template<typename VecElem , size_t NumElems, bool Const>
template<bool Condition = !Const>
std::enable_if<Condition, MyClass&>::type VecRegT< VecElem, NumElems, Const >::operator= ( const MyClass that)
inline

Definition at line 200 of file vec_reg.hh.

References VecRegT< VecElem, NumElems, Const >::container.

◆ operator==()

template<typename VecElem , size_t NumElems, bool Const>
template<typename VE2 , size_t NE2, bool C2>
bool VecRegT< VecElem, NumElems, Const >::operator== ( const VecRegT< VE2, NE2, C2 > &  that) const
inline

Equality operator.

Required to compare thread contexts.

Definition at line 225 of file vec_reg.hh.

References VecRegT< VecElem, NumElems, Const >::container.

Referenced by VecRegT< VecElem, NumElems, Const >::operator!=().

◆ operator[]() [1/2]

template<typename VecElem , size_t NumElems, bool Const>
template<bool Condition = !Const>
std::enable_if<Condition, VecElem&>::type VecRegT< VecElem, NumElems, Const >::operator[] ( size_t  idx)
inline

Index operator.

Definition at line 215 of file vec_reg.hh.

References VecRegT< VecElem, NumElems, Const >::container.

◆ operator[]() [2/2]

template<typename VecElem , size_t NumElems, bool Const>
const VecElem& VecRegT< VecElem, NumElems, Const >::operator[] ( size_t  idx) const
inline

Index operator.

Definition at line 207 of file vec_reg.hh.

References VecRegT< VecElem, NumElems, Const >::container.

◆ print()

template<typename VecElem , size_t NumElems, bool Const>
const std::string VecRegT< VecElem, NumElems, Const >::print ( ) const
inline

Definition at line 251 of file vec_reg.hh.

References csprintf().

◆ size()

template<typename VecElem , size_t NumElems, bool Const>
static constexpr size_t VecRegT< VecElem, NumElems, Const >::size ( )
inlinestaticconstexprprivate

Size of the register in bytes.

Definition at line 174 of file vec_reg.hh.

◆ zero()

template<typename VecElem , size_t NumElems, bool Const>
template<bool Condition = !Const>
std::enable_if<Condition, void>::type VecRegT< VecElem, NumElems, Const >::zero ( )
inline

Zero the container.

Definition at line 196 of file vec_reg.hh.

References VecRegT< VecElem, NumElems, Const >::container.

Friends And Related Function Documentation

◆ operator<<

template<typename VecElem , size_t NumElems, bool Const>
std::ostream& operator<< ( std::ostream &  os,
const MyClass vr 
)
friend

Output stream operator.

Definition at line 241 of file vec_reg.hh.

Member Data Documentation

◆ container

template<typename VecElem , size_t NumElems, bool Const>
Container& VecRegT< VecElem, NumElems, Const >::container
private

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

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