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

A very simple pipe, not part of the DES paradigm. More...

#include <Pipe.hpp>

Classes

class  PipeIterator
 

Public Types

typedef DataT value_type
 A typedef for this type of pipe.
 
typedef uint32_t size_type
 Typedef for size_type.
 
typedef PipeIterator< false > iterator
 Typedef for regular iterator.
 
typedef PipeIterator< true > const_iterator
 Typedef for constant iterator.
 

Public Member Functions

iterator begin ()
 STL-like begin operation,.
 
iterator end ()
 STL-like begin operation,.
 
const_iterator begin () const
 STL-like begin operation,.
 
const_iterator end () const
 STL-like begin operation,.
 
 Pipe (const Pipe< DataT > &)=delete
 No copies.
 
Pipeoperator= (const Pipe< DataT > &)=delete
 No copies.
 
 Pipe (const std::string &name, uint32_t num_entries, const Clock *clk)
 Construct a pipe, 0-size not supported.
 
void resize (uint32_t new_size)
 Resize the pipe immediately after construction.
 
void performOwnUpdates ()
 
size_type capacity () const
 What is the capacity of the pipe? I.e. Entry count.
 
size_type numValid () const
 
size_type size () const
 Resturns numValid – useful for STL iteration.
 
bool empty () const
 Return whether the pipe is empty.
 
void append (const DataT &data)
 Append data to the beginning of the Pipe.
 
void append (DataT &&data)
 Append data to the beginning of the Pipe.
 
bool isAppended () const
 Is the pipe already appended data?
 
void push_front (const DataT &data)
 Append data to the beginning of the Pipe.
 
void push_front (DataT &&data)
 Append data to the beginning of the Pipe.
 
void writePS (uint32_t stage, const DataT &data)
 Append data to the specified stage. Will clobber what's there.
 
void writePS (uint32_t stage, DataT &&data)
 Append data to the specified stage. Will clobber what's there.
 
void invalidatePS (uint32_t stage)
 
void clear ()
 Clear the pipe.
 
void invalidateLastPS ()
 
void flushPS (uint32_t stage)
 Flush the item at the given stage, even if not valid.
 
void flushAppend ()
 Flush the item that was appended.
 
void flushAll ()
 Flush everything, RIGHT NOW.
 
void flushIf (const DataT &criteria)
 Flush any item that matches the given criteria.
 
void flushIf (std::function< bool(const DataT &)> compare)
 Flush any item that matches the given function.
 
const std::string & getName () const
 Name of this resource.
 
bool isValid (uint32_t stage) const
 See if there is something at the given stage.
 
bool isAnyValid () const
 Are any entries valid, including ones appended THIS cycle.
 
bool isLastValid () const
 Is the last entry valid?
 
const DataT & read (uint32_t stage) const
 Read the entry at the given stage.
 
DataT & access (uint32_t stage)
 Read the entry at the given stage (non-const)
 
const DataT & readLast () const
 Read the last entry.
 
const DataT & readAppendedData () const
 
void update ()
 Update the pipe – shift data appended/invalidated.
 
bool shiftAppend ()
 
template<sparta::SchedulingPhase phase = SchedulingPhase::Collection>
void enableCollection (TreeNode *parent)
 Request that this queue begin collecting its contents for pipeline collection.
 
bool isCollected () const
 Check if pipe is collecting.
 

Detailed Description

template<typename DataT>
class sparta::Pipe< DataT >

A very simple pipe, not part of the DES paradigm.

This is a very simple pipe that supports pipeline collection, present-state/next-state behavior and an unsafe "look anywhere" in the pipe read.

The user is expected to maintain this Pipe and it's forward progress. After appends/deletes, the user is expected to perform an update on the Pipe at specified time determined only by the user. For collection and pipeline behaviors, update() should be called every time the pipe being collected has changed state. Assuming this happens, the collector will manage writing transactions to the database.

Definition at line 44 of file Pipe.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename DataT >
typedef PipeIterator<true> sparta::Pipe< DataT >::const_iterator

Typedef for constant iterator.

Definition at line 172 of file Pipe.hpp.

◆ iterator

template<typename DataT >
typedef PipeIterator<false> sparta::Pipe< DataT >::iterator

Typedef for regular iterator.

Definition at line 169 of file Pipe.hpp.

◆ size_type

template<typename DataT >
typedef uint32_t sparta::Pipe< DataT >::size_type

Typedef for size_type.

Definition at line 76 of file Pipe.hpp.

◆ value_type

template<typename DataT >
typedef DataT sparta::Pipe< DataT >::value_type

A typedef for this type of pipe.

Definition at line 73 of file Pipe.hpp.

Constructor & Destructor Documentation

◆ Pipe()

template<typename DataT >
sparta::Pipe< DataT >::Pipe ( const std::string &  name,
uint32_t  num_entries,
const Clock clk 
)
inline

