midterm_sol_v7 - EE108B Digital Systems II Stanford...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
EE108B: Digital Systems II Midterm Exam Solutions Stanford University Winter 03/04 Feb 5, 2004 EE108B Midterm Exam - SOLUTIONS Exam Instructions Answer each of the questions included in the exam. Write all of your answers directly on the examination paper, including any work that you wish to be considered for partial credit. The examination is open-book, and you may make use of the text, handouts, your own course notes, and a calculator. You may not use a computer of any kind. On equations: Wherever possible, make sure to include the equation, the equation rewritten with the numerical values, and the final solution. Partial credit will be weighted appropriately for each component of the problem, and providing more information improves the likelihood that partial credit can be awarded. On writing code: Unless otherwise stated, you are free to use any of the assembly instructions listed in the Appendix at the back of the book, including pseudoinstructions. You do not need to optimize your MIPS code unless specifically instructed to do so. On style: In writing procedures you should follow the convention for use of all registers across procedure calls. You may use your stack space, however, in whatever manner you wish. On commenting: Comments for MIPS implementation are not strictly required on the exam, but are highly recommended. They may help you receive partial credit on a problem if they help us determine what you were trying to do. On time: You will have two hours to complete this exam. Budget your time and try to leave some time at the end to go over your work. The point weightings correspond roughly to the number of minutes each problem is expected to take. Name (printed) __________________ SOLUTIONS _________________ Leland Username ________________________________________________________ THE STANFORD UNIVERSITY HONOR CODE The Honor Code is an undertaking of the students, individually and collectively: (1) that they will not give or receive aid in examinations; that they will not give or receive unpermitted aid in class work, in the preparation of reports, or in any other work that is to be used by the instructor as the basis of grading; (2) that they will do their share and take an active part in seeing to it that others as well as themselves uphold the spirit and letter of the Honor Code. I acknowledge and accept the Honor Code. Name (signed) __________________________________________________________ Score Grader 1. MIPS ISA 15 ______ ______ 2. MIPS ISA Performance 15 ______ ______ 3. Overflow Implementation 15 ______ ______ 4. ALU Implementation 20 ______ ______ 5. Processor Design 20 ______ ______ 6. Recursive List Search 20 ______ ______ Total (105) _______________ - 1 -
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Problem 1: MIPS ISA (15 points) Consider the following C segment: while (save[i] == k) i = i + j; with i , j , and corresponding to registers $s3 , $s4 , and $s5  and the base of the array saved in $s6 . The assembly code corresponding to this C segment is given as: Loop: add $t1, $s3, $s3 # Temp reg $t1 = 2 * i add $t1, $t1, $t1 # Temp reg $t1 = 4 * i add $t1, $t1, $s6 # $t1 = address of save [i] lw $t0, 0($t1) # Temp reg $t0 = save[i] bne $t0, $s5, Exit # go to Exit if save[i] ¹ k add $s3, $s3, $s4 # i = i + j j Loop # go to Loop Exit: a) [ 5 points ] How many instructions are executed if the number of iterations of the loop is 10?
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/18/2011 for the course EE 108A taught by Professor Dally during the Winter '04 term at Stanford.

Page1 / 14

midterm_sol_v7 - EE108B Digital Systems II Stanford...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online