scc 2025.09
SystemC components library
scc::impl::sc_register< DATATYPE > Class Template Reference

a simple register implementation More...

#include <register.h>

Inheritance diagram for scc::impl::sc_register< DATATYPE >:
Collaboration diagram for scc::impl::sc_register< DATATYPE >:

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
 ~sc_register ()=default
 desctructor
bool is_trace_enabled () const override
 returns of this component shall be traced
size_t size () const override
 get the size of this register in bytes
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
bool read (uint8_t *data, size_t length, uint64_t offset, sc_core::sc_time &d) const override
 read function from resource_access_if
bool write_dbg (const uint8_t *data, size_t length, uint64_t offset=0) override
 debug write function from resource_access_if
bool read_dbg (uint8_t *data, size_t length, uint64_t offset=0) const override
 debug read function from resource_access_if
 operator DATATYPE () const
 cast operator to get underlying storage
DATATYPE get () const
 get the underlying storage
void put (DATATYPE data) const
 write to the underlying storage
this_type & operator= (DATATYPE other)
 assignment operator
this_type & operator|= (DATATYPE other)
 unary or
this_type & operator&= (DATATYPE other)
 unary and
void set_read_cb (std::function< bool(const this_type &, DATATYPE &)> read_cb)
 set the read callback
void set_read_cb (std::function< bool(const this_type &, DATATYPE &, sc_core::sc_time &)> read_cb)
 set the read callback
void set_write_cb (std::function< bool(this_type &, const DATATYPE &)> write_cb)
 set the write callback
void set_write_cb (std::function< bool(this_type &, const DATATYPE &, sc_core::sc_time &)> write_cb)
 set the write callback triggered upon a write request
void trace (sc_core::sc_trace_file *trf) const override
 trace the register value to the given trace file
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
virtual bool read_dbg (uint8_t *data, std::size_t length, uint64_t offset=0) const =0
 debug read the data from the resource

Public Attributes

cci::cci_param< bool > enable_tracing
const DATATYPE res_val
 the reset value
const DATATYPE rdmask
 the SW read mask
const DATATYPE wrmask
 the SW write mask

Detailed Description

template<typename DATATYPE>
class scc::impl::sc_register< DATATYPE >

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

Template Parameters
DATATYPE

Definition at line 77 of file register.h.

Member Typedef Documentation

◆ this_type

template<typename DATATYPE>
using scc::impl::sc_register< DATATYPE >::this_type = sc_register<DATATYPE>

Definition at line 79 of file register.h.

Constructor & Destructor Documentation

◆ sc_register()

template<typename DATATYPE>
scc::impl::sc_register< DATATYPE >::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>() )
inline

the constructor

Parameters
nmthe instance name
storagethe storage data structure
reset_valthe reset value
ownerthe owning object which needs to implement the resettable interface
rdmaskthe SW read mask
wrmaskthe SW write mask

Definition at line 94 of file register.h.

Member Function Documentation

◆ get()

template<typename DATATYPE>
DATATYPE scc::impl::sc_register< DATATYPE >::get ( ) const
inline

get the underlying storage

Returns

Definition at line 230 of file register.h.

◆ is_trace_enabled()

template<typename DATATYPE>
bool scc::impl::sc_register< DATATYPE >::is_trace_enabled ( ) const
inlineoverridevirtual

returns of this component shall be traced

Returns
true if this component shall be traced

Reimplemented from scc::traceable.

Definition at line 117 of file register.h.

◆ operator DATATYPE()

template<typename DATATYPE>
scc::impl::sc_register< DATATYPE >::operator DATATYPE ( ) const
inline

cast operator to get underlying storage

Definition at line 223 of file register.h.

◆ operator&=()

template<typename DATATYPE>
this_type & scc::impl::sc_register< DATATYPE >::operator&= ( DATATYPE other)
inline

unary and

Parameters
otherthe other value
Returns
reference to this

Definition at line 265 of file register.h.

◆ operator=()

template<typename DATATYPE>
this_type & scc::impl::sc_register< DATATYPE >::operator= ( DATATYPE other)
inline

assignment operator

Parameters
otherthe new value
Returns
reference to this

Definition at line 245 of file register.h.

◆ operator|=()

template<typename DATATYPE>
this_type & scc::impl::sc_register< DATATYPE >::operator|= ( DATATYPE other)
inline

unary or

Parameters
otherthe other value
Returns
reference to this

Definition at line 255 of file register.h.

◆ put()

template<typename DATATYPE>
void scc::impl::sc_register< DATATYPE >::put ( DATATYPE data) const
inline

write to the underlying storage

Parameters
datathe new value

Definition at line 237 of file register.h.

◆ read()

template<typename DATATYPE>
bool scc::impl::sc_register< DATATYPE >::read ( uint8_t * data,
size_t length,
uint64_t offset,
sc_core::sc_time & d ) const
inlineoverride

