This preview shows page 1. Sign up to view the full content.
Unformatted text preview: addi $a0, $a0, 1 Ans: The instruction memory is accessed four times (as there are four instructions) and the data memory is accessed twice (once for the lw instruction and another time for the sw instruction). Question 3: (5 points) Instead of using a special hardware multiplier, it is possible to multiply two numbers using shift and add instructions. Suppose we want to put 5 times the value of $s0 into $s1, ignoring any overflow that may occur. Show a minimal sequence of MIPS instructions for doing this without using a multiply instruction. Ans: sll $s1, $s0, 2 addu $s1, $s0, $s1...
View Full Document
This document was uploaded on 10/20/2011.
- Fall '09