I used to work with Java over the past years and now I have to deal with a simulator that was written in C. It's been a while since I wrote, read and built any C code so it may not be a very easy journey. Let me share how I try to understand the simulator step by step:
- SimpleScalar is a suite of processor simulators and supporting tools. Using the SimpleScalar tools, users can build modeling applications that simulate real programs running on a range of modern processors and systems.
- SimpleScalar architecture is a close derivative of the MIPS architecture.
- The tool set takes binaries compiled for the SimpleScalar architecture and simulates their execution on one of several provided processor simulators.
- SimpleScalar provides sets of precompiled binaries (including SPEC95), plus a modified version of GNU GCC (with associated utilities) that allows us to compile our own SimpleScalar test binaries from C code.
- Different simulators perform differently depending on the detail level.
The five distribution files in the directory are:
simplesim.tar.gz - contains the simulator sources, the instruction set definition macros, and test program source and binaries. This file is required for installation of the tool set.
simpleutils.tar.gz - contains the GNU binutils source, retargeted to the SimpleScalar architecture.
These utilities are not required to run the simulators themselves, but is required to compile your own SimpleScalar benchmark binaries (e.g. test programs other than the ones we provide)
simpletools.tar.gz - contains the retargeted GNU compiler and library sources needed to build SimpleScalar benchmark binaries.
This file is needed only to build benchmarks, not to compile or run the simulators.
simplebench.big.tar.gz - contains a set of the SPEC95 benchmark binaries, compiled to the SimpleScalar architecture running on a big-endian host.
Installing and running Simplescalar
Benchmarks written in C are compiled using the SimpleScalar version of GCC, which generates SimpleScalar assembly. The SimpleScalar assembler and loader, along with the necessary ported libraries, produce SimpleScalar executables that can then be fed directly into one of the provided simulators. (The simulators themselves are compiled with the host platform’s native compiler; any ANSI C compiler will do).
If you use the precompiled SPEC95 binaries or the precompiled test programs, all you have to install is the simulator source itself. If you wish to compile your own benchmarks, you will have to install and build the GCC tree and optionally (recommended) the GNU binutils.
Endianness
The SimpleScalar architecture, like the MIPS architecture, supports both big-endian and little-endian executables. The tool set supports compilation for either of these targets; the names for the big-endian and little-endian architecture are ssbig-na-sstrix and sslittle-na-sstrix, respectively.
You should use the target endian-ness that matches your host platform; the simulators may not work correctly if you force the compiler to provide crossendian support. To determine which endian your host uses, run the endian program located in the simplesim-2.0/ directory.
NOTE: Using make files:
http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/
Installing SimpleScalar under Windows:
https://www.codefull.org/2016/01/simplescalar-installation-under-windows/
http://www.ee.ryerson.ca/~courses/ee8207/simplescalar.doc
NOTE:
Cygwin is a Unix-like environment and command-line interface for Microsoft Windows.
(Try with Virtual Box - Ubuntu)
https://www.virtualbox.org/manual/ch01.html#idm374
https://www.liberiangeek.net/2013/09/copy-paste-virtualbox-host-guest-machines/
https://github.com/sdenel/How-to-install-SimpleScalar-on-Ubuntu
http://www.cse.psu.edu/~mtk2/
Installing SimpleScalar to Ubuntu. (changing some source code is needed)
**
http://godblesstangkk.blogspot.com.tr/2013/01/install-simplescalar-30-on-ubuntu-1204.html
**
http://www.cse.iitd.ernet.in/~cs5070217/csl718/assignment1/ss_install_instructions.html
http://harryscode.blogspot.com.tr/2008/10/installing-simplescalar.html
Gem5 Tutorials:
https://www.youtube.com/watch?v=fD3hhNnfL6k
http://learning.gem5.org/index.html
After looking at many blog posts about simplescalar installation, I was able to compile a hello world C program for simplescalar (using special version of gcc), and then I was able to run sim-safe simulator for the hello world program. The output is:
sim: ** simulation statistics **
sim_num_insn 7940 # total number of instructions executed
sim_num_refs 4337 # total number of loads and stores executed
sim_elapsed_time 1 # total simulation time in seconds
sim_inst_rate 7940.0000 # simulation speed (in insts/sec)
...
My host operating system is Window 8.1, I use Oracle VirtualBox and the Linux version is 4.2.0-27-generic i686
Comments