The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::FrontArray< DataT, ArrayT > Class Template Reference

a type of Array with special allocation policies to support writing to the front most valid entry in the Array, as well as reading the nth valid entry in the array. More...

#include <FrontArray.hpp>

Inheritance diagram for sparta::FrontArray< DataT, ArrayT >:
Collaboration diagram for sparta::FrontArray< DataT, ArrayT >:

Public Member Functions

 FrontArray (const std::string &name, uint32_t num_entries, const Clock *clk, StatisticSet *statset=nullptr)
 Construct the array.
 
const DataT & readValid (const uint32_t nth=0) const
 read the nth valid object from the front of the array.
 
uint32_t writeFront (const DataT &dat)
 a public method that can be used to write data to the first invalidate entry in the array. '
 
uint32_t writeFront (DataT &&dat)
 a public method that can be used to write data to the first invalidate entry in the array. '
 
uint32_t writeBack (const DataT &dat)
 a public method that can be used to write data to the last invalidate entry in the array. '
 
uint32_t writeBack (DataT &&dat)
 a public method that can be used to write data to the last invalidate entry in the array. '
 
uint32_t push_front (const DataT &dat)
 Push the first available index in the Array.
 
uint32_t push_front (DataT &&dat)
 Push the first available index in the Array.
 
uint32_t push_back (const DataT &dat)
 Push the first available index in the Array starting from the back.
 
uint32_t push_back (DataT &&dat)
 Push the first available index in the Array starting from the back.
 
- Public Member Functions inherited from sparta::Array< DataT, ArrayT >
iterator getCircularIterator (uint32_t idx=0)
 Get an iterator that is circular on the Array (has no end())
 
iterator getUnitializedIterator ()
 Provide a method to get an uninitialized iterator.
 
iterator begin ()
 STL-like begin operation, starts at index 0 (ignores valid bit).
 
const_iterator begin () const
 STL-like begin operation, const, starts at index 0 (ignores valid bit).
 
iterator end ()
 STL-like end operation.
 
const_iterator end () const
 STL-like end operation, const.
 
iterator abegin ()
 STL-like begin operation, starts at the oldest valid index.
 
const_iterator abegin () const
 STL-like begin operation, const, starts at the oldest valid index.
 
iterator aend ()
 STL-like end operation.
 
const_iterator aend () const
 STL-like end operation, const.
 
 Array (const std::string &name, uint32_t num_entries, const Clock *clk, StatisticSet *statset=nullptr, InstrumentationNode::visibility_t stat_vis_general=InstrumentationNode::AUTO_VISIBILITY, InstrumentationNode::visibility_t stat_vis_detailed=InstrumentationNode::VIS_HIDDEN, InstrumentationNode::visibility_t stat_vis_max=InstrumentationNode::AUTO_VISIBILITY, InstrumentationNode::visibility_t stat_vis_avg=InstrumentationNode::AUTO_VISIBILITY)
 Construct an array.
 
virtual ~Array ()
 Virtual destructor.
 
const std::string & getName () const
 Name of this resource.
 
bool isValid (const uint32_t idx) const
 Determine whether an index is currently valid.
 
const DataT & read (const uint32_t idx) const
 Read (only) the data at an index.
 
DataT & access (const uint32_t idx)
 Access (writeable) the data at a position.
 
const_iterator getOldestIndex (const uint32_t nth=0) const
 Return the oldest index in the array.
 
const_iterator getYoungestIndex (const uint32_t nth=0) const
 provide access the youngest index in the array.
 
bool getNextOldestIndex (uint32_t &prev_idx) const
 Sets the input argument to the index containing the location of the next oldest item after input argument. If the input argument is the youngest index, we return false.
 
uint32_t getAge (const uint32_t idx) const
 Provide the age information of the given entry index.
 
const AgedListgetAgedList () const
 Provide access to our aged_list_ internals.
 
size_type capacity () const
 Return the maximum number of elements this Array can hold.
 
size_type numValid () const
 The number of valid entries contained.
 
size_type size () const
 
size_type numFree () const
 The number of free entries.
 
void erase (const iterator &iter)
 Invalidate data at an iterator position.
 
void erase (const uint32_t &idx)
 Invalidate the entry at a certain index.
 
void clear ()
 Clear the array of all data.
 
void write (const uint32_t idx, const DataT &dat)
 Write data to the array.
 
void write (const uint32_t idx, DataT &&dat)
 Write data to the array.
 
void write (const iterator &iter, const DataT &dat)
 Write data at an iterator position.
 
void write (const iterator &iter, DataT &&dat)
 Write data at an iterator position.
 
bool isYounger (uint32_t lhs, uint32_t rhs)
 Determine if an index was written (using write()) to the Array after another index.
 
bool isOlder (uint32_t lhs, uint32_t rhs)
 Determine if an index was written (using write()) to the Array before another index.
 
