Hide menu

Lab 0: Using SimpleScalar at IDA's Machines

Table of Contents

Installation

We use the SimpleScalar toolset throughout the labs. SimpleScalar distribution is already installed in the directory /home/TDTS10/simplescalar. All you need to do is to copy this folder into your local home directory (denoted by ~) using the following command.

    cp -r /home/TDTS10/simplescalar ~

Once you copied the toolset, in order to use any of the simulators you need to first open a terminal (using ctrl+alt+t), change directory to your local simplescalar folder, and then run the command from the simplescalar directory. For example, to use sim-cache you use the following commands in a terminal

    cd ~/simplescalar
    sim-cache test.ss

SimpleScalar tool set

The tool set contains several simulators, each of which targets a specific type of analysis. However, in this course you are not going to use all of these tools. Here are the names of the simulators that you are going to use and discriptions on their characteristics.

  • sim-cache: multi-level cache simulator - used in lab 1.
  • sim-cheetah: multi-configuration cache simulator - used in lab 1.
  • sim-outorder: the most complex and detailed SimpleScalar simulator in the tool set - used in lab 2, 3.

All these tools help you simulate the hardware, the SimpleScalar architecture. However, this architecture cannot be simulated without a software running on it. The binaries for SimpleScalar usually have the filename suffix .ss. If you want to create SimpleScalar binaries out of a C code, you have to use the sslittle-na-sstrix-gcc compiler. However, for the labs the required binaries are provided and you can find them in cde-root folder.

In the labs, you will use the go.ss benchmark, which is a program that plays the game "Go" against itself. Running the go.ss benchmark requires you to provide the level of difficulty of the player and the size of the game board. Issuing the following command line will run go.ss on the default architecture with the simulator sim-cache, and with the players' level of 2 and the board size of 8.

    sim-cache go.ss 2 8

Note that you should type a white space between each pair of the following consecutive segments: the name of the simulator sim-cache, the name of the benchmark located in ~simplescalar/cde-root/ folder, the level of players 2, and the size of the board 8.

ATTENTION: You must issue the command from the ~/simplescalar directory.

If the program runs correctly, you will receive an output consisting the following contents in the given order.

  • Details of the architecture on which the simulation was performed. This is given as the default arguments used for the simulation
  • Actual moves performed by each "Go" player. This is given as the output of the functional simulation
  • A set of statistics recorded during the simulation, such as the total number of memory accesses, the number of hits and misses on each cache, etc.

Detailed descriptions on the SimpleScalar tool set can be found in the following documents:

Configuration files for simulators

  • Sometimes a command line becomes quite long due to the large number of arguments specified for a simulation. This may be overcome by using a configuration file in which all the required arguments for the simulation are specified.

    You can dump the default configurations for a simulator into a file, by issuing a command line lie the following.

      <simulator> -q -dumpconfig <default_config_file>
    where <simulator> is the name of the simulator (e.g. sim-cache), -dumpconfig is the optional switch indicating that dumping the default configurations for the simulator is required, and <default_config_file> is the name of the file into which the default configurations are dumped.

    For example, the following command line dumps the default configurations for simulator sim-cache into a file cfgfile.cfg located in the cde-root directory.

      sim-cache -q -dumpconfig cfgfile.cfg

  • You can modify the dumped default configuration file according to your simulation requirements and use it to perform simulations with the new configurations.

    You can run a simulation with a specified configuration file by issuing the following command line.

      <simulator> -config <config_file> <ss_executable>
    where <simulator> is the name of the simulator, -config is the optional switch indicating that a configuration file for the simulator is required, <config_file> is the name of the configuration file to be used for the simulator, and <ss_executable> is the name of the executable file for SimpleScalar.

    ATTENTION: The configuration file and the executable must be located in the cde-root folder.

    For example, the following command line will run the binary go.ss (with arguments 2 and 8), located in the cde-root directory, on the simulator sim-cache using a configuration file cfgfile.cfg, located in the same directory.

      sim-cache -config cfgfile.cfg go.ss 2 8
    ATTENTION: Each simulator has a different set of arguments. If you use a particular configuration file for a simulator, do NOT use it for other simulators.

Output simulation results to files

The results of simulation are usually sent to the standard output std_err. If you want to redirect the simulation results into a file, issue a command line like the following.

    <simulator> <ss_executable> &> <output_file>
where <simulator> is the name of the simulator, <ss_executable> is the name of the executable file for SimpleScalar in the cde-root directory, > is the option indicating the redirection of outputs to a file, and <output_file> is the full path of the output file.

For example, the following command line will run the binary go.ss (with arguments 2 and 8) located in the cde-root directory on the simulator sim-cache, redirecting the simulation outputs to a file output.txt located in the current directory.

    sim-cache go.ss 2 8 &> output.txt

ATTENTION: You must issue the command from the ~/simplescalar directory.

What to report

Nothing is required to report for this introductory lab.


Page responsible: Zebo Peng
Last updated: 2017-10-27