SimpleScalar Installation
--
ToanMai - 2011-03-05
The following text shows how to install SimpleScalar on x86_64 Linux System.
It works on our system:
- OS: CentOS 5.4
- CPU: Intel(R) Xeon(R) CPU E5530 @2.4Ghz
Before installing
You need the following files:
The following packages should also be already installed on your systems:
- flex
- "Development Tools" (on CentOS, or build-essential on Debian systems).
Installation
Assume that we need to install SimpleScalar in our home directory /home/me.
- Create a directory named 'simplescalar' there:
- $ cd /home/me
- $ mkdir simplescalar
- Download and put all the above necessary files to /home/me/simplescalar
- Extracts those files:
- $ tar -xzf simplesim-3v0d.tgz
- $ tar -xzf simpletools-2v0.tgz
- $ tar -xzf gcc-2.7.2.3.ss.tar.gz
- $ tar -xzf simpleutils-990811.tar.gz
- The following files/directories should now can be seen in your folder:
- f2c-1994.09.27
- gcc-2.6.3 (can be deleted since we do not use it)
- gcc-2.7.2.3
- glibc-1.09
- simplesim-3.0
- simpleutils-990811
- ssbig-na-sstrix
- sslittle-na-sstrix
- Readme.gcc-2.7.2.3
- For the ease of the next steps, we should export some variables as follows:
- $ export HOME=i686-pc-linux
- $ export TARGET=sslittle-na-sstrix
- $ export IDIR=/home/me/simplescalar
Building GNU Binary Utilities
- $ cd $IDIR/simpleutils-990811
- $ ./configure --host=$HOST --target=$TARGET --with-gnu-as --with-gnu-ld --prefix=$IDIR
- You may encounter the error: './configure: line 2274: flex: command not found'.
- Just install 'Flex' on your system and make it visible to the PATH variable and run ./configure again.
- $ make
- You may encounter the error: 'ldlex.l:589: error: `yy_current_buffer' undeclared (first use in this function)'.
- In the file ldlex.l, at line 588, replace yy_current_buffer with YY_CURRENT_BUFFER. Then run make again.
- $ make install
Building The Simulators
- $ cd $IDIR/simplesim-3.0
- $ make config-pisa
- $ make
Building the GCC Cross-compiler for SimpleScalar
This is a pretty complicated part because several errors would probably occurs.
- $ cd $IDIR/gcc-2.7.2.3/
- $ ./configure --host=$HOST --target=$TARGET --with-gnu-as --with-gnu-ld --prefix=$IDIR
- To avoid some errors related to unnecessary 32-bit stuffs (like stubs-32.h, etc), we should
- Also, we should append '-I/usr/include' to the end of line 130 of the Makefile.
- $ make LANGUAGES='c c++' CFLAG='-O3' CC='gcc'. We have encountered the following errors at this step:
- insn-output.c:675:10: missing terminating " character...
- To solve: append the back slash '\' to the end of lines 675, 750 and 823 of the file insn-output.c. Run 'make LANGUAGES....' again
- The next error is about the 'invalid lvalue in increment' in the file decl.c.
- To solve: open the file obstack.h, at line 345
- replace *((void *)__o->next_free)++=((void )datum); * with
- *((void *)__o->next_free++)=((void *)datum); * Run 'make LANGUAGES...' again
- $ make LANGUAGES='c c++' CFLAG='-O3' CC='gcc' install
Simple Scalar has now been installed. We should add the paths to it's tools, utils and compilers to $PATH.
- $ export PATH=$PATH:$IDIR/bin:$IDIR/simplesim-3.0:$IDIR
Test
- Create a new hello.c file:
- #include <stdio.h>
int main (void) {
printf ("Hello \n");
return 0;
}
- Compile it with the Cross-compile of Simple Scalar:
- $ sslittle-na-sstrix-gcc –o hello hello.c
- Simulate the program with sim-safe:
- $ sim-safe
- The simulation results are printed to the screen:
The installation is successful!
References
-
http://simplescalar.com/docs/install_guide_v2.txt
-
http://www.seas.gwu.edu/~cheng/211/Projects/SimpleScalar/simplescalar-linux-install.txt
-
and some other forums for fixing errors
-