NOTE: if you are having trouble compiling binutils or gcc there is a precompiled (Linux) version of the tools-install directory available in ece412-precompiled-tools.tar.gz. Untar it in your build-ece412/ directory and then run make only in build/tools-build/sim and build-ece412/build.
Download the tarball: ece412-hw1.tar.gz.
Unpack the tarball by running the command:
This will create a source directory named "ece412". The source directory has the following structure:
+--- ece412 +---- tools +-------- binutils (the assembler and linker) | +-------- gcc (the compiler) | +-------- sim (the simulator +---- target-env +--- include (standard include files) +--- lib (libc and libm) +--- apps +--- test (a very simple program) +--- lzw (an interesting program) +--- parser (a long running program) +--- mcf
Create a build directory and set it up:
This will create the build directory tree and a set of symlinks so that you can compile all the tools.
+--- ece412 +---- tools +-------- binutils (the assembler and linker) | | +-------- gcc (the compiler) | | +-------- sim (the simulator | +---- target-env +--- include (standard include files) | +--- lib (libc and libm) | +--- apps +--- test (a very simple program) | +--- lzw (an interesting program) | +--- parser (a long running program) | +--- mcf +--- build-ece412 +---- tools-build +---- binutils (the build directory for ece412/tools/binutils) | +---- gcc (the build directory for ece412/tools/gcc) | +---- sim (the build directory for ece412/tools/sim) +----build +---- lib (the build directory for ece412/target-env/lib) +---- apps (the build directory for ece412/tools/apps)
Run make in the build-ece412 directory:
This builds the assembler, linker, compiler, simulator and runtime library, and installs them all in the directory build-ece412/tools-install.
Compile and run a program:
(lzw is a version of the unix compress program. It creates a buffer of random text, then compresses and decompresses the text). While it is running it prints out the random text and then some statistics:
Files both have length 802 Characters match. Number of cycles run: 2181239 Number of instructions: 1161166 CPI: 1.878490
Make changes to the simulator. The simulator code is in the directory ece412/tools/sim. For the first assignment you will mainly be modifying the file ifetch.h. To rebuild the simulator go to the directory build-ece412/tools/sim and type make.
The simulator you are given models a single-issue pipelined processor. The instruction fetch mechanism, however, does not deliver the instruction bandwidth required to keep the rest of the pipeline busy. This assignment asks you to reimplement the instruction fetch stage so that it delivers instructions at a sufficient rate.
The current structure of the instruction fetch unit includes an "instruction cache" that consists of a single 128-byte line, and all branches are predicted to be not taken.
You may work alone or in groups of 2, 3 or 4. Each group should turn in a short (2-4 pages) report on what you implemented and what you learned. You should address questions like the following: What did you try that didn't work? How did you fix it? What features of your final implementation would you change or fix if you had more time? What design decisions did you make early in the process that made later changes difficult? How do you know your implementation is correct (doesn't produce wrong results?) Which of the changes you made were most and least effective? For those features that weren't very effective, why do you think they didn't work very well?