Sunteți pe pagina 1din 4

Simplescalarinstallationinstructions

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)

Youcanusethecommandsudoapt-get install <package name>toretrieveandinstallthese


packages.

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

$ ./configure --host=$HOST --target=$TARGET --with-gnu-as


--with-gnu-ld --prefix=$IDIR
$ make
$ make install

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:

$
$
$
$

make LANGUAGES=c c++ CFLAGS=-O CC=gcc


make enquire
../simplesim-3.0/sim-safe ./enquire -f > float.h-cross
make LANGUAGES=c c++ CFLAGS=-O CC=gcc install

Thatshouldexecutewithnotroubles.

Withthat,SimpleScalarhasbeeninstalled,alongwithitstools,utils,andcompilers.Letsnowtestcompilinga
newcodeandrunningitontopofsimplescalar:
Createanewfile,hello.c,thathasthefollowingcode:
#include<stdio.h>
main()
{
printf("Hello World!\n");
}

thencompileitusingthefollowingcommand:

$ $IDIR/bin/sslittle-na-sstrix-gcc o hello hello.c

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.

S-ar putea să vă placă și