Construct a pipe, 0-size not supported.

Parameters
nameThe name of the pipe
num_entriesThe number of entries this pipe can hold
clkThe clock this pipe belongs to

Definition at line 203 of file Pipe.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ access()

template<typename DataT >
DataT & sparta::Pipe< DataT >::access ( uint32_t  stage)
inline

Read the entry at the given stage (non-const)

Definition at line 457 of file Pipe.hpp.

◆ append() [1/2]

template<typename DataT >
void sparta::Pipe< DataT >::append ( const DataT &  data)
inline

Append data to the beginning of the Pipe.

Definition at line 260 of file Pipe.hpp.

◆ append() [2/2]

template<typename DataT >
void sparta::Pipe< DataT >::append ( DataT &&  data)
inline

Append data to the beginning of the Pipe.

Definition at line 266 of file Pipe.hpp.

◆ begin() [1/2]

template<typename DataT >
iterator sparta::Pipe< DataT >::begin ( )
inline

STL-like begin operation,.

Returns
iterator to the oldest element in Pipe

Definition at line 176 of file Pipe.hpp.

◆ begin() [2/2]

template<typename DataT >
const_iterator sparta::Pipe< DataT >::begin ( ) const
inline

STL-like begin operation,.

Returns
const_iterator to the oldest element in Pipe

Definition at line 184 of file Pipe.hpp.

◆ capacity()

template<typename DataT >
size_type sparta::Pipe< DataT >::capacity ( ) const
inline

What is the capacity of the pipe? I.e. Entry count.

Definition at line 239 of file Pipe.hpp.

◆ clear()

template<typename DataT >
void sparta::Pipe< DataT >::clear ( )
inline

Clear the pipe.

Definition at line 336 of file Pipe.hpp.

◆ empty()

template<typename DataT >
bool sparta::Pipe< DataT >::empty ( ) const
inline

Return whether the pipe is empty.

Definition at line 255 of file Pipe.hpp.

Here is the call graph for this function:

◆ enableCollection()

template<typename DataT >
template<sparta::SchedulingPhase phase = SchedulingPhase::Collection>
void sparta::Pipe< DataT >::enableCollection ( TreeNode parent)
inline

Request that this queue begin collecting its contents for pipeline collection.

Parameters
parentA pointer to the parent treenode for which to add Collectable objects under.
Note
This only sets the Queue up for collection. collection must be started with an instatiation of the PipelineCollector

Definition at line 515 of file Pipe.hpp.

Here is the call graph for this function:

◆ end() [1/2]

template<typename DataT >
iterator sparta::Pipe< DataT >::end ( )
inline

STL-like begin operation,.

Returns
iterator to the latest element in Pipe

Definition at line 180 of file Pipe.hpp.

◆ end() [2/2]

template<typename DataT >
const_iterator sparta::Pipe< DataT >::end ( ) const
inline

STL-like begin operation,.

Returns
const_iterator to the latest element in Pipe

Definition at line 188 of file Pipe.hpp.

◆ flushAll()

template<typename DataT >
void sparta::Pipe< DataT >::flushAll ( )
inline

Flush everything, RIGHT NOW.

Definition at line 366 of file Pipe.hpp.

◆ flushAppend()

template<typename DataT >
void sparta::Pipe< DataT >::flushAppend ( )
inline

Flush the item that was appended.

Definition at line 359 of file Pipe.hpp.

◆ flushIf() [1/2]

template<typename DataT >
void sparta::Pipe< DataT >::flushIf ( const DataT &  criteria)
inline

Flush any item that matches the given criteria.

Parameters
criteriaThe criteria to compare; must respond to operator==

This function does a raw '==' comparison between the criteria and the stashed items in the pipe. If matched, the item is flushed, even if not valid.

Definition at line 383 of file Pipe.hpp.

◆ flushIf() [2/2]

template<typename DataT >
void sparta::Pipe< DataT >::flushIf ( std::function< bool(const DataT &)>  compare)
inline

Flush any item that matches the given function.

Parameters
compareThe function comparator to use

This function allows a user to define his/her own comparison operation outside of a direct operator== comparison. See sparta::PhasedPayloadEvent::cancelIf for an example.

Definition at line 406 of file Pipe.hpp.

◆ flushPS()

template<typename DataT >
void sparta::Pipe< DataT >::flushPS ( uint32_t  stage)
inline

Flush the item at the given stage, even if not valid.

Definition at line 348 of file Pipe.hpp.

◆ getName()

template<typename DataT >
const std::string & sparta::Pipe< DataT >::getName ( ) const
inline

Name of this resource.

Definition at line 423 of file Pipe.hpp.

◆ invalidateLastPS()

template<typename DataT >
void sparta::Pipe< DataT >::invalidateLastPS ( )
inline

Invalidate the data at the given stage RIGHT NOW. Will throw if there is no data at the given stage

