InClassActivity04-sol - 2/4/02 12:38 PM SOLUTIONS Activity...

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

View Full Document Right Arrow Icon
2/4/02 12:38 PM ECSE-2660 Computer Architecture, Networks, & Operating Systems, Spring 2002 Page 1 of 2 SOLUTIONS Activity #04 Last Name First Name Student ID Number email 4.1 4.2 Total Grader Initials 50 points 50 points 100 points Activity 4.1 (First hour) 1(40) . (a) (10) Translate the C statement a = ( b + c ) to MIPS code. Assume that a, b, c are associated with registers $s1, $s2, $s3 , respectively. add $s1,$s2,$s3 # $s1=b+c Grading: 10 pts for correct, 5 for valid instruction (b) (10) Translate the C statement a = ( b-c )+( b+d ) to MIPS code without using any temporary registers. Assume that the addresses of a, b, c, d are in registers $s0, $s1, $s2, $s3 , respectively. You will need 3 instructions: b+b; b+b-c; b+b-c+d. add $s0,$s1,$s1 # $s0=b+b sub $s0,$s0,$s2 # $s0=$s0-c=b+b-c add $s0,$s0,$s3 # $s0=$s0+d=b+b-c+d Grading: 10 for correct, 5 for any syntactically correct code. The operations can be done in any order. (c) (20) Translate the C statement
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/25/2010 for the course ECSE ecse-2340 taught by Professor Wozny during the Spring '09 term at Rensselaer Polytechnic Institute.

Page1 / 2

InClassActivity04-sol - 2/4/02 12:38 PM SOLUTIONS Activity...

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

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