Lab 0: Using SimpleScalar at IDA's Machines
Table of Contents
- Installation
- SimpleScalar tool set
- Configuration files for simulators
- Output simulation results to files
- What to report
Installation
The first step to access the lab environment is to login to the server running the tools as follows,
ssh yourname@simplescalar.ida.liu.se
The SimpleScalar distribution is installed in the directory /opt/simplescalar/simplesim-3.0
. The important lab files can be found in /home/TDTS08
with a binary benchmark in the bin
subdirectory. Before doing the labs, we recommend you can copy the lab folder into your local directory by
cp -r /home/TDTS08 TDTS08
For easy access of the tools, you can set your PATH
environmental by issuing the following command line.
PATH=$PATH:/opt/simplescalar/simplesim-3.0:/opt/simplescalar/bin
You can also put this command line in your ~/.profile
file, so that you can avoid typing it every time when you log in.
export PATH=$PATH:/opt/simplescalar/simplesim-3.0:/opt/simplescalar/bin
To test whether a simulator works propoerly, 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 /opt/simplescalar/bin/
directory. Here are the tools used to generate SimpleScalar binaries.
- sslittle-na-sstrix-gcc: GNU C cross-compiler
- sslittle-na-sstrix-objdump: disassembler
- sslittle-na-sstrix-{ar, ranlib}: used for building libraries
- sslittle-na-sstrix-ld: link-editor for object files
- sslittle-na-sstrix-strip: strips symbol table, debugging information and line number information from an object file
- sslittle-na-sstrix-nm: output the name list of an object file
- sslittle-na-sstrix-strings: searches for printable strings in an object or binary file
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 ~TDTS08/bin/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 ~TDTS08/bin/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:
- D. Burger and T. M. Austin, The SimpleScalar Tool Set, Version 2.0, 1997.
- T. M. Austin, A User's and Hacker's Guide to SimpleScalar Architectural Tool Set, 1997
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>
<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 simulatorsim-cache
into a filecfgfile.cfg
located in the current directory.
sim-cache -q -dumpconfig cfgfile.cfg
-
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>
<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 binarygo.ss
(with arguments2
and8
) located in the directory~TDTS08/bin
on the simulatorsim-cache
, using a configuration filecfgfile.cfg
located in the current directory.sim-cache -config cfgfile.cfg ~TDTS08/bin/go.ss 2 8
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>
<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 ~TDTS08/bin
on the simulator sim-cache
,
redirecting the simulation outputs to a file output.txt
located in the current directory.
sim-cache ~TDTS08/bin/go.ss 2 8 > output.txt
What to report
Nothing is required to report for this introductory lab.
Page responsible: Zebo Peng
Last updated: 2015-11-18