read function from resource_access_if

Parameters
datato be read
lengthof data to be written in bytes
offsetof the write to the baseaddress of the register
doffset of the time in a time domain wrt. the SystemC simulator time (e.g. when using loosly-timed modeling)
Returns
true if access is successful

Definition at line 170 of file register.h.

◆ read_dbg()

template<typename DATATYPE>
bool scc::impl::sc_register< DATATYPE >::read_dbg ( uint8_t * data,
size_t length,
uint64_t offset = 0 ) const
inlineoverride

debug read function from resource_access_if

This access should not cause any side effect!

Parameters
datato be read
lengthof data to be written in bytes
offsetof the write to the baseaddress of the register
Returns
true if access is successful

Definition at line 211 of file register.h.

◆ reset()

template<typename DATATYPE>
void scc::impl::sc_register< DATATYPE >::reset ( )
inlineoverridevirtual

reset the register

Implements scc::resource_access_if.

Definition at line 130 of file register.h.

◆ set_read_cb() [1/2]

template<typename DATATYPE>
void scc::impl::sc_register< DATATYPE >::set_read_cb ( std::function< bool(const this_type &, DATATYPE &)> read_cb)
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

Parameters
read_cbthe callback functor

Definition at line 277 of file register.h.

◆ set_read_cb() [2/2]

template<typename DATATYPE>
void scc::impl::sc_register< DATATYPE >::set_read_cb ( std::function< bool(const this_type &, DATATYPE &, sc_core::sc_time &)> read_cb)
inline

set the read callback

The read callback functor triggered upon a read request.

Parameters
read_cbthe callback functor

Definition at line 287 of file register.h.

◆ set_write_cb() [1/2]

template<typename DATATYPE>
void scc::impl::sc_register< DATATYPE >::set_write_cb ( std::function< bool(this_type &, const DATATYPE &)> write_cb)
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

Parameters
write_cbthe callback functor

Definition at line 296 of file register.h.

◆ set_write_cb() [2/2]

template<typename DATATYPE>
void scc::impl::sc_register< DATATYPE >::set_write_cb ( std::function< bool(this_type &, const DATATYPE &, sc_core::sc_time &)> write_cb)
inline

set the write callback triggered upon a write request

The write callback functor is triggered upon a write request.

Parameters
write_cbthe callback functor

Definition at line 306 of file register.h.

◆ size()

template<typename DATATYPE>
size_t scc::impl::sc_register< DATATYPE >::size ( ) const
inlineoverridevirtual

get the size of this register in bytes

Returns

Implements scc::resource_access_if.

Definition at line 124 of file register.h.

◆ trace()

template<typename DATATYPE>
void scc::impl::sc_register< DATATYPE >::trace ( sc_core::sc_trace_file * trf) const
inlineoverride

trace the register value to the given trace file

Parameters
trfthe trace file

Definition at line 313 of file register.h.

◆ write()

template<typename DATATYPE>
bool scc::impl::sc_register< DATATYPE >::write ( const uint8_t * data,
size_t length,
uint64_t offset,
sc_core::sc_time & d )
inlineoverride

write function from resource_access_if

Parameters
datato be written
lengthof data to be written in bytes
offsetof the write to the baseaddress of the register
doffset of the time in a time domain wrt. the SystemC simulator time (e.g. when using loosly-timed modeling)
Returns
true if access is successful

Definition at line 149 of file register.h.

◆ write_dbg()

template<typename DATATYPE>
bool scc::impl::sc_register< DATATYPE >::write_dbg ( const uint8_t * data,
size_t length,
uint64_t offset = 0 )
inlineoverride

debug write function from resource_access_if

This access should not cause any side effect!

Parameters
datato be written
lengthof data to be written in bytes
offsetof the write to the baseaddress of the register
Returns
true if access is successful

Definition at line 193 of file register.h.

Member Data Documentation

◆ enable_tracing

template<typename DATATYPE>
cci::cci_param<bool> scc::impl::sc_register< DATATYPE >::enable_tracing

Definition at line 81 of file register.h.

◆ rdmask

template<typename DATATYPE>
const DATATYPE scc::impl::sc_register< DATATYPE >::rdmask

the SW read mask

Definition at line 317 of file register.h.

◆ res_val

template<typename DATATYPE>
const DATATYPE scc::impl::sc_register< DATATYPE >::res_val

the reset value

Definition at line 315 of file register.h.

◆ wrmask

template<typename DATATYPE>
const DATATYPE scc::impl::sc_register< DATATYPE >::wrmask

the SW write mask

Definition at line 319 of file register.h.


The documentation for this class was generated from the following file:
  • /home/eyck/Projects/MINRES/SystemC-Components/src/components/scc/register.h