Skip to content

Memory

class Memory

Represents the memory of the target system, including allocated and free blocks and data.

DEFINITION
class Memory;

class Bank

Class representing a bank of memory.

DEFINITION
class Bank;

constructor Bank

Create a bank of memory.

DEFINITION
Bank ( Range  range,
uint8_t  fill_byte = 0 );
PARAMETERDESCRIPTION
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.

DEFINITION
std::optional< uint64_t >  allocate ( const Range & allowed_range,
Allocation  allocation,
uint64_t  alignment,
uint64_t  size );
PARAMETERDESCRIPTION
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.

RETURNSDESCRIPTION
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.

DEFINITION
void  copy ( uint64_t  start,
const std::string & data );
PARAMETERDESCRIPTION
start

The starting address to copy the data to.

data

The data to copy.

method dataconst

Get the data within a specified range.

DEFINITION
std::string  data ( const Range & requested_range ) const;
PARAMETERDESCRIPTION
requested_range

The range of addresses to get data from.

RETURNSDESCRIPTION
std::string

The data within the specified range.

method data_rangeconst

Get the range of addresses containing data.

DEFINITION
Range  data_range ( ) const;
RETURNSDESCRIPTION
Range

The range of addresses containing data.

method debug_blocksconst

Debug the blocks within the bank.

DEFINITION
void  debug_blocks ( std::ostream & stream ) const;
PARAMETERDESCRIPTION
stream

The output stream to write the debug information to.

enum Allocation

The type of allocation for a block of memory.

DEFINITION
enum Allocation;
VALUEDESCRIPTION
DATA

Block containing data.

FREE

Free block that can be allocated.

RESERVED

Reserved block.

constructor Memory

Create an empty memory object.

DEFINITION
Memory ( );

constructor Memory

Create a memory object with specified ranges.

DEFINITION
Memory ( const std::vector< Range > & bank_ranges,
uint8_t  fill_byte = 0 );
PARAMETERDESCRIPTION
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.

DEFINITION
Bank & operator[] ( uint64_t  bank );
PARAMETERDESCRIPTION
bank

The number of the bank to get.

RETURNSDESCRIPTION
Bank &

The bank with the specified number.

method operator[]const

Get bank by its number.

DEFINITION
const Bank & operator[] ( uint64_t  bank ) const;
PARAMETERDESCRIPTION
bank

The number of the bank to get.

RETURNSDESCRIPTION
const Bank &

The bank with the specified number.

class Bank

Class representing a bank of memory.

DEFINITION
class Bank;

constructor Bank

Create a bank of memory.

DEFINITION
Bank ( Range  range,
uint8_t  fill_byte = 0 );
PARAMETERDESCRIPTION
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.

DEFINITION
std::optional< uint64_t >  allocate ( const Range & allowed_range,
Allocation  allocation,
uint64_t  alignment,
uint64_t  size );
PARAMETERDESCRIPTION
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.

RETURNSDESCRIPTION
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.

DEFINITION
void  copy ( uint64_t  start,
const std::string & data );
PARAMETERDESCRIPTION
start

The starting address to copy the data to.

data

The data to copy.

method dataconst

Get the data within a specified range.

DEFINITION
std::string  data ( const Range & requested_range ) const;
PARAMETERDESCRIPTION
requested_range

The range of addresses to get data from.

RETURNSDESCRIPTION
std::string

The data within the specified range.

method data_rangeconst

Get the range of addresses containing data.

DEFINITION
Range  data_range ( ) const;
RETURNSDESCRIPTION
Range

The range of addresses containing data.

method debug_blocksconst

Debug the blocks within the bank.

DEFINITION
void  debug_blocks ( std::ostream & stream ) const;
PARAMETERDESCRIPTION
stream

The output stream to write the debug information to.