scc
2022.4.0
SystemC components library
|
Register that can contain bitfields. More...
#include <tlm_target_bfs_register_base.h>
Public Member Functions | |
constexpr | bitfield_register (sc_core::sc_module_name name, size_t offset, datatype_t resetValue=0, datatype_t writeMask=-1, datatype_t readMask=-1) |
constexpr size_t | size () const noexcept override |
void | reset () override |
reset the resource | |
bool | write (const uint8_t *data, std::size_t length, uint64_t offset, sc_core::sc_time &d) override |
bool | read (uint8_t *data, std::size_t length, uint64_t offset, sc_core::sc_time &d) const override |
bool | write_dbg (const uint8_t *data, std::size_t length, uint64_t offset=0) override |
debug write to the resource More... | |
bool | read_dbg (uint8_t *data, std::size_t length, uint64_t offset=0) const override |
debug read the data from the resource More... | |
constexpr datatype_t | get () const |
void | put (datatype_t value) |
void | registerBitfield (abstract_bitfield< datatype_t > &bitfield) |
constexpr | operator datatype_t () const |
bitfield_register< datatype_t > & | operator= (datatype_t other) |
void | setWriteCallback (std::function< void(bitfield_register< datatype_t > &, datatype_t &valueToWrite)> callback) |
void | setReadCallback (std::function< void(const bitfield_register< datatype_t > &, datatype_t &result)> callback) |
Public Member Functions inherited from scc::resource_access_if | |
bool | write (const uint8_t *data, std::size_t length, uint64_t offset=0) |
bool | read (uint8_t *data, std::size_t length, uint64_t offset=0) const |
Public Attributes | |
const size_t | offset |
Protected Attributes | |
const datatype_t | resetValue |
const datatype_t | writeMask |
const datatype_t | readMask |
datatype_t | storage |
std::function< void(bitfield_register< datatype_t > &, datatype_t &)> | writeCallback |
std::function< void(const bitfield_register< datatype_t > &, datatype_t &)> | readCallback |
std::vector< std::reference_wrapper< abstract_bitfield< datatype_t > > > | bitfields |
Register that can contain bitfields.
datatype_t | Datatype of the register value |
Definition at line 86 of file tlm_target_bfs_register_base.h.
|
inlineconstexpr |
name | The name of this register |
offset | Offset of the peripheral base address this register is mapped |
resetValue | This value gets written to the register on a reset condition |
writeMask | Only bits that are set get overwritten on a write access. Cleared bits are left unchanged. This field has priority over the individual bitfields or the write callback. |
readMask | Bits that are cleared in this field always read as 0. Can be overridden in bitfields or the read callback. |
Definition at line 99 of file tlm_target_bfs_register_base.h.
|
inlineconstexpr |
Definition at line 170 of file tlm_target_bfs_register_base.h.
|
inlineconstexpr |
Convenience function to access the stored data
Definition at line 181 of file tlm_target_bfs_register_base.h.
|
inline |
Convenience function to update the stored data
Definition at line 185 of file tlm_target_bfs_register_base.h.
|
inline |
Updates the stored data with value
Definition at line 174 of file tlm_target_bfs_register_base.h.
|
inlineoverridevirtual |
debug read the data from the resource
data | buffer to read the data into |
length | length of data to read |
offset | offset of the data to read |
Implements scc::resource_access_if.
Definition at line 158 of file tlm_target_bfs_register_base.h.
|
inline |
Register a callback
that gets called on read. Overwrites previously stored callbacks. Signature: void onRead(const bitfield_register<datatype_t>& reg, datatype_t& result)
Callback is called after the individual bitfields.
Definition at line 211 of file tlm_target_bfs_register_base.h.
|
inline |
Register a callback
that is called on write. Overwrites previously stored callbacks. Signature: void onWrite(bitfield_register<datatype_t>& reg, datatype_t& valueToWrite)
Callback is called after the individual bitfields.
If you want to change the value that gets written to the register change the value of the parameter valueToWrite. Direct writes to the register do not work.
Definition at line 201 of file tlm_target_bfs_register_base.h.
|
inlineconstexproverridevirtualnoexcept |
Implements scc::resource_access_if.
Definition at line 110 of file tlm_target_bfs_register_base.h.
|
inlineoverridevirtual |
debug write to the resource
data | to write |
length | of data to write |
offset | of the data to write |
Implements scc::resource_access_if.
Definition at line 150 of file tlm_target_bfs_register_base.h.