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

Used by DataInPort and SyncInPort, this class holds received data from these ports and remembers the time in which the data was set. It also maintains the validity of the data. More...

#include <DataContainer.hpp>

Inheritance diagram for sparta::DataContainer< DataT >:

Public Member Functions

 DataContainer (const sparta::Clock *clk)
 Construct the DataContainer with the clock used for timestamping.
 
bool dataReceived () const
 Has this port received data (not timed)
 
bool dataReceivedThisCycle () const
 Has this port received data this cycle.
 
DataT pullData ()
 Return the last data received by the port, then clear it.
 
const DataT & peekData () const
 Peek at the data in the port, but don't invalidate it.
 
void clearData ()
 Clear the validity of the data at the port.
 
Clock::Cycle getReceivedTimeStamp () const
 Returns the clock cycle data was received.
 

Protected Member Functions

void setData_ (const DataT &dat)
 Set the data received.
 

Detailed Description

template<class DataT>
class sparta::DataContainer< DataT >

Used by DataInPort and SyncInPort, this class holds received data from these ports and remembers the time in which the data was set. It also maintains the validity of the data.

Definition at line 25 of file DataContainer.hpp.

Constructor & Destructor Documentation

◆ DataContainer()

template<class DataT >
sparta::DataContainer< DataT >::DataContainer ( const sparta::Clock clk)
inline

Construct the DataContainer with the clock used for timestamping.

Parameters
clkClock used to get a timestamp. Must not be nullptr

Definition at line 34 of file DataContainer.hpp.

Member Function Documentation

◆ clearData()

template<class DataT >
void sparta::DataContainer< DataT >::clearData ( )
inline

Clear the validity of the data at the port.

Definition at line 90 of file DataContainer.hpp.

Here is the call graph for this function:

◆ dataReceived()

template<class DataT >
bool sparta::DataContainer< DataT >::dataReceived ( ) const
inline

Has this port received data (not timed)

Returns
true if data is live on this port

This function only returns true is data were ever received on this port. It does not indicate that data was delivered on this cycle. For that, use dataReceivedThisCycle function.

Definition at line 48 of file DataContainer.hpp.

Here is the call graph for this function:

◆ dataReceivedThisCycle()

template<class DataT >
bool sparta::DataContainer< DataT >::dataReceivedThisCycle ( ) const
inline

Has this port received data this cycle.

Returns
true if data is live on this port and was received this cycle

This function returns true is data received were on this port this cycle.

Definition at line 59 of file DataContainer.hpp.

Here is the call graph for this function:

◆ getReceivedTimeStamp()

template<class DataT >
Clock::Cycle sparta::DataContainer< DataT >::getReceivedTimeStamp ( ) const
inline

Returns the clock cycle data was received.

Returns
The clock cycle (receiver's clock) data was received
Note
This function will assert if the data is not valid

Definition at line 99 of file DataContainer.hpp.

Here is the call graph for this function:

◆ peekData()

template<class DataT >
const DataT & sparta::DataContainer< DataT >::peekData ( ) const
inline

Peek at the data in the port, but don't invalidate it.

Returns
Reference to the data in the port
Note
This function will assert if there is no data received

Definition at line 84 of file DataContainer.hpp.

Here is the call graph for this function:

◆ pullData()

template<class DataT >
DataT sparta::DataContainer< DataT >::pullData ( )
inline

Return the last data received by the port, then clear it.

Returns
The last data the port received
Note
This function will assert if there is no data received.

Pull the data from the port. This is a destructive mechanism, meaning the port is cleared

Definition at line 72 of file DataContainer.hpp.

Here is the call graph for this function:

◆ setData_()

template<class DataT >
void sparta::DataContainer< DataT >::setData_ ( const DataT &  dat)
inlineprotected

Set the data received.

Definition at line 107 of file DataContainer.hpp.

Here is the call graph for this function:

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