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

Class that allows the writing of data this cycle, but not visable until next cycle. More...

#include <SharedData.hpp>

Public Member Functions

template<typename U = DataT>
 SharedData (const std::string &name, const Clock *clk, U &&init_val=U())
 Construct a SharedData item.
 
 SharedData (const SharedData &rhs)
 
 SharedData (SharedData &&rhs)
 
SharedDataoperator= (const SharedData &rhs)
 
SharedDataoperator= (SharedData &&rhs)
 
const std::string & getName () const
 Get the name of this SharedData.
 
void writePS (const DataT &dat)
 Write data to the current view.
 
void writePS (DataT &&dat)
 Write data to the current view.
 
bool isValid () const
 Is there data in the current view.
 
const DataT & read () const
 Get a constant reference to the data visible this cycle.
 
DataT & access ()
 Get a non-constant reference to the data visible this cycle.
 
void write (const DataT &dat)
 Write data for the next cycle view.
 
void write (DataT &&dat)
 Write data for the next cycle view.
 
bool isValidNS () const
 Is there data for the next cycle?
 
const DataT & readNS () const
 Get a constant reference to the data that will be visible next cycle.
 
DataT & accessNS ()
 Get a non-constant reference to the data that will be visible next cycle.
 
void clear ()
 Clear both Present State and Next State valids.
 
void clearNS ()
 Clear Next State valid.
 
void clearPS ()
 Clear Present State valid.
 
void update ()
 Update the SharedData class – move next cycle data to current view. Can only be called on a manually updated SharedData class.
 

Detailed Description

template<class DataT, bool manual_update = false>
class sparta::SharedData< DataT, manual_update >

Class that allows the writing of data this cycle, but not visable until next cycle.

Template Parameters
DataTThe data to share
manual_updateIs this SharedData object manually updated? Default is false

This class supports two views of data: current view and the next cycle view. This class represents a latch concept.

For auto-updates, the SharedData item will propogate the next state value to the present state between clock cycles. This will occur only once per write(), and the present state value will be clobbered.

Definition at line 37 of file SharedData.hpp.

Constructor & Destructor Documentation

◆ SharedData() [1/3]

template<class DataT , bool manual_update = false>
template<typename U = DataT>
sparta::SharedData< DataT, manual_update >::SharedData ( const std::string & name,
const Clock * clk,
U && init_val = U() )
inline

Construct a SharedData item.

Parameters
nameThe name of this SharedData object
clkThe clock it uses to advance the internal data
init_valThe initial value of SharedData item

Definition at line 65 of file SharedData.hpp.

Here is the call graph for this function:

◆ SharedData() [2/3]

template<class DataT , bool manual_update = false>
sparta::SharedData< DataT, manual_update >::SharedData ( const SharedData< DataT, manual_update > & rhs)
inline

Definition at line 74 of file SharedData.hpp.

◆ SharedData() [3/3]

template<class DataT , bool manual_update = false>
sparta::SharedData< DataT, manual_update >::SharedData ( SharedData< DataT, manual_update > && rhs)
inline

Definition at line 83 of file SharedData.hpp.

Member Function Documentation

◆ access()

template<class DataT , bool manual_update = false>
DataT & sparta::SharedData< DataT, manual_update >::access ( )
inline

Get a non-constant reference to the data visible this cycle.

Returns
Read data in the current view. Must be valid
Exceptions
SpartaExceptionif data is not valid

Definition at line 163 of file SharedData.hpp.

Here is the call graph for this function:

◆ accessNS()

template<class DataT , bool manual_update = false>
DataT & sparta::SharedData< DataT, manual_update >::accessNS ( )
inline

Get a non-constant reference to the data that will be visible next cycle.

Returns
Data coming up in the next cycle
Exceptions
SpartaExceptionif data is not valid

Definition at line 209 of file SharedData.hpp.

Here is the call graph for this function:

◆ clear()

template<class DataT , bool manual_update = false>
void sparta::SharedData< DataT, manual_update >::clear ( )
inline

