scc
2022.4.0
SystemC components library
|
a simple register implementation More...
#include <register.h>
Public Types | |
using | this_type = sc_register< DATATYPE > |
Public Member Functions | |
sc_register (sc_core::sc_module_name nm, DATATYPE &storage, const DATATYPE reset_val, resetable &owner, DATATYPE rdmask=get_max_uval< DATATYPE >(), DATATYPE wrmask=get_max_uval< DATATYPE >()) | |
the constructor More... | |
~sc_register ()=default | |
desctructor | |
size_t | size () const override |
get the size of this register in bytes More... | |
void | reset () override |
reset the register | |
bool | write (const uint8_t *data, size_t length, uint64_t offset, sc_core::sc_time &d) override |
write function from resource_access_if More... | |
bool | read (uint8_t *data, size_t length, uint64_t offset, sc_core::sc_time &d) const override |
read function from resource_access_if More... | |
bool | write_dbg (const uint8_t *data, size_t length, uint64_t offset=0) override |
debug write function from resource_access_if More... | |
bool | read_dbg (uint8_t *data, size_t length, uint64_t offset=0) const override |
debug read function from resource_access_if More... | |
operator DATATYPE () const | |
cast operator to get underlying storage | |
DATATYPE | get () const |
get the underlying storage More... | |
void | put (DATATYPE data) const |
write to the underlying storage More... | |
this_type & | operator= (DATATYPE other) |
assignment operator More... | |
this_type & | operator|= (DATATYPE other) |
unary or More... | |
this_type & | operator&= (DATATYPE other) |
unary and More... | |
void | set_read_cb (std::function< bool(const this_type &, DATATYPE &)> read_cb) |
set the read callback More... | |
void | set_read_cb (std::function< bool(const this_type &, DATATYPE &, sc_core::sc_time &)> read_cb) |
void | set_write_cb (std::function< bool(this_type &, const DATATYPE &)> write_cb) |
set the write callback More... | |
void | set_write_cb (std::function< bool(this_type &, const DATATYPE &, sc_core::sc_time &)> write_cb) |
void | trace (sc_core::sc_trace_file *trf) const override |
trace the register value to the given trace file More... | |
Public Member Functions inherited from scc::resource_access_if | |
virtual bool | write (const uint8_t *data, std::size_t length, uint64_t offset, sc_core::sc_time &d)=0 |
bool | write (const uint8_t *data, std::size_t length, uint64_t offset=0) |
virtual bool | read (uint8_t *data, std::size_t length, uint64_t offset, sc_core::sc_time &d) const =0 |
bool | read (uint8_t *data, std::size_t length, uint64_t offset=0) const |
virtual bool | write_dbg (const uint8_t *data, std::size_t length, uint64_t offset=0)=0 |
debug write to the resource More... | |
virtual bool | read_dbg (uint8_t *data, std::size_t length, uint64_t offset=0) const =0 |
debug read the data from the resource More... | |
Public Member Functions inherited from scc::traceable | |
virtual bool | is_trace_enabled () const |
returns of this component shall be traced More... | |
Public Attributes | |
const DATATYPE | res_val |
the reset value | |
const DATATYPE | rdmask |
the SW read mask | |
const DATATYPE | wrmask |
the SW write mask | |
a simple register implementation
A simple register implementation taking a certain data type. The sc_register does not hold the value itself, the data storage needs to be provided. It only provides some resource access interface and handled callbacks for read and write accesses
DATATYPE |
Definition at line 73 of file register.h.
|
inline |
the constructor
nm | the instance name |
storage | the storage data structure |
reset_val | the reset value |
owner | the owning object which needs to implement the resettable interface |
rdmask | the SW read mask |
wrmask | the SW write mask |
Definition at line 88 of file register.h.
|
inline |
|
inline |
unary and
other | the other value |
Definition at line 252 of file register.h.
|
inline |
assignment operator
other | the new value |
Definition at line 230 of file register.h.
|
inline |
unary or
other | the other value |
Definition at line 241 of file register.h.
|
inline |
write to the underlying storage
data | the new value |
Definition at line 222 of file register.h.
|
inlineoverride |
read function from resource_access_if
data | to be read |
length | of data to be written in bytes |
offset | of the write to the baseaddress of the register |
d | offset of the time in a time domain wrt. the SystemC simulator time (e.g. when using loosly-timed modeling) |
Definition at line 155 of file register.h.
|
inlineoverride |
debug read function from resource_access_if
This access should not cause any side effect!
data | to be read |
length | of data to be written in bytes |
offset | of the write to the baseaddress of the register |
Definition at line 196 of file register.h.
|
inline |
set the read callback
The read callback is triggered upon a read request without forwarding the annotated time this is primary for backward compatibility
read_cb | the callback functor |
Definition at line 265 of file register.h.
|
inline |
set the write callback
The write callback functor is triggered upon a write request without forwarding the annotated time this is primary for backward compatibility
write_cb | the callback functor |
Definition at line 286 of file register.h.
|
inline |
set the write callback triggered upon a write request
write_cb |
Definition at line 302 of file register.h.
|
inlineoverridevirtual |
get the size of this register in bytes
Implements scc::resource_access_if.
Definition at line 109 of file register.h.
|
inlineoverride |
trace the register value to the given trace file
trf | the trace file |
Definition at line 309 of file register.h.
|
inlineoverride |
write function from resource_access_if
data | to be written |
length | of data to be written in bytes |
offset | of the write to the baseaddress of the register |
d | offset of the time in a time domain wrt. the SystemC simulator time (e.g. when using loosly-timed modeling) |
Definition at line 134 of file register.h.
|
inlineoverride |
debug write function from resource_access_if
This access should not cause any side effect!
data | to be written |
length | of data to be written in bytes |
offset | of the write to the baseaddress of the register |
Definition at line 178 of file register.h.