Logging Modules
API Reference Manual  /  Simulator API  /  Simulator API Functions  / 

Memory

SIM_load_binary

Name

SIM_load_binary — read an executable file into memory

Synopsis

C and DML

#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML

physical_address_t
SIM_load_binary(conf_object_t *NOTNULL obj, const char *NOTNULL file,
                physical_address_t offset, bool use_pa, bool verbose);

Python

import simics

simics.SIM_load_binary(...)

Description

Read a binary file (ELF, Motorola S-Record, PE32, PE32+, or TI COFF format) into memory and return the code entry point.

The file will be loaded at the address formed by adding the virtual load address from the file, with the offset offset. If the flag use_pa is set, the ELF physical load address is used instead. The verbose flag will cause Simics to print info about the binary to the console.

The memory space to load into is given in the obj parameter. If the given space is a CPU object, its current virtual address space will be used, and addresses will be translated before writing to the physical memory space attached to the CPU.

If the file is not found in the current directory, the search path (see add-directory) is used to find the file.

Exceptions

SimExc_IOError Thrown if there was a problem reading the file.

SimExc_General Thrown if binary cannot be read into memory.

Return Value

The code entry address.

Execution Context

Global Context

SIM_load_file

Name

SIM_load_file — read a file into memory

Synopsis

C and DML

#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML

void
SIM_load_file(conf_object_t *NOTNULL obj, const char *NOTNULL file,
              physical_address_t base_address, bool verbose);

Python

import simics

simics.SIM_load_file(...)

Description

Loads the contents of file into memory starting at address base_address. The obj argument can either be a processor, a memory-space, or an image object. In case of a processor, the address is interpreted as a virtual address.

The file can be either a raw binary file or a file in the craff format.

The verbose flag will cause Simics to print some information about the load.

Exceptions

SimExc_IOError Thrown if there was a problem reading the file.

SimExc_General Thrown if file cannot be read into memory.

Execution Context

Cell Context

SIM_read_byte, SIM_write_byte

Name

SIM_read_byte, SIM_write_byte — read/write byte from a memory space

Synopsis

C and DML

#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML

uint8
SIM_read_byte(conf_object_t *NOTNULL obj, generic_address_t paddr);

void
SIM_write_byte(conf_object_t *NOTNULL obj,
               generic_address_t paddr, uint8 value);

Python

import simics

simics.SIM_read_byte(...)
simics.SIM_write_byte(...)

Description

Read or write a byte from a given address in the memory space obj.

Exceptions

SimExc_Memory Thrown if the memory space threw an exception

SimExc_General Thrown if the object does not implement the memory space interface.

Return Value

The byte read.

Execution Context

Cell Context

SIM_read_phys_memory

Name

SIM_read_phys_memory — read data from a physical address

Synopsis

C and DML

#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML

uint64
SIM_read_phys_memory(conf_object_t *NOTNULL cpu,
                     physical_address_t paddr,
                     int length);

Python

import simics

simics.SIM_read_phys_memory(...)

Description

Reads length bytes from address paddr in the physical memory space associated with the processor cpu.

Up to 8 bytes can be read in one call. The memory access will be of inquiry type, i.e. no timing-model or snoop device will be called.

For non-inquiry accesses, use the memory_space interface directly.

Exceptions

SimExc_Memory Thrown if no memory defined at paddr.

SimExc_Attribute Thrown if length is out of range.

SimExc_General Thrown if the processors physical memory does not implement the necessary interface methods.

Return Value

The read data, zero-extended.

Execution Context

Cell Context

SIM_read_phys_memory_tags, SIM_write_phys_memory_tags

Name

SIM_read_phys_memory_tags, SIM_write_phys_memory_tags — access auxiliary bits in physical memory

Synopsis

C and DML

#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML

uint64
SIM_read_phys_memory_tags(conf_object_t *NOTNULL mem_space,
                          physical_address_t paddr, unsigned ntags);

void
SIM_write_phys_memory_tags(conf_object_t *NOTNULL mem_space,
                           physical_address_t paddr,
                           uint64 tag_bits, unsigned ntags);

Python

import simics

simics.SIM_read_phys_memory_tags(...)
simics.SIM_write_phys_memory_tags(...)

Description

Reads or writes ntags auxiliary bits starting at paddr in the physical memory space mem_space. Up to 64 bits can be accessed at once. The bits are specified and returned right-aligned, least significant bit corresponding to the lowest address.

Execution Context

Cell Context

SIM_write_phys_memory

Name

SIM_write_phys_memory — write data to a physical address

Synopsis

C and DML

#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML

void
SIM_write_phys_memory(conf_object_t *NOTNULL cpu,
                      physical_address_t paddr,
                      uint64 value, int length);

Python

import simics

simics.SIM_write_phys_memory(...)

Description

Writes length bytes to address paddr in the physical memory space associated with the processor cpu.

Up to 8 bytes can be written in one call. The memory access will be of inquiry type, i.e. no timing-model or snoop device will be called.

Exceptions

SimExc_Memory Thrown if no memory defined at paddr.

SimExc_Attribute Thrown if length is out of range.

SimExc_General Thrown if the processors physical memory does not implement the necessary interface methods.

Execution Context

Cell Context

Logging Modules