Clear both Present State and Next State valids.

Definition at line 215 of file SharedData.hpp.

◆ clearNS()

template<class DataT , bool manual_update = false>
void sparta::SharedData< DataT, manual_update >::clearNS ( )
inline

Clear Next State valid.

Definition at line 221 of file SharedData.hpp.

◆ clearPS()

template<class DataT , bool manual_update = false>
void sparta::SharedData< DataT, manual_update >::clearPS ( )
inline

Clear Present State valid.

Definition at line 226 of file SharedData.hpp.

◆ getName()

template<class DataT , bool manual_update = false>
const std::string & sparta::SharedData< DataT, manual_update >::getName ( ) const
inline

Get the name of this SharedData.

Returns
The SharedData name

Definition at line 120 of file SharedData.hpp.

◆ isValid()

template<class DataT , bool manual_update = false>
bool sparta::SharedData< DataT, manual_update >::isValid ( ) const
inline

Is there data in the current view.

Returns
true if data is valid this cycle

Definition at line 144 of file SharedData.hpp.

◆ isValidNS()

template<class DataT , bool manual_update = false>
bool sparta::SharedData< DataT, manual_update >::isValidNS ( ) const
inline

Is there data for the next cycle?

Returns
true if data is coming up

Definition at line 188 of file SharedData.hpp.

◆ operator=() [1/2]

template<class DataT , bool manual_update = false>
SharedData & sparta::SharedData< DataT, manual_update >::operator= ( const SharedData< DataT, manual_update > & rhs)
inline

Definition at line 92 of file SharedData.hpp.

◆ operator=() [2/2]

template<class DataT , bool manual_update = false>
SharedData & sparta::SharedData< DataT, manual_update >::operator= ( SharedData< DataT, manual_update > && rhs)
inline

Definition at line 104 of file SharedData.hpp.

◆ read()

template<class DataT , bool manual_update = false>
const DataT & sparta::SharedData< DataT, manual_update >::read ( ) const
inline

Get a constant reference to the data visible this cycle.

Returns
Read data in the current view. Must be valid
Exceptions
SpartaExceptionif data is not valid

Definition at line 153 of file SharedData.hpp.

Here is the call graph for this function:

◆ readNS()

template<class DataT , bool manual_update = false>
const DataT & sparta::SharedData< DataT, manual_update >::readNS ( ) const
inline

Get a constant reference to the data that will be visible next cycle.

Returns
Data coming up in the next cycle
Exceptions
SpartaExceptionif data is not valid

Definition at line 198 of file SharedData.hpp.

Here is the call graph for this function:

◆ update()

template<class DataT , bool manual_update = false>
void sparta::SharedData< DataT, manual_update >::update ( )
inline

Update the SharedData class – move next cycle data to current view. Can only be called on a manually updated SharedData class.

Definition at line 233 of file SharedData.hpp.

◆ write() [1/2]

template<class DataT , bool manual_update = false>
void sparta::SharedData< DataT, manual_update >::write ( const DataT & dat)
inline

Write data for the next cycle view.

Parameters
datThe data to write for visibility next cycle

Definition at line 172 of file SharedData.hpp.

◆ write() [2/2]

template<class DataT , bool manual_update = false>
void sparta::SharedData< DataT, manual_update >::write ( DataT && dat)
inline

Write data for the next cycle view.

Parameters
datThe data to write for visibility next cycle

Definition at line 180 of file SharedData.hpp.

◆ writePS() [1/2]

template<class DataT , bool manual_update = false>
void sparta::SharedData< DataT, manual_update >::writePS ( const DataT & dat)
inline

Write data to the current view.

Parameters
datThe data to write for visibility this cycle

Definition at line 128 of file SharedData.hpp.

◆ writePS() [2/2]

template<class DataT , bool manual_update = false>
void sparta::SharedData< DataT, manual_update >::writePS ( DataT && dat)
inline

Write data to the current view.

Parameters
datThe data to write for visibility this cycle

Definition at line 136 of file SharedData.hpp.


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