Previous - Up - Next
15.4 Simics's Search Path
Many Simics commands will look up files based on the current directory. This
may be impractical when writing scripts or building new configurations, so
Simics provides two features to ease directory handling:
- Simics recognizes some special path markers that are translated before
being used:
- %simics%
- Translated to the current Simics
installation directory, so that
%simics%/scripts/foo.simics will be translated to, for
example,
/home/joe/simics/scripts/foo.simics.
Note that
if you change the version of Simics you are using,
%simics% will change as well, so you should use it to
refer only to files that you know are present in all Simics
versions.
.- %script%
- Translated to the directory where the
currently running script is located. A possible usage is to let a script call
another one in the same directory, independently of what the current directory
is.
For example, if the directory
/home/joe/scripts/
contains the scripts foo.simics and
bar.simics, even if the user
uses Simics with
/home/joe/workspace/
as current directory, it
will be possible for foo.simics to call bar.simics by
issuing the command:
run-command-file %script%/bar.simics
%simics% and %script% are always translated to
absolute paths, so they never interact with the next feature, called
Simics's search path.
- Simics has a list of paths called Simics's search path where files
will be looked up when using some specific commands (among others,
load-binary, load-file, run-command-file, and
run-python-file). The file is first looked up in the current
directory, then in all entries of Simics's search path, in order.
Let us assume for example that Simics's search path contains
/home/joe/scripts/ and that the current directory is
/home/joe/workspace. If the command:
simics> run-command-file test/start-test.simics
is issued, Simics will look for the following files to run:
- /home/joe/workspace/test/start-test.simics
- /home/joe/scripts/test/start-test.simics
Simics's search path can be manipulated using the add-directory,
clear-directories and list-directories commands. Simics's
search path is also used when looking for images files belonging to checkpoints
or new configuration. This is described in section Image Search Path.
Note: Although the Simics search path is saved in the sim object in
checkpoints, allowing image files that were found through it to be opened again
by the checkpoint, it is not available until the object creation phase. Module
initialization code should not rely on the Simics path since that code is run
before the simobject object from the checkpoint has been created.
Previous - Up - Next