For example the following code will do

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: stack and performing simple comparison. For example, the following code will do the job even without any comparison addi $t0, $0, 0x0001 sw $t0, ‐4($sp) lb $t0, ‐1($sp) Note that stack grows from higher address down and to use stack you have to advance the pointer first, i.e. subtract ‐4 or use immediate offset ‐4. It is unsafe to use stack without advancing the pointer 0($sp) because you may destroy the stored value needed by other part of the program. Page 2 of 6 ECE 154A Fall 2012 Problem #2 (30 points) (a) (20 points) Translate the following MIPS code into equivalent C code addi $v0, $0, 0 Loop: andi $t0, $a0, 1 add $v0, $v0, $t0 srl $a0, $a0, 1 bne $a0,...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online