Computer Architecture project——simplescalar under Ubuntu/在Ubuntu10.04下安装simplescalar第一部分

来源:互联网 发布:租用阿里云vps 编辑:程序博客网 时间:2024/04/30 16:45

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

1uname -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

1export HOST=FROM_ABOVE_OPTION
2export IDIR=/home/YOUR_USER_NAME/simplescalar
3export 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.

1mkdir $IDIR
2cd $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
Sometimes errors occur, what I did is just restarting the terminal and trying this command again. You can use this command as the first step.
Please note, when you enter the passwords,they will not show up in the screen, but actually, they are there.

Installing Simple tools

Just un-pack the package file, and remove the old gcc folder. To do so, use:

1cd $IDIR
2tar xzvf simpletools-2v0.tgz
3rm -rf gcc-2.6.3
These can be done in the folder by yourself. Extract the file and delete gcc-2.6.3

Installing SimpleUtils

First un-pack the package file. To do so, use:

1tar xzvf simpleutils-990811.tar.gz
2cd 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

1find . -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
2make
3make install

Installing Simulator

Un-pack the simulator package.

1cd $IDIR
2tar xzvf simplesim-3v0d.tgz
3cd simplesim-3.0
4make config-pisa
5make

You may test the installation of simplesim by

1$ ./sim-safe tests/bin.little/test-math
0 0