Simplescalar Installation
Simplescalar Installation
Simplescalar Installation
MatsBrorsson,April15,2008
Introduction
ThefollowingtextdescribestheprocedureofinstallingthesimulatorSimplescalar(1)onamodenLinux
distribution.TheprocedurehasbeentestedonUbuntuLinux7.1.Theinstructionsaremodifiedfrom(2).
Preparations
Downloadthenecessarysourcecodefiles:
simpletools2v0.tgzfromhttp://www.simplescalar.com/tools.html
simplesim3v0dwithcheetah.tar.gzfromhttp://www.ict.kth.se/courses/IS2202/software
simpleutils990811.tar.gzfromhttp://www.eecs.umich.edu/mirv/
gcc2.7.2.3.ss.tar.gzfromhttp://american.cs.ucdavis.edu/RAD/gcc2.7.2.3.ss.tar.gz
Setupsomeenvironmentvariables(assumingyourhomedirectoryis/home/matsbror):
$ export IDIR=/home/matsbror/simplescalar
$ export HOST=i686-pc-linux
$ export TARGET=sslittle-na-sstrix
Createthedirectorysimplescalarunderyourhomedirectory,andcopyallthefourtarballsintoit:
$
$
$
$
$
mkdir $IDIR
mv simplesim-3v0d-with-cheetah.tgz $IDIR
mv simpletools-2v0.tgz $IDIR
mv simpleutils-990811.tar.gz $IDIR
mv gcc-2.7.2.3.ss.tar.gz $IDIR
UpdateUbuntu(orwhateverdistributionyouareusing)withthefollowingpackages:
buildessential
flex
bison
yacc(maybenotneeded)
WanttorunonaWindowscomputer?
IfyoudonthaveaccesstoaLinuxcomputerandyouwanttouseaWindowscomputerinstead,youcanusea
virtualmachine.AmodelwhichhasbeentestedtoworkistouseVmWareserverwhichcanbedownloadedfor
freeathttp://www.vmware.com.
InstallingSimpleTools
Justunpackthepackagefile,andremovetheoldgccfolder:
$ cd $IDIR
$ tar xvfz simpletools-2v0.tgz
$ rm -rf gcc-2.6.3
InstallingSimpleUtils
Firstunpackthepackagefile.
$ cd $IDIR
$ tar xvfz simpleutils-990811.tar.gz
$ cd simpleutils-990811
Beforebuildingthecode,youneedtofixsomesourcesoferrors:
Indirectoryldfindfileldlex.landreplaceallinstancesofyy_current_bufferwith
YY_CURRENT_BUFFER
Buildingthesimulators
Unpackthesimulatorpackage.
$ cd $IDIR
$ tar xvfz simplesim-3v0d.tgz
$ cd simplesim-3.0
ModifytheMakefilebychangingO0withOtoenablecompileroptimizations.Note:Thesimulatormay
notworkifyouenablehigherdegreeofoptimizations.
$ make config-pisa
$ make
youmaytesttheinstallationofsimplesimby:
$ ./sim-safe tests/bin.little/test-math
Installationofgcccrosscompiler
Unpackthesourcecodeandconfiguretheinstallation:
$
$
$
$
cd $IDIR
tar xvfz gcc-2.7.2.3.ss.tar.gz
cd gcc-2.7.2.3
./configure -host=$HOST -target=$TARGET -with-gnu-as
-with-gnu-ld -prefix=$IDIR
$ chmod R +w .
Now,youneedtomodifyanumberoffilesinorderforthecompilationprocesstowork.
ChangetheMakefileatline130,byappendingI/usr/includetotheendoftheline
Editline60ofprotoize.c,andreplace#include <varargs.h>with
#include <stdarg.h>
Tofixanerrormessageaboutdecl.c,sayinginvalidlvalueinincrement,dothefollowing:Edit
obstack.hatline341andchange:
*((void **)__o->next_free)++=((void *)datum);\
with
*((void **)__o->next_free++)=((void *)datum);\
Alsorunthefollowingcommands:
cp ./patched/sys/cdefs.h ../sslittle-na-sstrix/include/sys/cdefs.h
cp ../sslittle-na-sstrix/lib/libc.a ../lib/
cp ../sslittle-na-sstrix/lib/crt0.o ../lib/
Nextbuildthecompiler:
$ make LANGUAGES=c c++ CFLAGS=-O CC=gcc
Thiscommandwillleadtoanumberoferrormessageswhichrequiresyoutoeditacoupleoffiles:
append\attheendoflines675,750and823infileinsnoutput.c
Domake LANGUAGESagainandthen
removelines29782979infilecxxmain.c,ifneeded
Now,run:
$
$
$
$
Thatshouldexecutewithnotroubles.
Withthat,SimpleScalarhasbeeninstalled,alongwithitstools,utils,andcompilers.Letsnowtestcompilinga
newcodeandrunningitontopofsimplescalar:
Createanewfile,hello.c,thathasthefollowingcode:
#include<stdio.h>
main()
{
printf("Hello World!\n");
}
thencompileitusingthefollowingcommand:
Thatshouldgenerateafilehello,whichwewillrunoverthesimulator:
$ $IDIR/simplesim-3.0/sim-safe hello
Intheoutput,youshouldbeabletofindthefollowing:
sim:**startingfunctionalsimulation**
HelloWorld!
Yourworkisdone!
References
1.SimpleScalar.SimpleSclarhomepage.[Online][Cited:March26,2008.]http://www.simplescalar.com.
2.AlIssa,Khalid.ASimplescalarInstallationguide.[Online]den9July2007.[Citat:den26March2008.]
http://www.studiokhalid.com/simplescalar/simplescalar.htm.