fa04-sw-sf - ECE 2030 1:00pm 5 problems 5 pages Problem 1(3...

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

View Full Document Right Arrow Icon
ECE 2030 1:00pm Computer Engineering Fall 2004 5 problems, 5 pages Final Exam Solutions 9 December 2004 1 Problem 1 (3 parts, 28 points) MinMax In this problem, you will write a procedure that finds the minimum and maximum values in an array of 250 integers beginning at memory location 0xABC0000. Use only the registers described in the table below plus $0 . Your answer should fit in the boxes provided. Be sure to provide comments. The instruction set is listed in a table on the next page. register description register description $1 array pointer $4 max value $2 end test $5 input value $3 min value $6 predicate Part A (8 points) To begin, write a code fragment that initialize variables before beginning the main loop. label instruction comment MinMax: lui $1, 0xABC # init starting ptr ori $2, $1, 1000 # init end ptr value lw $3, ($1) # init min lw $4, ($1) # init max Part B (14 points) Write a code fragment that loads the next array element and appropriately updates the current min and max value if necessary. label instruction comment Loop: lw $5, ($1) # load input slt $6, $5, $3 # compare input to min beq $6, $0, Skip1 # skip if input >= min add $3, $5, $0 # else update new min Skip1: slt $6, $4, $5 # compare max to input beq $6, $0, Skip2 # skip if max >= input add $4, $5, $0 # else update new max Part C (6 points) Write a code fragment that adjusts the array pointer, loops if necessary, and returns to the caller if done. label instruction comment Skip2: addi $1, $1, 4 # adjust ptr to next input bne $1, $2, Loop # if not end, loop jr $31 # return to caller
Background image of page 1

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

View Full DocumentRight Arrow Icon
ECE 2030 1:00pm Computer Engineering Fall 2004 5 problems, 5 pages Final Exam Solutions 9 December 2004 2 Problem 2 (4 parts, 24 points) Assembly Language
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 06/17/2008 for the course ECE 2030 taught by Professor Wolf during the Fall '07 term at Georgia Tech.

Page1 / 5

fa04-sw-sf - ECE 2030 1:00pm 5 problems 5 pages Problem 1(3...

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