Sei sulla pagina 1di 4

SimpleScalar

What is it?
SimpleScalar is a suite of processor simulators and tools used for simulating real programs running on a
modern processor and systems. It is used to build modeling applications for program performance
analysis, detailed micro-architectural modeling, and hardware-software co-verification.
The tool set includes sample simulators ranging from a fast functional simulator to a detailed, dynamically
scheduled processor model that supports non-blocking caches, speculative execution, and state-of-theart branch prediction. Basically, SimpleScalar is a C program which models a processor and it accepts the
programs (that could run on this hypothetical processor) as arguments.
SimpleScalar simulators can emulate the Alpha, PISA, ARM, and x86 instruction sets, and these are very
similar to the MIPS architecture that will be discussed in EE5364/CSCI5204.
SimpleScalar was developed at the University of Wisconsin in Madison and is one of the most widely used
architectural simulators in academia.
Why are we using this?
You will be using SimpleScalar for your assignments and/or course projects and this guide is being posted
now so that you may properly install the simulator on your CSELabs accounts and get comfortable with
the simulator well in advance.
Installing and setting up SimpleScalar on your CSELabs accounts
It is highly recommended that you install SimpleScalar on your CSELabs accounts since some simulations
take several hours (sometimes days) to complete and it may not be feasible for you to run them on your
personal machines. Having said that, you can always install it on your personal machines for development
work.
1. Find a big endian machine
This C code snippet will enable you to identify a big/little endian machine, however, all CSELabs
machines running Linux are big endian.
#include <stdio.h>
main()
{
long one=1;
if(!(*((char*)(&one))))
printf("Big endian\n");
else
printf("Small endian\n");
}

2. Get the simulator and a sample benchmark


a. Download the simplesim-3v0e.tar file from moodle and untar it. This will create the folder
simplesim-3.0
b. Download the sample benchmark (anagram) from moodle.
c. It is strongly recommended that you read the README before continuing to the next step.

d. Change to the directory simplesim-3.0 and run the following commands


i. make clean
ii. make config-alpha
iii. make
If you see the message my work here is done., then you have
successfully installed SimpleScalar on your machine.
e. You now have the following simulators:
i. Functional: sim-safe, sim-fast
ii. Cache: sim-cache
iii. Profiling: sim-profile
iv. Out of order processor: sim-outorder
f. You may run ./sim-outorder in the simplesim-3.0 directory to get the manpages
for SimpleScalar. It gives a list of all possible arguments that SimpleScalar can accept that
are used to model the processor architecture.
Running the simulation
1. Go to the directory containing the anagram benchmark and run:
./<path_to_sim-outorder>/sim-outorder anagram words < anagram.in
This will take about a minute to run and will give the output of anagram, as it ran on SimpleScalar.
It will also give the output of SimpleScalar on the terminal, which will the simulation statistics.
If you can see the simulation statistics and the output of anagram (similar to anagram.out),
then your simulation has completed without any error.
2. As an example, if you wish to change the latency of your caches, then you may run:
./<path_to_sim-outorder>/sim-outorder
-cache:dl1lat
cache:dl2lat 12 anagram words < anagram.in

How to use and present the results


1. You will get different results for every processor configuration and for every benchmark. These
will be similar to:

2. If, for example, you have to compare the IPC for different cache replacement policies (viz. FIFO,
Random, LRU, NMRU) for four different benchmarks (GCC, GO, GZIP, Anagram), then the graph
would look like this.

Hints, Tips and Tricks:


1. Scripting:
It is very useful to write scripts for all the SimpleScalar commands. If, for instance, you have to
simulate and compare 10 different configurations for 4 different benchmarks, then you will have
to execute the SimpleScalar command 10X4 = 40 times. A scripting language (like Shell scripting,
Python, Perl etc.) will be extremely beneficial.

2. Tracking the simulations:


Before you use the script to spawn several processes on a machine, it will be useful to check the
workload of that machine. If it already has too many processes, then your simulations may take
weeks to finish.
Use the top, prstat commands to check the workloads of the machine and also to find out the
Process ID of a process. This is useful if you want to kill a simulation.
3. nohup, screen
These commands allow you to continue running the simulation even after you have logged out of
the machine. This is useful if your simulations are taking too long.
e.g.:
nohup
./<path
to
sim-outorder>/sim-outorder
-redir:sim
simoutput.txt -redir:prog progoutput.txt
-cache:dl1lat 2 cache:dl2lat 12 anagram words < anagram.in
This command will run the simulation and will store the program output in progoutput.txt, the
simulation statistics in simoutput.txt even if you have logged out of the PC after executing the
command.

It is strongly recommended that you start using SimpleScalar for the getting simulation statistics for the
benchmarks provided. Also, it will be useful to start going through the C/C++ code of SimpleScalar
because your project and/or assignment may require you to make some modifications in the code to
achieve a particular processor functionality.

Potrebbero piacerti anche