Intel® Simics® Simulator for Intel® FPGAs: User Guide

ID 784383
Date 12/04/2023

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

5.3.8. Intel® Simics® Simulator File Location and Intel® Simics® Search Path

Many Intel® Simics® simulator commands searches files based on the current directory. When Intel® Simics® simulator is launched from the command line, the current directory is the project directory in the host terminal from which the Intel® Simics® simulation is launched from. This may be impractical when writing scripts or building new configurations, so Intel® Simics® simulator provides two features to ease directory handling:

  1. Intel® Simics® simulator recognizes some special path markers that are translated before being used:
    1. %simics%: This path marker causes Intel® Simics® simulator to locate the file (following the marker) in the project directory or in any of the installed packages. If not found in the project directory, the simulator starts searching in the newest package, (the one with the highest build-id number).

      For example, %simics%/scripts/foo.simics can be translated to:



      Note: If you change the version of Intel® Simics® simulator, %simics% changes as well, so you must use it to refer only to files that you know are present in all Intel® Simics® simulator versions. Also notice that %simics% has no meaning if no file can be found. You can use the command lookup-file or resolve-file to find out how the path is translated (lookup-file “%simics%”).
    2. %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 baz contains the scripts foo.simics and bar.simics, even if the you use Intel® Simics® simulator with another current directory, it is 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 Intel® Simics® search path. One consequence is that they must always be used in double quotes "%simics%/targets/device/images" to ensure that escaped characters, such as spaces, are used correctly.

  2. Intel® Simics® simulator has a list of paths called Simics Search Path where files are searched when using some specific commands (among others, load-binary, load-file, run-command-file, and run-python-file) and several classes (such as the image class and the tftp server implementation in the service-node). The file is first searched in the current directory, then in all entries of Intel® Simics® Search Path, in order.

    For example, assume that the Intel® Simics® Search Path contains the following directories:

    And you call the following command:
    run-command-file test/start-test.simics

    Intel® Simics® simulator searches for the start-test.simics file at the following paths:

    You can manipulate the Intel® Simics® Search Path using the add-directory, clear-directories, and list-directories commands. Intel® Simics® Search Path is also used when looking for image files belonging to checkpoints or new configurations. The following capture shows some examples of using these commands to find files:
    # Intel Simics simulator CLI 
    # Assume that the file myfile.simics is located in the directory:
    # /home/simicsUser/SimicsInstallDir/simics/simics-intelfpga-6.0.900000002/scripts
    # This file just prints a message when executed: This is myfile.simics file.
    # Clearing all search path directories
    simics> clear-directories
    simics> list-directories
    The current Intel Simics search path is empty.
    # Adding Project dirctory (Not really needed as project dir is in the 
    # search path by default)
    simics> add-directory “/home/simicsUser/SimicsInstallDir/project-1”
    simics> list-directories
    The current Intel Simics search path is:
    # Looking for the myfile.simics.file (lookup-file command also works)
    simics> resolve-file myfile.simics
    Not in search path: 'myfile.simics'
    # Adding directory where myfile.simics file exists
    simics> add-directory "/home/simicsUser/SimicsInstallDir/ simics/\
    simics> list-directories
    The current Intel Simics search path is:
    simics> resolve-file “myfile.simics”
    simics> run-command-file myfile.simics
    “This is myfile.simics file”