<5 points>
| Total points | Explanation |
|---|---|
| 0 | Not handed in |
| 1 | Handed in late |
| 2 | Handed in on time, not every problem fully worked through and clearly identifying the solution |
| 3 | Handed in on time, each problem answered a boxed answer, each problems answered with a clearly worked through solution, and less than majority of problems answered correctly |
| 4 | Handed in on time, majority of problems answered correctly, each solution boxed clearly, and each problem fully worked through |
| 5 | Handed in on time, every problem answered correctly, every solution boxed clearly, and every problem fully worked through. |
1. The Cost of Hardware Execution
Goal: Understand why instruction count in a software emulator like SPIM does not natively equate to physical hardware latency on silicon.
In our analysis of the Quake III Arena Fast Inverse Square Root algorithm, we replaced a standard 2-instruction IEEE-754 sequence (sqrt.s followed by div.s) with a 14-instruction sequence utilizing integer and bitwise manipulation (srl, sub, mul.s).
div.s instruction on 1999 silicon (like the MIPS R4000).2. Exception Handling Architecture
Goal: Identify how the MIPS ISA mechanically handles fatal hardware faults or OS-level interrupts during runtime execution.
When an unaligned memory access (Address Error) or an arithmetic anomaly (Overflow) occurs, standard user-space execution is halted.
.ktext memory segment in capturing and resolving the fault.PC (Program Counter) when SPIM’s exceptions.s kernel handler takes over?3. ISA Design and Bit Constraints
Goal: Evaluate the architectural layout of custom instruction widths for your impending Final Project ISA.
For your Final Project, you are structurally required to design an Instruction Set Architecture (ISA). Assume you are building a strict 32-bit width instruction format similar to MIPS.
You decide you want your CPU to support immediately loading massively large constant numbers directly inside an I-Type instruction. To do this, you assign 24 bits out of the 32 purely to the “Immediate” field.
4. MIPS Dataflow & Recursion
Goal: Solidify execution chains, Stack Pointer ($sp) usage, and Return Address ($ra) logic for the midterm.
A student writes a MIPS procedure that recursively calls itself to calculate the Fibonacci sequence. However, before executing the jal instruction to jump back into its own loop, the student completely forgets to use the $sp (Stack Pointer).
Here is the student’s broken fib procedure:
fib:
# Base cases: if n == 0 return 0, if n == 1 return 1
beq $a0, 0, fib_zero
beq $a0, 1, fib_one
# Missing: addi $sp, $sp, -12
# Missing: sw $ra, 8($sp), sw $s0, 4($sp), sw $a0, 0($sp)
addi $a0, $a0, -1 # n - 1
jal fib # First recursive call
move $s0, $v0 # Store result of fib(n-1) in $s0
addi $a0, $a0, -1 # n - 2 (since $a0 is already n-1)
jal fib # Second recursive call
add $v0, $s0, $v0 # fib(n-1) + fib(n-2)
# Missing: lw $ra, 8($sp), lw $s0, 4($sp), lw $a0, 0($sp)
# Missing: addi $sp, $sp, 12
jr $ra
fib_zero:
li $v0, 0
jr $ra
fib_one:
li $v0, 1
jr $ra
jal executes?jr $ra execution chain when the recursion finally hits its base case and attempts to unfold back to the main procedure.Submit your answers as a PDF or Markdown file via the GitHub Classroom repository link provided directly in Microsoft Teams. Be sure to clearly box your final mathematical outputs where applicable.