CSCI 530 HW1b SimpleScalar Installation Guide Group-1: Noha El-Kady Rihab El-Kady Sarah Bargal Yomna Ali SimpleScalar Installation Guide SimpleScalar Installation Guide .................................................................................... 2 1 Installation and Configuration ............................................................................... 3 2 Fixing GCC Compilation Errors ............................................................................ 4 3 Running sim-cache................................................................................................. 6 4 Reference ............................................................................................................... 6 5 Appendix ................................................................................................................ 7 5.1 Installing Bison .............................................................................................. 7 5.2 Installation of Flex ......................................................................................... 7 5.3 Installation of M4 ........................................................................................... 8 This guide is for installing SimpleScalar 3.0d on linux machines. It has been tested on both Mandrake Linux 8.0, 9.0 and 10.1. 1 Installation and Configuration Step1 (Download and Untar): 1- Create a folder on your home directory and call it for example simplesim You could use the following command: mkdir simplesim 2- Download the SimpleScalar toolset from www.simplescalar.com and put all files in the folder created above. You need the following files before installation SimpleScalar (simplesim-3v0d) SimpleScalar utilities (simpleutils-990811) http://www.eecs.umich.edu/mirv/software/simpleutils-990811.tar.gz This version of binutils contains the additional instructions for the Inthreads architecture. SimpleScalar tools (simpletools-2v0) GCC (gcc-2.7.2.3) 3- Now suppose all the above downloaded sources are in the directory simplesim, type: “cd simplesim” to stand on the simplesim directory, then untar all the sources by typing: tar xvzf * 4- In simpletools-2v0 directory there is a gcc-2.6.3 compiler. Since we do not need this, delete it: “rm –rf gcc-2.6.3” Step 2 (Environment Setup & Installation): 1- Type the following in the command shell export HOST=i386-unknown-linux export IDIR=/{YOUR PATH HERE}/simplesim Now when you want to go to your simplesim directory, you do not need to type the whole path, you can just type “cd $IDIR” for example. 2- Installing Simpleutils. In the same shell, type: cd $IDIR/simpleutils-990811 ./configure --host=$HOST --target=sslittle-na-sstrix --with-gnu-as --with-gnuld --prefix=$IDIR (same line) make all install The above commands create sslittle-na-sstrix and lib directory in $IDIR. 3- Install SimpleScalar, and configure it to use the PISA instruction set, or any other ISA of your preference cd $IDIR/simplesim-3.0 make config-pisa make make sim-tests Step 4 (Building the SimpleScalar gcc): 1- For any compilation errors, please check the section “Fixing GCC Compilation Errors” below. To build gcc, type the following into the command shell: cd $IDIR/gcc-2.7.2.3 export PATH=$PATH:$IDIR/ sslittle-na-sstrix/bin ./configure –host=i386-*-linux --target=sslittle-na-sstrix --with-gnu-as --withgnu-ld --prefix=$IDIR –enable-languages=c,c++ (same line) make make enquire ../simplesim-3.0/sim-safe ./enquire –f > float.h-cross make install If all went fine so far, then you have a successful SimpleScalar installation, and you can move directly to the section of running sim-cache. If you encountered errors, reference the section below about fixing gcc errors 2 Fixing GCC Compilation Errors 1- Installing simpleutils errors: When installing simpleutils, you may encounter the following error: “undefined command lex”. This means that flex is not installed on your machine. Install the M4 only if it prompts an error for its absence! Download the following files, install them and re-attempt the installation: M4: you can download it from http://www.gnu.org/software/m4/ Bison: you can download it from http://www.gnu.org/software/bison/bison.html#downloading Flex: you can download it from http://www.gnu.org/software/flex/#downloading Once you downloaded them in any directory, untar them using “tar xvzf” as above To install Bison check appendix 3.1 To install Flex check Appendix 3.2 If you faced any compilation errors in the following files ldlex.c and ldlex.l there is a typo there, fix it as follows: /simpleutils-990811/ld/ ldlex.c && ldlex.l static void yy_input (buf, result, max_size) char *buf; int *result; int max_size; { *result = 0; /* old: if (yy_current_buffer->yy_input_file) */ * new: YY_CURRENT_BUFFER is the correct one * as it is the top of the stack */ if (YY_CURRENT_BUFFER->yy_input_file) { if (yyin) { *result = read (fileno (yyin), (char *) buf, max_size); if (*result < 0) einfo ("%F%P: read in flex scanner failed\n"); } } } 2- Fixing gcc errors: Depending on the current native gcc version, you may have encountered the following errors, do the following modifications to the corresponding files to remove them: File Fix gcc-2.7.2.3/insn-output.c Add "\" in rows 675, 750 and 823 sslittle-na-sstrix/include/stdio.h Remove "__NORETURN" in row 167 sslittle-na-sstrix/include/setjmp.h Remove "__NORETURN" in rows 64, 85, 86 and 99 gcc-2.7.2.3/objc/sendmsg.c Insert #define STRUCT_VALUE 0 in row 35 gcc-2.7.2.3/protoize.c Change (Replace) row 60 with #include <stdarg.h> If any other error occurred outside the above list then there are two possibilities: 1- Simpleutils did not install successfully, go back to “Installing simpleutils errors”. 2- The native gcc libraries are not compatible with your sources, and then you need to change the Linux version all together, or compile to support old libraries. 3 Running sim-cache Now that you have installed everything successfully, you can run one of the simulators to check that simplescalar works well. We will attempt to use sim-cache. cd $IDIR/simplesim-3.0 ./sim-cache <arguments> benchmark-name <benchmark-arguments> The above command should either run the benchmark if you gave it the correct parameters, or it should at least list all the options of using sim-cache, if the parameters were not correct. 4 Reference 1- SimpleScalar Project. www.simplescalar.com 2- SimpleScalar Installation FAQ. http://ces.univkarlsruhe.de/~gottfried/simplescalar_faq.htm 3- http://dsl.cs.technion.ac.il/projects/inthread/resources.html 4- Lab8 Install SimpleScalar Tool Set. http://www.cs.ucr.edu/~zhao/cs162_lab8.html 5- Installing Flex-2.5.4a. http://www.linux.com/guides/html/chapter06/flex.shtml 6- Installing Bison-1.875. http://www.linux.com/guides/html/chapter06/bison.shtml 7- Installing M4-1.4. http://www.linux.com/guides/html/chapter06/m4.shtml 5 Appendix 5.1 Installing Bison Bison is a parser generator, a replacement for yacc. Bison generates a program that analyzes the structure of a text file. Prepare Bison for compilation, stand on the directory I which you untared the Bison tar ball, then type in the command shell: ./configure --prefix=/usr Compile the package: make This package has a test suite available which can perform a number of checks to ensure it built correctly. Should you choose to run it, the following command will do so (and takes a long time): make check And install the package: make install 5.2 Installation of Flex The Flex package is used to generate programs which recognize patterns in text. Prepare Flex for compilation: ./configure --prefix=/usr Compile the package: make This package has a test suite available which can perform a number of checks to ensure it built correctly. Should you choose to run it, the following command will do so: make bigcheck And install the package: make install 5.3 Installation of M4 M4 is a macro processor. It copies input to output, expanding macros as it goes. Macros are either built-in or user-defined and can take any number of arguments. Besides just doing macro expansion, m4 has built-in functions for including named files, running Unix commands, doing integer arithmetic, manipulating text in various ways, recursion, etc. The m4 program can be used either as a front-end to a compiler or as a macro processor in its own right. M4 Installation Dependencies M4 depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Perl, Sed. Prepare M4 for compilation: ./configure --prefix=/usr In case it prompts for user privileges switch to the root access and install it! Compile the package: make This package has a test suite available which can perform a number of checks to ensure it built correctly. Should you choose to run it, the following command will do so: make check And install the package: make install