



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




5 problems, 7 pages Final Exam 13 December 1999
Instructions: This is a closed-book, closed-note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. For maximum credit, show your work.
Good Luck!
Your Name ( please print ) ________________________________________________
Your Lecture Time ( circle one ) MWF 1:00pm MWF 2:00pm
1 2 3 4 5 total
5 problems, 7 pages Final Exam 13 December 1999
Problem 1 (3 parts, 30 points) Art of the State
Part A (10 points) Implement a transparent latch using only six two-input NOR gates. Label the inputs In and En , and the output Out. No other gates should be used.
Part B (10 points) Implement register with write enable using transparent latches, NAND gates, and inverters. Use an icon for the transparent latches. Label the inputs In , WE, ΦΦΦΦ 1 , ΦΦΦΦ 2 and the output Out.
Part C (10 points) Assume the following signals are applied to your register. Draw the output signal Out. Draw a vertical line where In is sampled. Assume Out starts at zero.
Φ 1
Φ 2
WE
In
Out
5 problems, 7 pages Final Exam 13 December 1999
Problem 3 (1 part, 10 points) Simplification
Part A (10 points) For the following expression, derive a simplified product of sums expression using a Karnaugh Map. Circle and list the prime implicants, indicating which are essential. Then write the simplified POS expression.
F = AB + BCD + BC + C D
simplified POS expression
instruction example meaning add add $1,$2,$3 $1 = $2 + $ subtract sub $1,$2,$3 $1 = $2 - $ add immediate addi $1,$2,100 $1 = $2 + 100 multiply mul $1,$2,$3 $1 = $2 * $ divide div $1,$2,$3 $1 = $2 / $ and and $1,$2,$3 $1 = $2 & $ or or $1,$2,$3 $1 = $2 | $ and immediate andi $1,$2,100 $1 = $2 & 100 or immediate ori $1,$2,100 $1 = $2 | 100 shift left logical sll $1,$2,5 $1 = $2 << 5 shift right logical srl $1,$2,5 $1 = $2 >> 5 load word lw $1,100($2) $1 = memory [$2 + 100] store word sw $1,100($2) memory [$2 + 100] = $ load upper immediate lui $1,100 (^) $1 = 100 x 2 16 branch if equal beq $1,$2,100 if ($1 = $2), PC = PC + 4 + 100 branch if not equal bne $1,$2,100 (^) if ($1 ≠ $2), PC = PC + 4 + 100 set if less than slt $1, $2, $3 if ($2 < $3), $1 = 1 else $1 = 0 set if less than immediate slti $1, $2, 100 if ($2 < 100), $1 = 1 else $1 = 0 jump j 10000 PC = 10000 jump register jr $31 PC = $ jump and link jal 10000 $31 = PC + 4; PC = 10000
5 problems, 7 pages Final Exam 13 December 1999
Problem 4 (5 parts, 40 points) Assembly Language Programming
Consider the following MIPS program fragment. The attached sheet lists the instruction set.
address label instruction 1000 start: addi $1, $0, 496 1004 add $2, $0, $ 1008 loop: lw $3, 5000($1) 1012 slt $4, $3, $ 1016 beq $4, $0, skip 1020 sub $3, $0, $ 1024 skip1: add $2, $2, $ 1028 addi $1, $1, - 1032 slt $4, $1, $ 1036 beq $4, $0, loop
Part A (10 points) What operation does the code fragment at addresses 1012, 1016, and 1020 perform?
Part B (10 points) How many times is the loop body in this program fragment executed?
number of loop iterations:
Part C (5 points) What is the branch offset (in bytes) of the BEQ instruction at address 1036.
branch offset (in bytes)
Part D (10 points) What is the purpose of register $2 (i.e., what is the significance of its value when the fragment completes)?
Part E (5 points) What instruction would we add to the end of this fragment if we wanted to use it as a subroutine? NOTE: specify both the instruction name and operand.
5 problems, 7 pages Final Exam 13 December 1999
memory
register file 32 x 32
5 5 5
rwe
X Y Z
au en
-a/s arithmetic unit
sign extender
im en im va
lu en
logical unit
lf 4
addr
data
r/-w msel
st en
ld en
shift types 0 = logical 1 = arithmetic 2 = rotate
logical functions X Y out 0 0 lf 0 1 0 lf 1 0 1 lf 2 1 1 lf 3
cycle cycle number X register driven onto X bus Y register driven onto Y bus Z register written from Z bus rwe register write enable im en immediate enable on Y bus im va immediate value
au en arithmetic unit enable -a/s -add / sub (0 = add, 1 = subtract) lu en logical unit enable lf logical function su en shift unit enable st shift type ld en load enable st en store enable r/-w read/-write (0 = write, 1 = read) msel memory select description operation description
su en
shift unit
st 2
count
16
32