Spring2001Final_sol

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

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

ECE 2030 Final Exam Spring 2001 Dr. Heck Solutions

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

View Full Document
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

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

View Full Document
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

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online