void enableCollection (TreeNode *parent)
 Set up a auto-collector for this Array.
 

Additional Inherited Members

- Public Types inherited from sparta::Array< DataT, ArrayT >
typedef DataT value_type
 The data type, STL style.
 
typedef DataT DataType
 Expected typedef for the data that will be stored in this structure.
 
typedef uint32_t size_type
 Typedef for size_type.
 
typedef std::list< uint32_t > AgedList
 Typedef for a list of indexes in age order.
 
typedef ArrayIterator< false > iterator
 Typedef for regular iterator.
 
typedef ArrayIterator< true > const_iterator
 Typedef for constant iterator.
 

Detailed Description

template<class DataT, ArrayType ArrayT = ArrayType::AGED>
class sparta::FrontArray< DataT, ArrayT >

a type of Array with special allocation policies to support writing to the front most valid entry in the Array, as well as reading the nth valid entry in the array.

Template Parameters
DataTthe data type to store in the array.
ArrayTthe type of array, Aged vs Normal (default Aged)
CollectionTthe type of pipeline collection to run on the Array.

Definition at line 29 of file FrontArray.hpp.

Constructor & Destructor Documentation

◆ FrontArray()

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
sparta::FrontArray< DataT, ArrayT >::FrontArray ( const std::string &  name,
uint32_t  num_entries,
const Clock clk,
StatisticSet statset = nullptr 
)
inline

Construct the array.

Parameters
psthe port set to use during construction.
namethe name of the array.
num_entriesthe size of the array.
clka pointer to a clock used by the Array.

Definition at line 42 of file FrontArray.hpp.

Member Function Documentation

◆ push_back() [1/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
uint32_t sparta::FrontArray< DataT, ArrayT >::push_back ( const DataT &  dat)
inline

Push the first available index in the Array starting from the back.

Parameters
datThe data to push
Returns
The index it was inserted

Definition at line 142 of file FrontArray.hpp.

Here is the call graph for this function:

◆ push_back() [2/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
uint32_t sparta::FrontArray< DataT, ArrayT >::push_back ( DataT &&  dat)
inline

Push the first available index in the Array starting from the back.

Parameters
datThe data to push
Returns
The index it was inserted

Definition at line 149 of file FrontArray.hpp.

Here is the call graph for this function:

◆ push_front() [1/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
uint32_t sparta::FrontArray< DataT, ArrayT >::push_front ( const DataT &  dat)
inline

Push the first available index in the Array.

Parameters
datThe data to push
Returns
The index it was inserted

Definition at line 128 of file FrontArray.hpp.

Here is the call graph for this function:

◆ push_front() [2/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
uint32_t sparta::FrontArray< DataT, ArrayT >::push_front ( DataT &&  dat)
inline

Push the first available index in the Array.

Parameters
datThe data to push
Returns
The index it was inserted

Definition at line 135 of file FrontArray.hpp.

Here is the call graph for this function:

◆ readValid()

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
const DataT & sparta::FrontArray< DataT, ArrayT >::readValid ( const uint32_t  nth = 0) const
inline

read the nth valid object from the front of the array.

Definition at line 49 of file FrontArray.hpp.

Here is the call graph for this function:

◆ writeBack() [1/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
uint32_t sparta::FrontArray< DataT, ArrayT >::writeBack ( const DataT &  dat)
inline

a public method that can be used to write data to the last invalidate entry in the array. '

Parameters
datthe data to be written to the front of the array.
Note
this method is only accessable on AllocationP == FrontAccessable type Arrays.

Definition at line 103 of file FrontArray.hpp.

◆ writeBack() [2/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
uint32_t sparta::FrontArray< DataT, ArrayT >::writeBack ( DataT &&  dat)
inline

a public method that can be used to write data to the last invalidate entry in the array. '

Parameters
datthe data to be written to the front of the array.
Note
this method is only accessable on AllocationP == FrontAccessable type Arrays.

Definition at line 115 of file FrontArray.hpp.

◆ writeFront() [1/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
uint32_t sparta::FrontArray< DataT, ArrayT >::writeFront ( const DataT &  dat)
inline

a public method that can be used to write data to the first invalidate entry in the array. '

Parameters
datthe data to be written to the front of the array.
Note
this method is only accessable on AllocationP == FrontAccessable type Arrays.

Definition at line 79 of file FrontArray.hpp.

◆ writeFront() [2/2]

template<class DataT , ArrayType ArrayT = ArrayType::AGED>
uint32_t sparta::FrontArray< DataT, ArrayT >::writeFront ( DataT &&  dat)
inline

a public method that can be used to write data to the first invalidate entry in the array. '

Parameters
datthe data to be written to the front of the array.
Note
this method is only accessable on AllocationP == FrontAccessable type Arrays.

Definition at line 91 of file FrontArray.hpp.


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