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
This note was uploaded on 07/08/2013 for the course ECE 154A taught by Professor Strukov during the Fall '12 term at UCSB.
- Fall '12
- Computer Architecture