| CS 354, version A Spring 2006 | Name:___________________ ID:___________________ Login:_____________________ | |
| Exam 3 | ||
|
No electronic devices may be used while taking this exam. Examples of devices not allowed are calculators, pagers, cell phones, wrist calculators/computers, laptop computers, pocket computers. Each student is allowed one 8.5 by 11 inch sheet of paper with handwritten notes. The notes may be on both sides of the paper. Show all work, and do any/all calculations on the exam. Extra scratch paper may not be used. |
Exam Score Q1 = _____ / 6 Q2 = _____ / 8 Q3 = _____ / 5 Q4 = _____ / 6 Q5 = _____ / 8 Q6 = _____ / 5 Q7 = _____ / 8 Q8 = _____ / 8 Q9 = _____ / 12 Total = _____ / 58 |
Question 1 (6 points total)
Give a TAL assembly language synthesis for each
of the following MIPS pseudoinstructions.
Assume that label X has been assigned
address 0x00ff3300.
sw $8, X
rem $10, $11, $12
Question 2 (8 points total)
This MIPS code fragment is to be used inside of an extremely simple
kernel (that uses only spin wait loops; no interrupts) to implement the
puts syscall.
_k_put_s: lbu $k0, ($a0)
beqz $k0, _k_exit_put_s
sw $k0, Display_Data
add $a0, $a0, 1
b _k_put_s
_k_exit_put_s:
# "return" from syscall code here
Part A (3 points)
puts syscall.
puts syscall.
Question 3 (5 points) The standard formula for calculating the time it takes to read or write a sector on a disk is
time = seek time + rotational latency + read/write time
Part A (2 points)
Which of these 3 components (most often) takes the longest?
Part B (3 points)
(Briefly) Why?
Question 4 (6 points)
Within our kernel (the one used for Assignment 8), there is code to
extract the cause (ExcCode), and use a switch statement
to effect a multiway branch.
This code is
mfc0 $k0, 13
andi $k0, $k0, 0x3c
lw $k0, _k_JumpTable($k0)
jr $k0
Write a TAL assembly language synthesis of the load (lw)
instruction.
Assume that the label _k_JumpTable is assigned
address 0x810000c0.
Question 5 (8 points) The MIPS assembly language instruction
beq $8, $9, loop25
is assigned by the assembler to reside at address
0x00400a60.
The machine code for this instruction is
0x1109fffa.
Question 6 (5 points)
Classify each of the following events as generating either a trap
or an interrupt.
syscall
add instruction
Question 7 (8 points total)
Part A (4 points)
Was the kernel used for assignment 8 (the logical AND test program)
reentrant or
nonreentrant?
Part B (4 points)
Suppose that a MIPS computer system has a simple, nonreentrant
kernel.
An application has been executing, and the application
executes the syscall instruction.
As the first instruction within the kernel is fetched,
diagram the values in the four (4) least significant
bits of the Status register.
Question 8 (8 points total)
Part A (4 points)
Name the 2 categories of dependencies.
1.
2.
Part B (4 points)
(Briefly) Why does the engineer designing a processor need
to know about dependencies?
Question 9 (12 points total)
The Reallygood Company is putting an L1 cache that
holds only instructions (not data) into their computer
system that has a MIPS processor.
# familiar MAL equivalents in comments
addi $t0, $0, 1000 # li $t0, 1000
addi $t1, $0, -12 # li $t1, -12
addi $t2, $0, 500 # li $t2, 500
loop:
beq $t0, $0, loop_done
mult $t2, $t1
mflo $t3
addi $t3, $t3, 13
div $t3, $t1
mflo $t4
srl $t2, $t1, 4
addi $t0, $t0, -1 # sub $t0, $t0, 1
beq $0 $0, loop # b loop
loop_done: