The Sparta Modeling Framework
|
#include <RegisterBits.hpp>
Public Member Functions | |
RegisterBits (const uint64_t num_bytes) | |
Create an empty class with the given number of bytes. | |
template<class DataT > | |
RegisterBits (const uint64_t num_bytes, const DataT &data) | |
Create a class with the given number of bytes and initialize it to the given data. | |
RegisterBits (uint8_t *data_ptr, const size_t num_bytes) | |
Create a class pointing into the given data, of the given size. | |
RegisterBits (const uint8_t *data, const size_t num_bytes) | |
Create a class pointing into the given data constantly, of the given size. | |
RegisterBits (std::nullptr_t) | |
Create a nullptr version of the data. This would be an invalid class. | |
RegisterBits (const RegisterBits &orig) | |
Make a copy. | |
RegisterBits (RegisterBits &&orig) | |
Move. | |
RegisterBits | operator| (const RegisterBits &rh_bits) const |
"or" together two classes | |
RegisterBits | operator& (const RegisterBits &rh_bits) const |
"and" together two classes | |
RegisterBits | operator~ () const |
"not" this class | |
RegisterBits | operator>> (uint32_t shift) const |
Shift this instance right and return a copy. | |
RegisterBits | operator<< (uint32_t shift) const |
Shift this instance left and return a copy. | |
void | operator|= (const RegisterBits &rh_bits) |
void | operator<<= (uint32_t shift) |
Shift this instance left. | |
template<class DataT > | |
std::enable_if_t< std::is_integral_v< DataT >, bool > | operator== (const DataT dat) const |
Compare the register bits to the given data. | |
bool | operator== (const RegisterBits &other) const |
Compare the register bits to another. | |
template<class DataT > | |
void | set (const DataT &masked_bits) |
Set the given masked_bits in this RegisterBits instance. | |
void | fill (const uint8_t fill_data) |
Fill the RegisterBits with the given fill_data. | |
const uint8_t * | operator[] (const uint32_t idx) const |
Get the data offset at the given index. | |
const uint8_t * | data () const |
Get the internal data pointer. | |
uint8_t * | data () |
Get the internal data pointer. | |
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value>::type> | |
T | dataAs () const |
Get the internal data as the given dta type. | |
uint32_t | getSize () const |
Get the number of bytes. | |
bool | none () const |
Returns true if no bits are set. | |
bool | any () const |
Returns true if any bit is set. | |
This class is used in conjuntion with sparta::RegisterBase to quickly write masked registers. This class replaces the use of BitArray.
The class works by assuming register data is handed to it via a char array. The class will "view" into this data until it's requested to modify it. When it's modified, the data will be copied to local storage within this class. The user of the class is responsible for writing the data back to the original storage.
Definition at line 29 of file RegisterBits.hpp.
|
inlineexplicit |
Create an empty class with the given number of bytes.
num_bytes | The number of bytes to allocate |
Definition at line 86 of file RegisterBits.hpp.
|
inline |
Create a class with the given number of bytes and initialize it to the given data.
num_bytes | The number of bytes to allocate |
data | The data to write to the lower portion of memory |
The data is copied
Definition at line 108 of file RegisterBits.hpp.
|
inline |
Create a class pointing into the given data, of the given size.
data_ptr | The data to view |
num_bytes | The number of bytes available to view |
No data is copied
Definition at line 131 of file RegisterBits.hpp.
|
inline |
Create a class pointing into the given data constantly, of the given size.
data_ptr | The data to view |
num_bytes | The number of bytes available to view |
No data is copied
Definition at line 144 of file RegisterBits.hpp.
|
inline |
Create a nullptr version of the data. This would be an invalid class.
Definition at line 152 of file RegisterBits.hpp.
|
inline |
Make a copy.
orig | The original to copy |
If the original is pointing to its own memory, that will be copied
Definition at line 160 of file RegisterBits.hpp.
|
inline |
Move.
orig | The original to move |
If the original is pointing to its own memory, that data will be moved. The original is nullified.
Definition at line 185 of file RegisterBits.hpp.
|
inline |
Returns true if any bit is set.
Definition at line 723 of file RegisterBits.hpp.
|
inline |
Get the internal data pointer.
Definition at line 686 of file RegisterBits.hpp.
|
inline |
Get the internal data pointer.
Definition at line 678 of file RegisterBits.hpp.
|
inline |
Get the internal data as the given dta type.
Definition at line 697 of file RegisterBits.hpp.
|
inline |
Fill the RegisterBits with the given fill_data.
fill_data |
If this RegisterBits class was pointing to a remote data view, the data will first be copied then the fill data written
Definition at line 660 of file RegisterBits.hpp.
|
inline |
Get the number of bytes.
Definition at line 707 of file RegisterBits.hpp.
|
inline |
Returns true if no bits are set.
Definition at line 713 of file RegisterBits.hpp.
|
inline |
"and" together two classes
rh_bits | The other to "and" in |
Definition at line 245 of file RegisterBits.hpp.
|
inline |
Shift this instance left and return a copy.
shift | The shift count |
Definition at line 405 of file RegisterBits.hpp.
|
inline |
Shift this instance left.
shift | The shift count |
Definition at line 526 of file RegisterBits.hpp.
|
inline |
Compare the register bits to the given data.
dat | The data to compare |
Definition at line 624 of file RegisterBits.hpp.
|
inline |
Compare the register bits to another.
other | The other RegisterBits instance to compare |
Definition at line 634 of file RegisterBits.hpp.
|
inline |
Shift this instance right and return a copy.
shift | The shift count |
Definition at line 313 of file RegisterBits.hpp.
|
inline |
Get the data offset at the given index.
idx | The index offset |
Definition at line 670 of file RegisterBits.hpp.
|
inline |
"or" together two classes
rh_bits | The other to "or" in |
Definition at line 209 of file RegisterBits.hpp.
|
inline |
Definition at line 491 of file RegisterBits.hpp.
|
inline |
"not" this class
Definition at line 280 of file RegisterBits.hpp.
|
inline |
Set the given masked_bits in this RegisterBits instance.
masked_bits | The bit value to set |
If this RegisterBits class was pointing to a remote data view, the data will first be copied then the masked_bits written
Definition at line 647 of file RegisterBits.hpp.