recitation_week_7 - loop: li $v0, 2 l.s $f12, 0($t0)...

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

View Full Document Right Arrow Icon
This week, please still try to make sure that every student is able to run SPIM and knows how to debug with it. In there are additional time, please ask them to write a complete program in which two floating point arrays, arry0 and arry1 are given, each with 5 elements. The student is asked to declare another floating point array arry2, in which arry2[i] is set to be the minimum of arry[0] and arry[1]. My code is below: .data arry0: .float 0.6, 0.7, 0.9, 0.1, -0.8 arry1: .float 0.8, 1.9, 11.2, -0.19, 0.7 arry2: .space 20 .text .globl main main: la $a0, arry0 la $a1, arry1 la $a2, arry2 li $a3, 5 jal floatArray done: addi $t0, $a2, 0 addi $t1, $0, 0
Background image of page 1

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

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

Unformatted text preview: loop: li $v0, 2 l.s $f12, 0($t0) syscall li $v0, 4 la $a0, msg_newline syscall addi $t0, $t0, 4 addi $t1, $t1, 1 blt $t1, $a3, loop exit: li $v0,10 syscall floatArray: addi $sp, $sp, -12 swc1 $f0, 8($sp) swc1 $f1, 4($sp) swc1 $f2, 0($sp) addi $t0, $a0, 0 addi $t1, $a1, 0 addi $t2, $a2, 0 addi $t9, $0, 0 floatArrayloop: l.s $f0, 0($t0) l.s $f1, 0($t1) c.lt.s $f0, $f1 bc1t floatArrayskip mov.s $f0, $f1 floatArrayskip: s.s $f0, 0($t2) addi $t0, $t0, 4 addi $t1, $t1, 4 addi $t2, $t2, 4 addi $t9, $t9, 1 blt $t9, $a3, floatArrayloop lwc1 $f0, 8($sp) lwc1 $f1, 4($sp) lwc1 $f2, 0($sp) addi $sp, $sp, 12 jr $ra...
View Full Document

Page1 / 2

recitation_week_7 - loop: li $v0, 2 l.s $f12, 0($t0)...

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