scc 2025.09
SystemC components library
scc::bitfield< datatype_t > Class Template Reference
Inheritance diagram for scc::bitfield< datatype_t >:
Collaboration diagram for scc::bitfield< datatype_t >:

Public Types

enum  Access { RW , ReadOnly }

Public Member Functions

 bitfield (bitfield_register< datatype_t > &reg, std::string name, size_t bitOffset, size_t bitSize, std::string urid, Access access=RW)
 bitfield (const bitfield &)=delete
bitfieldoperator= (const bitfield &)=delete
void write (datatype_t &valueToWrite) override
datatype_t read () override
constexpr datatype_t get () const
void put (datatype_t value)
constexpr operator datatype_t () const
bitfield< datatype_t > & operator= (datatype_t other)
void setWriteCallback (std::function< void(bitfield< datatype_t > &, datatype_t &valueToWrite)> callback)
void setReadCallback (std::function< datatype_t(const bitfield< datatype_t > &)> callback)
Public Member Functions inherited from scc::abstract_bitfield< datatype_t >
 abstract_bitfield (std::string name, size_t bitOffset, size_t bitSize, std::string urid)
constexpr bool affected (size_t byteOffset, size_t byteLength) const noexcept
constexpr datatype_t mask () const noexcept

Public Attributes

bitfield_register< datatype_t > & reg
Access access
Public Attributes inherited from scc::abstract_bitfield< datatype_t >
const size_t bitOffset
const size_t bitSize
const std::string name
const std::string urid

Protected Attributes

std::function< void(bitfield< datatype_t > &, datatype_t &)> writeCallback
std::function< datatype_t(const bitfield< datatype_t > &)> readCallback

Detailed Description

template<typename datatype_t>
class scc::bitfield< datatype_t >

Definition at line 228 of file tlm_target_bfs_register_base.h.

Member Enumeration Documentation

◆ Access

template<typename datatype_t>
enum scc::bitfield::Access

Definition at line 230 of file tlm_target_bfs_register_base.h.

Constructor & Destructor Documentation

◆ bitfield()

template<typename datatype_t>
scc::bitfield< datatype_t >::bitfield ( bitfield_register< datatype_t > & reg,
std::string name,
size_t bitOffset,
size_t bitSize,
std::string urid,
Access access = RW )
inline
Parameters
regThe register that contains this bitfield
nameThe name of this bitfield
bitOffsetthe position of this bitfield in the containing register
bitSizethe size of this bitfield
uridUnique resource id. Must be unique accross all bitfields in a peripheral
accessIf RO writes to this bitfield are ignored.

Definition at line 244 of file tlm_target_bfs_register_base.h.

Member Function Documentation

◆ get()

template<typename datatype_t>
datatype_t scc::bitfield< datatype_t >::get ( ) const
inlineconstexpr
Returns
the data stored in this bitfield

Definition at line 269 of file tlm_target_bfs_register_base.h.

◆ operator datatype_t()

template<typename datatype_t>
scc::bitfield< datatype_t >::operator datatype_t ( ) const
inlineconstexpr

Convenience function to access the stored data

Definition at line 278 of file tlm_target_bfs_register_base.h.

◆ operator=()

template<typename datatype_t>
bitfield< datatype_t > & scc::bitfield< datatype_t >::operator= ( datatype_t other)
inline

Convenience function to update the stored data

Definition at line 282 of file tlm_target_bfs_register_base.h.

◆ put()

template<typename datatype_t>
void scc::bitfield< datatype_t >::put ( datatype_t value)
inline

Updates the stored data with value

Definition at line 273 of file tlm_target_bfs_register_base.h.

◆ read()

template<typename datatype_t>
datatype_t scc::bitfield< datatype_t >::read ( )
inlineoverridevirtual

◆ setReadCallback()

template<typename datatype_t>
void scc::bitfield< datatype_t >::setReadCallback ( std::function< datatype_t(const bitfield< datatype_t > &)> callback)
inline

Register a callback that gets called on read. Overwrites previously stored callbacks. Signature: datatype_t onRead(const bitfield<datatype_t>& bf)

Callback is called before the register.

Definition at line 308 of file tlm_target_bfs_register_base.h.

◆ setWriteCallback()

template<typename datatype_t>
void scc::bitfield< datatype_t >::setWriteCallback ( std::function< void(bitfield< datatype_t > &, datatype_t &valueToWrite)> callback)
inline

Register a callback that is called on write. Overwrites previously stored callbacks. Signature: void onWrite(bitfield<datatype_t>& bf, datatype_t& valueToWrite)

Callback is called before the register.

If you want to change the value that gets written to the bitfield change the value of the parameter valueToWrite. Direct writes to the bitfield do not work.

Definition at line 298 of file tlm_target_bfs_register_base.h.

◆ write()

template<typename datatype_t>
void scc::bitfield< datatype_t >::write ( datatype_t & valueToWrite)
inlineoverridevirtual

Member Data Documentation

◆ access

template<typename datatype_t>
Access scc::bitfield< datatype_t >::access

Definition at line 311 of file tlm_target_bfs_register_base.h.

◆ readCallback

template<typename datatype_t>
std::function<datatype_t(const bitfield<datatype_t>&)> scc::bitfield< datatype_t >::readCallback
protected

Definition at line 315 of file tlm_target_bfs_register_base.h.

◆ reg

template<typename datatype_t>
bitfield_register<datatype_t>& scc::bitfield< datatype_t >::reg

Definition at line 310 of file tlm_target_bfs_register_base.h.

◆ writeCallback

template<typename datatype_t>
std::function<void(bitfield<datatype_t>&, datatype_t&)> scc::bitfield< datatype_t >::writeCallback
protected

Definition at line 314 of file tlm_target_bfs_register_base.h.


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