In this lab, you will be implementing two simulators:
• psim, a standalone simulator for the PIPE implementation of the Y86-64 instruction set architecture
(ISA), assuming an ideal memory system; and
• pcsim, an integrated “PIPE-with-CACHE” simulator, by implementing a cache simulator csim,
enhancing psim to handle variable delays in the memory stage, and connecting them to each other,
producing a simulator for the PIPE implementation of the Y86-64 ISA with a realistic memory hier
For reference, we are also providing you with the source code for ssim, a standalone simulator for the
SEQ implementation of the Y86-64 ISA.
Outcomes you will gain from this lab include the following:
• You will understand how the SEQ implementation of Y86-64 works. You will understand the utilities
of each stage and how they are connected to each other.
• You will understand how the PIPE implementation of Y86-64 works. You will understand how
stalling, squashing, and forwarding help handle different hazard conditions.
• You will understand the impact that cache memories can have on the performance of programs.
• You will understand the additional changes that need to be made to the PIPE implementation to ac
commodate a realistic memory hierarchy.
3 Download and Setup
1. On your local machine, download the file SE-handout.tar from the Assignment 5: SE + WU-SE
folder in the Files tab of the Canvas page for the class. Then use Linux command scp to copy the
tarball over to your account on a lab machine.
2. Use tar xvf SE-handout.tar on the lab machine to extract the contents of the tarball into
the directory SE-handout. Then navigate to the root directory and create a new git repository
with command git init. Use git add to add at least these files required for submission:
pipe/psim.c, cache/cache.c, pipe-cache/pcsim.c, y86-code/myprog.ys.
3. Create a new private repository in your GitHub account named SE-Lab and link it to your local
repository. You should know how to do this from previous assignments.
4. From the project root directory, run make to compile all the y86 modules and utility programs (see
details below). Alternatively, you can use bash all.sh to run tests along with the compilation,
but a lot of failure messages will pop up, since the simulators haven’t been implemented yet.
4 Assignment Details
4.1 Repository Structure
Now that you have your private repository of the code base, confirm that you have the following subdirec
• misc: Source code files for utilities such as yas (the Y86-64 assembler) and yis (the Y86-64 in
struction set simulator). It also contains the isa.c source file that is used by all of the processor
• seq: Source code for the SEQ simulator. This is solely for your reference. See file README for
instructions on compiling and using the simulator.
• pipe: Source code for the PIPE simulator. You will modify psim.c to complete this simulator in
Part A. See file README for instructions on compiling and using the simulator.
• cache: Source code for the CACHE simulator. You will modify cache.c to complete this simulator
in Part B. csim simulates a cache controller, and is tested using the test-csim executable.
• pipe-cache: Source code for the “PIPE-with-CACHE” simulator. You will modify cache.c and
pcsim.c to complete this simulator in Part B. See file README for instructions on compiling and
using the simulator.
• y86-code: Y86-64 assembly code for some of the example programs shown in CS:APP3e Chapter
4. You can automatically test your SEQ and PIPE simulators on these benchmark programs. See file
README for instructions on how to run these tests.
• ptest: Scripts that generate systematic regression tests of the different instructions, the different jump
possibilities, and the different hazard possibilities. These scripts are very good at finding bugs in your
implementation. See file README for instructions on how to run these tests.
4.2 Utility Programs
The misc directory contains two useful programs:
• yas: The Y86-64 assembler. This takes a Y86-64 assembly code module (a text file with extension
.ys) and generates a Y86-64 object module (a “binary” file 1 with extension .yo). The easiest way
to invoke the assembler is to use or create assembly code files in the y86-code subdirectory. For
example, to assemble the program in file prog1.ys in this directory, use the command:
linux> make prog1.yo
Note: The yas binary is pre-compiled and is only guaranteed to work on the UTCS x86-64 Linux
• yis: The Y86-64 ISA simulator. This program interprets the instructions in a Y86-64 machine-level
program according to the instruction set definition, and is the “gold standard” IaaT definition of in
struction semantics that your simulators must replicate accurately. To run the program prog.yo
from within the subdirectory y86-code, simply run:
linux> ../misc/yis prog.yo
yis simulates the execution of the program and then prints changes to any registers or memory
locations on the terminal, as described in CS:APP3e x4.1. For your convenience, yis also prints out
any intermediate changes for each step