Hide menu

Using SimpleScalar at IDA's Machines

Table of Contents

Installation

If you are using a Linux machine in IDA lab, the first step is to open a Solaris session (via thinlinc) - just click it from the start menu (screenshot). The SimpleScalar distribution is installed in the directory /home/TDTS10 (or ~TDTS10 in short), with the binary files in the bin subdirectory and the benchmarks in the spec95-big subdirectory.

For easy access of the tools, you can set your PATH environmental by issuing the following command line.

    setenv PATH "$PATH":/home/TDTS10/bin

(Optional Step:) You can also put this command line in your .login file, so that you can avoid typing it every time when you log in. More information about the .login file can be found from this URL.

To test whether a simulator works properly, you can issue the corresponding command (name of the simulator), such as sim-safe, sim-fast, sim-profile, sim-cache, sim-cheetah, and sim-outorder. If you obtain outputs and the default configurations for the performed simulation, everything is set properly and you can start working on your labs.

SimpleScalar tool set

The tool set contains several simulators, each of which targets a specific type of analysis. Here are the names of the simulators and discriptions on their characteristics.

  • sim-safe: minimal SimpleScalar functional simulator
  • sim-fast: fast SimpleScalar functional simulator (optimized sim-safe)
  • sim-profile: program profiling simulator
  • sim-cache: multi-level cache simulator
  • sim-cheetah: multi-configuration cache simulator
  • sim-outorder: the most complex and detailed SimpleScalar simulator in the tool set

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, you have to use compilers, assemblers, and linkers, which are provided in /home/TDTS10/bin directory. Here are the tools used to generate SimpleScalar binaries.

  • ssbig-na-sstrix-gcc: GNU C cross-compiler
  • ssbig-na-sstrix-objdump: disassembler
  • ssbig-na-sstrix-{ar, ranlib}: used for building libraries
  • ssbig-na-sstrix-ld: link-editor for object files
  • ssbig-na-sstrix-strip: strips symbol table, debugging information and line number information from an object file
  • ssbig-na-sstrix-nm: output the name list of an object file
  • ssbig-na-sstrix-strings: searches for printable strings in an object or binary file

The SimpleScalar distribution comes with a set of benchmarks that can be used for intensive simulations of the architecture. These benchmarks can be found in the ~TDTS10/spec95-big directory. For this introductory preparation, you will use only 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 ~TDTS10/spec95-big/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 location of the benchmark ~TDTS10/spec95-big/go.ss, the level of players 2, and the size of the board 8.

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 full-path 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 current directory.
      sim-cache -q -dumpconfig cfgfile.cfg
    ATTENTION: In order to write a file into a particular directory, you need to have the write permission for all the directories through the path.

  • With the dumped default configuration file, you can modify the dumped configuration file according to your simulation requirements, and use the modified configuration file to perform simulations with the new configurations.

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

      <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 full-path name of the configuration file to be used for the simulator, and <ss_executable> is the full-path name of the executable file for SimpleScalar.
    For example, the following command line will run the binary go.ss (with arguments 2 and 8) located in the directory ~TDTS10/spec95-big on the simulator sim-cache, using a configuration file cfgfile.cfg located in the current directory.
      sim-cache -config cfgfile.cfg ~TDTS10/spec95-big/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 full-path name of the executable file for SimpleScalar, >&! is the option indicating the redirection of outputs to a file, and <output_file> is the full-path name of the output file.
For example, the following command line will run the binary go.ss (with arguments 2 and 8) located in the directory ~TDTS10/spec95-big on the simulator sim-cache, redirecting the simulation outputs to a file output.txt located in the current directory.
    sim-cache ~TDTS10/spec95-big/go.ss 2 8 >&! output.txt


Page responsible: Zebo Peng
Last updated: 2014-11-18