Saturday, October 18, 2008

Installing Simplescalar

Note: If you have 64-bit processor install VMware on your OS and then install Linux on that virtual machine. SimpleScalar gcc (gcc 2.6.3) gives segmentation fault on 64-bit architecture.

Ubuntu for VMware :

Here is the procedure I used ..

1) on Ubuntu (or whichever Linux you use) first do--

sudo apt-get update

2) Getting required applications

sudo apt-get install flex-old bison gedit

3) Start extraction

mkdir /tmp/simplescalar
cd /tmp/simplescalar/
tar xvfz simplescalar.tgz

  4) Install gcc 3.3 (Required)
sudo apt-get install g++-3.3 gcc-3.3 
export CC="gcc-3.3"; 

 5) setting up installation
export HOST=i686-unknown-linux 
export TARGET=sslittle-na-sstrix export 

 6) Simplescalar tools
cd /tmp/simplescalar tar xvfz simpletools-2v0.tgz 
rm -rf gcc-2.6.3
 sudo mkdir -p /opt/simplescalar
sudo mv f2c-1994.09.27/ glibc-1.09/ ssbig-na-sstrix/ sslittle-na-sstrix/ /opt/simplescalar/

7) Simplescalar utils 
cd /tmp/simplescalar 
tar xvfz simpleutils-990811.tar.gz
cd /tmp/simplescalar/simpleutils-990811  
./configure --host=$HOST --target=$TARGET --with-gnu-as --with-gnu-ld --prefix=$IDIR 
make CC=gcc-3.3 
sudo make install CC=gcc-3.3

8) Simplescalar!!

cd /tmp/simplescalar 
tar xvfz simplesim-3v0d.tgz
cd simplesim-3.0 
make config-pisa
make CC=gcc-3.3

>>You will get "My work is done here" :)
cd /tmp/simplescalar sudo mv simplesim-3.0 /opt/simplescalar
  9) Now the hard part

cd /tmp/simplescalar/ tar xvfz
 cd /tmp/simplescalar/gcc- 
export PATH=$PATH:$IDIR/sslittle-na-sstrix/bin
./configure --host=$HOST --target=$TARGET --with-gnu-as --with-gnu-ld --prefix=$IDIR  
make LANGUAGES="c c++" CFLAGS=-O3 CC=gcc-3.3
>>>>Error! Many errors about \ missing in insn-output.o
gedit insn-output.c 

>>>> Edit file insn-output.c and add a \ (backslash) at the end of lines 675, 750, and 823.
make LANGUAGES="c c++" CFLAGS=-O3 CC=gcc-3.3
 >> Error! about libgcc2.a
gedit Makefile
 >>Edit file Makefile and add -I/usr/include to the end of line 130.
make LANGUAGES="c c++" CFLAGS=-O3 CC=gcc-3.3
sudo cp patched/sys/cdefs.h /opt/simplescalar/sslittle-na-sstrix/include/sys/
make enquire CC=gcc-3.3
/opt/simplescalar/simplesim-3.0/sim-safe ./enquire -f > float.h-cross
sudo make install LANGUAGES="c c++" CFLAGS=-O3 CC=gcc-3.3 PATH=$PATH:/opt/simplescalar/bin

>>>>Update from Tim
>>>>I ran into an additional issue during step nine with cxxmain.c.
>>>>For some reason the code redefines malloc.

>>>>To fix, just comment out lines 2978‐2979 and the compilation should continue.
>>>>Thanks Tim

 10) Testing the installation!!!
cd /tmp/simplescalar /opt/simplescalar/bin/sslittle-na-sstrix-gcc hello.c
 /opt/simplescalar/simplesim-3.0/sim-safe a.out 

Happy simulating!!

I have referred to : -

And a lot more..