Output Processor
API Reference Manual  /  Simulator API  /  Simulator API Functions  / 

Path

SIM_add_directory

Name

SIM_add_directory — add directory to search path

Synopsis

C and DML

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

void
SIM_add_directory(const char *NOTNULL directory, bool prepend);

Python

import simics

simics.SIM_add_directory(...)

Description

Adds a directory to Simics’s search path. This is a list of directories which Simics uses when searching for files such as disk dumps, kernel images, etc.

The directory argument is first converted using SIM_native_path, to yield a path on host native form. If the path does not exist, a frontend exception is raised.

If prepend is true, the directory is inserted first in the list of directories.

This list of directories is saved as the attribute simics_path when doing write-configuration. Each directory is first converted to absolute form if relative.

Exceptions

SimExc_General Thrown if the directory does not exist.

See Also

SIM_lookup_file, SIM_clear_directories

Execution Context

Global Context

SIM_clear_directories

Name

SIM_clear_directories — clear the search path

Synopsis

C and DML

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

void
SIM_clear_directories();

Python

import simics

simics.SIM_clear_directories(...)

Description

Deletes all directories from the search path.

See Also

SIM_add_directory, SIM_lookup_file

Execution Context

Global Context

SIM_get_directories

Name

SIM_get_directories — get the current search path

Synopsis

C and DML

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

attr_value_t
SIM_get_directories();

Python

import simics

simics.SIM_get_directories(...)

Description

Returns the current value of the directory search path.

Execution Context

Cell Context

SIM_lookup_file

Name

SIM_lookup_file — find a file using simics search path

Synopsis

C and DML

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

char *
SIM_lookup_file(const char *file);

Python

import simics

simics.SIM_lookup_file(...)

Description

Searches for a file in the Simics search path.

The returned path will always be in host native format, so it will not need to be converted. See SIM_native_path for more details on what “host native format” means.

NULL is returned if file cannot be found.

The search algorithm is as follows.

If the file was found, a pointer to the full path to the file is returned. The ownership of the string is passed to the caller.

See Also

SIM_add_directory, SIM_clear_directories

Execution Context

Cell Context

SIM_native_path

Name

SIM_native_path — convert path to its native form

Synopsis

C and DML

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

char *
SIM_native_path(const char *NOTNULL path);

Python

import simics

simics.SIM_native_path(...)

Description

Translates a path to its host native form. This functions is a no-op on all platforms except Windows.

The value returned by this function is allocated and owned by the caller.

Execution Context

Cell Context

Output Processor