My first mission is installing simplescalar. And before that I need a linux. And before that, I need a visual machine :(
So I just use the VMware-workstation-full-v7.1.4.zip. I believe this software can be easily found everywhere. But because of the ip problem,I cannot download this software free, my father helped me to do this and sent it to me via QQ.... The good thing is that everything about VM goes smoothly. And then ,I installed Ubuntu10.04, which you can find here :
http://www.ubuntu.com/download/ubuntu/download
Also, it only takes no more than one hour for me, although some of my classmates faced the problem that the Ubuntu cannot connected to the Internet.
Now comes Simplescalar. Here is a great video teaching how to install simplescalar under Ubuntu.
http://www.igoy.in/simplescalar-installation-video/
If you follow the video step by step and make every stage right, then congratulation! However, there are still some parts unclear in the video, especially to the beginner of Linux,like me. I tried four times and finally made it. So I made some changes, add some code and explanation to make it easier to understand. The changes and explanation made by me are in a different color. If you have read the original blog and faced some problems, you can just look for these color.
Download the necessary Source code files.
(Just for precaution, I’ve uploaded to my web-host in case the actual source is not available. The link igoY.in directs to my host space)
Simpletools-2v0.tgz – igoY.in | Simplescalar.com
Simplesim-3v0d.tar.gz – igoY.in | Simplescalar.com
Simpleutils-990811.tar.gz – igoY.in | Simplescalar.com
Gcc-2.7.2.3.ss.tar.gz – igoY.in
Setting up environment
Open up the terminal and type
1 | uname -a |
You will get to know your kernel version and the type of linux installed (i386/i686)
Depending on that change the Host id below as either
HOST=i686-pc-linux or HOST=i386-pc-linux
1 | $ export HOST=FROM_ABOVE_OPTION |
2 | $ export IDIR=/home/YOUR_USER_NAME/simplescalar |
3 | $ export TARGET=sslittle-na-sstrix |
(If you use tcsh or the like, the only difference should be in how environment variables are set.)
Create the directory “simplescalar” under your home directory and copy all the four tar files into it. To do so, use the following commands.
1 | $ mkdir $IDIR |
2 | $ cd $IDIR |
Make sure you have installed the following packages
- flex
- bison
- build-essential
You can use the command “sudo apt-get install <PACKAGE_NAME>” to retrieve and install these packages.
1 | $ sudo apt-get install flex bison build-essential |
Installing Simple tools
Just un-pack the package file, and remove the old gcc folder. To do so, use:
1 | $ cd $IDIR |
2 | $ tar xzvf simpletools-2v0.tgz |
3 | $ rm -rf gcc-2.6.3 |
Installing SimpleUtils
First un-pack the package file. To do so, use:
1 | $ tar xzvf simpleutils-990811. tar .gz |
2 | $ cd simpleutils-990811 |
Before building the code, you need to fix some sources of errors. In directory ld find file ldlex.l and replace all instances of
yy_current_buffer with YY_CURRENT_BUFFER.
You may either do it manually by opening the respected file and renaming it or to make it simple just type this code
1 | $ find . - type f -print0 | xargs -0 sed -i -e ’s,yy_current_buffer,YY_CURRENT_BUFFER,g’ |
1 | $ ./configure –host=$HOST –target=$TARGET –with-gnu-as –with-gnu-ld –prefix=$IDIR |
2 | $ make |
3 | $ make install |
Installing Simulator
Un-pack the simulator package.
1 | $ cd $IDIR |
2 | $ tar xzvf simplesim-3v0d.tgz |
3 | $ cd simplesim-3.0 |
4 | $ make config-pisa |
5 | $ make |
You may test the installation of simplesim by
1 | $ ./sim-safe tests/bin.little/ test -math |