hw1 - EE108B Spring 2003-2004 Prof Kozyrakis Handout#5...

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

View Full Document Right Arrow Icon
Prof. Kozyrakis Spring 2003-2004 Handout #5 Homework #1 Due Thurs. Apr. 15, 5 PM in Gates 310 Work in groups of 3 students, but turn in only one HW per group. This homework assignment helps you to be familiar with MIPS assembly language. A full reference guide for MIPS instructions is available in section A.10 (Appendix A) of the textbook. A short summary of MIPS instructions is available on the back cover page. 1. [Total 10 points] The following code fragment processes an array and produces two values in registers $v0 and $v1: add $v0, $a1, $zero add $a1, $a1, $a1 add $a1, $a1, $a1 add $t0, $zero, $zero outer: add $t4, $a0, $t0 lw $t4, 0($t4) add $t5, $zero, $zero add $t1, $zero, $zero inner: add $t3, $a0, $t1 lw $t3, 0($t3) bne $t3, $t4, skip addi $t5, $t5, 1 skip: addi $t1, $t1, 4 bne $t1, $a1, inner slt $t2, $v0, $t5 bne $t2, $zero, next add $v0, $t5, $zero add $v1, $t4, $zero next: addi $t0, $t0, 4 bne $t0, $a1, outer Assume that: The array consists of 5000 indexed 0 through 4999 Its base address is stored in $a0 Its size (5000) is stored in $a1 a. [2 points] Describe in one sentence what this code does. Specifically, what will be returned in $v0 and $v1? 1
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.

Page1 / 4

hw1 - EE108B Spring 2003-2004 Prof Kozyrakis Handout#5...

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