CPSC 213: Assignment 6 Due: Monday, October 24, 2011 at 7am.
Late assignments are accepted until Thursday, October 27 at 7am with a 20% penalty per day (or fraction of a day) past the due date. This rule is strictly applied and there are no exceptions.
Goal
The goal of this assignment is to explore the use of double-indirect jumps to implement polymorphic dispatch and switch statements. You will implement two new instructions, observe the behaviour of two snippets, and crack another mystery program.
Extending the ISA
You will implement two additional instructions.
Code Snippets Used this Week
As explained in detail below, you will use the following code snippet this week. There is a C, Java and SM213 Assembly versions.
• SA-dynamic-call • SB-switch
Requirements
Here are the requirements for this week’s assignment.
1. Implement the double indirect jump instructions listed above and extend your test
program to test them.
2. Execute Snippets A and B in the simulator, step by step. Carefully examine their
behaviour and document the key changes you see to the register-file and memory.
3. Execute the SM213 program A5-c to determine what it does. Explain its behaviour by
giving an equivalent C program and by explaining in plain English what simple computation it performs.
Instruction
Assembly
Format
Semantics
dbl ind jmp b+d
j *o(rt)
dtpp
pc ← m[r[t] + (o == pp*4)]
dbl ind jmp indx
j *(rb,ri,4)
ebi0
pc ← m[r[b] + r[i]*4]
Material Provided
The snippets and mystery programs are provided in the file code.zip.
What to Hand In
Use the handin program. The assignment directory is a6.
1. A single file called “README.txt” that includes your name, student number, four-digit
cs-department undergraduate id (e.g., the one that’s something like a0b1), and all written
material required by the assignment as listed below.
2. Your CPU.java.
3. Your test program and a description of what happens when you run the test.
4. A written description of the key things you noted about the machine execution while
running snippets A and B.
5. A description of the mystery program A5-c that includes (a) an equivalent C program
and (b) a plain-English description.