Definition at line 343 of file Pipe.hpp.

Here is the call graph for this function:

◆ invalidatePS()

template<typename DataT >
void sparta::Pipe< DataT >::invalidatePS ( uint32_t  stage)
inline

Invalidate the data at the given stage RIGHT NOW. Will throw if there is no data at the given stage

Definition at line 318 of file Pipe.hpp.

Here is the call graph for this function:

◆ isAnyValid()

template<typename DataT >
bool sparta::Pipe< DataT >::isAnyValid ( ) const
inline

Are any entries valid, including ones appended THIS cycle.

Definition at line 435 of file Pipe.hpp.

Here is the call graph for this function:

◆ isAppended()

template<typename DataT >
bool sparta::Pipe< DataT >::isAppended ( ) const
inline

Is the pipe already appended data?

Definition at line 272 of file Pipe.hpp.

◆ isCollected()

template<typename DataT >
bool sparta::Pipe< DataT >::isCollected ( ) const
inline

Check if pipe is collecting.

Definition at line 523 of file Pipe.hpp.

◆ isLastValid()

template<typename DataT >
bool sparta::Pipe< DataT >::isLastValid ( ) const
inline

Is the last entry valid?

Definition at line 441 of file Pipe.hpp.

◆ isValid()

template<typename DataT >
bool sparta::Pipe< DataT >::isValid ( uint32_t  stage) const
inline

See if there is something at the given stage.

Definition at line 428 of file Pipe.hpp.

◆ numValid()

template<typename DataT >
size_type sparta::Pipe< DataT >::numValid ( ) const
inline

How many entries are valid? This number may change between update() calls

Definition at line 245 of file Pipe.hpp.

◆ performOwnUpdates()

template<typename DataT >
void sparta::Pipe< DataT >::performOwnUpdates ( )
inline

Tell the pipe to do its own updates. Should be called once at the beginning of simulation.

Definition at line 231 of file Pipe.hpp.

Here is the call graph for this function:

◆ push_front() [1/2]

template<typename DataT >
void sparta::Pipe< DataT >::push_front ( const DataT &  data)
inline

Append data to the beginning of the Pipe.

Definition at line 279 of file Pipe.hpp.

Here is the call graph for this function:

◆ push_front() [2/2]

template<typename DataT >
void sparta::Pipe< DataT >::push_front ( DataT &&  data)
inline

Append data to the beginning of the Pipe.

Definition at line 285 of file Pipe.hpp.

Here is the call graph for this function:

◆ read()

template<typename DataT >
const DataT & sparta::Pipe< DataT >::read ( uint32_t  stage) const
inline

Read the entry at the given stage.

Definition at line 448 of file Pipe.hpp.

◆ readAppendedData()

template<typename DataT >
const DataT & sparta::Pipe< DataT >::readAppendedData ( ) const
inline

Read the data just appended; it will assert if no data appended

Definition at line 473 of file Pipe.hpp.

◆ readLast()

template<typename DataT >
const DataT & sparta::Pipe< DataT >::readLast ( ) const
inline

Read the last entry.

Definition at line 466 of file Pipe.hpp.

Here is the call graph for this function:

◆ resize()

template<typename DataT >
void sparta::Pipe< DataT >::resize ( uint32_t  new_size)
inline

Resize the pipe immediately after construction.

Parameters
new_sizeNew size for the pipe. Must be greater than zero
Note
You cannot call this function after simulation finialization nor after enabling pipeline collection.

Definition at line 223 of file Pipe.hpp.

◆ shiftAppend()

template<typename DataT >
bool sparta::Pipe< DataT >::shiftAppend ( )
inline

Move data from append stage (must be valid) into stage 0 (must be empty)

Returns
true if data moved

Definition at line 490 of file Pipe.hpp.

Here is the call graph for this function:

◆ size()

template<typename DataT >
size_type sparta::Pipe< DataT >::size ( ) const
inline

Resturns numValid – useful for STL iteration.

Definition at line 250 of file Pipe.hpp.

Here is the call graph for this function:

◆ update()

template<typename DataT >
void sparta::Pipe< DataT >::update ( )
inline

Update the pipe – shift data appended/invalidated.

Definition at line 482 of file Pipe.hpp.

◆ writePS() [1/2]

template<typename DataT >
void sparta::Pipe< DataT >::writePS ( uint32_t  stage,
const DataT &  data 
)
inline

Append data to the specified stage. Will clobber what's there.

Parameters
stageThe stage to write data to immediately
dataThe data to write

Definition at line 298 of file Pipe.hpp.

◆ writePS() [2/2]

template<typename DataT >
void sparta::Pipe< DataT >::writePS ( uint32_t  stage,
DataT &&  data 
)
inline

Append data to the specified stage. Will clobber what's there.

Parameters
stageThe stage to write data to immediately
dataThe data to write

Definition at line 311 of file Pipe.hpp.


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