Memory
class Memory
Represents the memory of the target system, including allocated and free blocks and data.
class Bank
Class representing a bank of memory.
class Blockprivate
Class representing a block of memory within a bank.
constructor Block
Create a block of memory.
| Block | ( | Allocation allocation, | |
| Range range | ); |
| PARAMETER | DESCRIPTION |
|---|---|
allocation |
The type of allocation for the block. |
range |
The range of addresses covered by the block. |
member allocation
The type of allocation for the block.
member range
The range of addresses covered by the block.
constructor Bank
Create a bank of memory.
| Bank | ( | Range range, | |
| uint8_t fill_byte = 0 | ); |
| PARAMETER | DESCRIPTION |
|---|---|
range |
The range of addresses covered by the bank. |
fill_byte |
The byte used to fill free and reserved blocks. |
method allocate
Allocate a block of memory within the bank.
| std::optional< uint64_t > allocate | ( | const Range & allowed_range, | |
| Allocation allocation, | |||
| uint64_t alignment, | |||
| uint64_t size | ); |
| PARAMETER | DESCRIPTION |
|---|---|
allowed_range |
The range of addresses allowed for allocation. |
allocation |
The type of allocation. |
alignment |
The alignment requirement. |
size |
The size of the block to allocate. |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< uint64_t > |
The starting address of the allocated block, or std::nullopt if allocation failed. |
method copy
Copy data into the memory at a specified address.
| void copy | ( | uint64_t start, | |
| const std::string & data | ); |
| PARAMETER | DESCRIPTION |
|---|---|
start |
The starting address to copy the data to. |
data |
The data to copy. |
method dataconst
Get the data within a specified range.
| std::string data | ( | const Range & requested_range | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
requested_range |
The range of addresses to get data from. |
| RETURNS | DESCRIPTION |
|---|---|
std::string |
The data within the specified range. |
method data_rangeconst
Get the range of addresses containing data.
| Range data_range | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
Range |
The range of addresses containing data. |
method debug_blocksconst
Debug the blocks within the bank.
| void debug_blocks | ( | std::ostream & stream | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
stream |
The output stream to write the debug information to. |
method offsetconst private
Calculate the offset of an address within the bank.
| size_t offset | ( | size_t address | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
address |
The address to calculate the offset for. |
| RETURNS | DESCRIPTION |
|---|---|
size_t |
The offset of the address within the bank. |
member blocksprivate
The blocks within the bank, sorted by starting address.
member memoryprivate
The memory of the bank.
member rangeprivate
The range of addresses covered by the bank.
enum Allocation
The type of allocation for a block of memory.
| VALUE | DESCRIPTION |
|---|---|
DATA |
Block containing data. |
FREE |
Free block that can be allocated. |
RESERVED |
Reserved block. |
constructor Memory
Create an empty memory object.
| Memory | ( | ); |
constructor Memory
Create a memory object with specified ranges.
| Memory | ( | const std::vector< Range > & bank_ranges, | |
| uint8_t fill_byte = 0 | ); |
| PARAMETER | DESCRIPTION |
|---|---|
bank_ranges |
The ranges of addresses for each bank. |
fill_byte |
The byte used to fill free and reserved blocks. |
method operator[]
Get bank by its number.
| Bank & operator[] | ( | uint64_t bank | ); |
| PARAMETER | DESCRIPTION |
|---|---|
bank |
The number of the bank to get. |
| RETURNS | DESCRIPTION |
|---|---|
Bank & |
The bank with the specified number. |
method operator[]const
Get bank by its number.
| const Bank & operator[] | ( | uint64_t bank | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
bank |
The number of the bank to get. |
| RETURNS | DESCRIPTION |
|---|---|
const Bank & |
The bank with the specified number. |
member banksprivate
The banks of memory.
class Bank
Class representing a bank of memory.
class Blockprivate
Class representing a block of memory within a bank.
constructor Block
Create a block of memory.
| Block | ( | Allocation allocation, | |
| Range range | ); |
| PARAMETER | DESCRIPTION |
|---|---|
allocation |
The type of allocation for the block. |
range |
The range of addresses covered by the block. |
member allocation
The type of allocation for the block.
member range
The range of addresses covered by the block.
constructor Bank
Create a bank of memory.
| Bank | ( | Range range, | |
| uint8_t fill_byte = 0 | ); |
| PARAMETER | DESCRIPTION |
|---|---|
range |
The range of addresses covered by the bank. |
fill_byte |
The byte used to fill free and reserved blocks. |
method allocate
Allocate a block of memory within the bank.
| std::optional< uint64_t > allocate | ( | const Range & allowed_range, | |
| Allocation allocation, | |||
| uint64_t alignment, | |||
| uint64_t size | ); |
| PARAMETER | DESCRIPTION |
|---|---|
allowed_range |
The range of addresses allowed for allocation. |
allocation |
The type of allocation. |
alignment |
The alignment requirement. |
size |
The size of the block to allocate. |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< uint64_t > |
The starting address of the allocated block, or std::nullopt if allocation failed. |
method copy
Copy data into the memory at a specified address.
| void copy | ( | uint64_t start, | |
| const std::string & data | ); |
| PARAMETER | DESCRIPTION |
|---|---|
start |
The starting address to copy the data to. |
data |
The data to copy. |
method dataconst
Get the data within a specified range.
| std::string data | ( | const Range & requested_range | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
requested_range |
The range of addresses to get data from. |
| RETURNS | DESCRIPTION |
|---|---|
std::string |
The data within the specified range. |
method data_rangeconst
Get the range of addresses containing data.
| Range data_range | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
Range |
The range of addresses containing data. |
method debug_blocksconst
Debug the blocks within the bank.
| void debug_blocks | ( | std::ostream & stream | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
stream |
The output stream to write the debug information to. |
method offsetconst private
Calculate the offset of an address within the bank.
| size_t offset | ( | size_t address | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
address |
The address to calculate the offset for. |
| RETURNS | DESCRIPTION |
|---|---|
size_t |
The offset of the address within the bank. |
member blocksprivate
The blocks within the bank, sorted by starting address.
member memoryprivate
The memory of the bank.
member rangeprivate
The range of addresses covered by the bank.
class Blockprivate
Class representing a block of memory within a bank.
constructor Block
Create a block of memory.
| Block | ( | Allocation allocation, | |
| Range range | ); |
| PARAMETER | DESCRIPTION |
|---|---|
allocation |
The type of allocation for the block. |
range |
The range of addresses covered by the block. |
member allocation
The type of allocation for the block.
member range
The range of addresses covered by the block.