



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, 6 pages Final Exam 2 May 2001
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. Please work the exam in pencil and do not separate the pages of the exam. For maximum credit, show your work. Good Luck!
Your Name ( please print ) ________________________________________________
1 2 3 4 5 total
5 problems, 6 pages Final Exam 2 May 2001
Problem 1 (3 parts, 30 points) Counters
Part A (10 points) Design a toggle cell using transparent latches, 2-input XOR gates, and 2-input basic gates (AND, OR, NAND, NOR, and NOT). Include a toggle enable TE, active low clear CLR, and a two-phase non-overlapping clock PHI1 and PHI2. Label the output OUT.
Part B (10 points) Now use copies your toggle cells (in icon form) to build a divide by eight counter. This design should include an active high external count enable CE and an active high external clear CLR. You do not need to draw in the clock signals. Assume all toggle cells are connected to the two-phase clock. Label all of your output signals.
5 problems, 6 pages Final Exam 2 May 2001
Problem 3 (1 part, 50 points) Assembly Language In this problem, you will write a procedure that computes the minimum value of a ten-element array. The array begins at base address 200 and each element of the array is one word long. Use only the registers described in the table below. You should not require any registers in addition to those listed. Do not include assembler directives. Your answer should fit in the boxes provided. Be sure to provide comments. The instruction set is listed in a table on the following page.
register description register description $0 zero (immutable) $3 branch predicate register $1 address of current element $4 value of current element of array $2 min value found so far $31 return address
To begin, initialize the element address register ($1) to the address of the first element of the array and initialize $2 to the first element of the array.
label instruction comment min:
Write a code fragment that updates the element address register ($1) to the address of the next element of the array. Then access the value of the current element and replace the minimum value found so far ($2) if necessary.
label instruction comment loop:
Finally, write a code fragment that loops until the final array element has been processed. Following the final iteration, leave the result in $2 and return to the caller via the return address in $31.
label instruction comment skip:
5 problems, 6 pages Final Exam 2 May 2001
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, ($2) $1 = memory [$2] store word sw $1, ($2) memory [$2] = $ 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
Problem 4 (4 parts, 20 points) Arithmetic
For each problem below, (a) compute the operations using the rules of subtraction, (b) indicate whether an error occurs assuming all numbers are expressed using a four bit two’s complement representation, and (c) indicate whether an error occurs assuming all numbers are expressed using a four bit unsigned representation.
subtraction result signed error? unsigned error?