Spring2001Final_sol - add $a1,$s1,$0 # move b to argument...

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

View Full Document Right Arrow Icon
ECE 2030 Final Exam Spring 2001 Dr. Heck Solutions
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 8 (22 Points): This is not a short answer type of question. Put your answers in the space provided here. Use the procedure call convention given in the test for naming your registers (for example, use the notation add $s0,$s0,$s1 instead of add $16,$16,$17). Part A) Write the assembly code program that would compute the average of 8 numbers. These numbers are stored in the following memory locations: 0x1000, 0x1004, 0x1008, 0x100C, 0x1010, 0x1014, 0x1018, 0x101C. add $s0,$0,$0 addi $t0,$0,0x1000 addi $t1,$0,0x101c loop: lw $t2,$t0 add $s0,$s0,$t2 addi $t0,$t0,0x04 slt $t3,$t1,$t0 beq $t3,$0,loop sai $s0,$s0,0x3
Background image of page 2
Part B) Write the assembly code that implements the following pseudo-code: Main routine: a = 10; b = 15; c = max(a,b) Subroutine max: if (a b) c = b else c = a return c main: addi $s0,$0,10 # init a = 10 addi $s1,$0,15 # init b = 15 add $a0,$s0,$0 # move a to argument list
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: add $a1,$s1,$0 # move b to argument list jal max add $s2,$v0,$0 # save result in $s2 max: slt $t0,$al,$a0 # set if b<a bne $t0,$0,else # branch if b<a add $v0,$a1,$0 # return c = b jr $ra else: add $v0,$a0,$0 # return c = a jr $ra Answer Sheet: Problem 1 Part A) ___F______ Part B) ___F______ Part C) ___F______ Part D) ___F______ Part E) ___T______ Problem 2 Part A) ____ D C E D C B + + + + A ______ Part B) ____22______ Problem 3 _____D______ Problem 4 Part A) _____25_____ Part B) _____2_____ Part C) _____2 to 4_____ Part D) ____32_____ Part E) _____2 26 _____ Problem 5 Part A) ____011110___ Error? __yes__ Part B) ____010000___ Error? __no__ Part C) ____167.5___ Part D) ____B7F____ Problem 6 Part A) ____mux______ Part B) __full adder Problem 7 Part A) addi $16,$0,0x4 Part B) ori $16,$16,0xFF Part C) xor $16,$16,$17 Part D) lw $16,$8 Part E) 0xF Part F) 0x01 Part G) 0x09 Problem 8: Mark answers on space provided on that page....
View Full Document

This note was uploaded on 10/26/2011 for the course ECE 2030 taught by Professor Wolf during the Spring '07 term at Georgia Institute of Technology.

Page1 / 4

Spring2001Final_sol - add $a1,$s1,$0 # move b to argument...

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

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