hw01(1) - LSU EE 4720 Homework 1 Due: 15 September 2010...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: LSU EE 4720 Homework 1 Due: 15 September 2010 Problem 1: Diagnose or fix the MIPS-I problems below. (a) Explain why the code fragment below will not complete execution. Fix the problem, assuming that the load addresses are correct. (Problems such as this occur when operating on data prepared on a different system.) lw r1, 0(r2) lw r3, 6(r2) (b) The code below will execute, but it looks like there might be a bug. Explain. jal subroutine add r31, r0, r0 (c) The two fragments below are almost but not quite MIPS-I. Re-write them using MIPS instructions so they accomplish what the programmer likely intended. # Fragment 1 lw r1, 0(r2+r3) # Fragment 2 bgti r1, 101 nop target (d) The code fragments below are correct, but not as efficient as they could be. Re-write them using fewer instructions (and without changing what they do). # Fragment 1 addi r1, r0, 0xaabb sll r1, r1, 16 ori r1, r1, 0xccdd # Fragment 2 add r1, r0, r0 addi r1, r1, 123 1 ...
View Full Document

This note was uploaded on 12/11/2011 for the course EE 4720 taught by Professor Staff during the Fall '08 term at LSU.

Ask a homework question - tutors are online