BNE branch in MIPS assembly -
right i'm preparing test in computer architecture, , being stuck in task don't understand. * $1=4, $2=2, $3=x here's code
loop: addi $2,$2-1 sll $2,$2,2 mult $3,$1 mflo $3 sw $3, 0($2) bne $2,$1,loop
my question is, value $2 have after this? 4 or 4x?
maybe clearer if write out ordinary paper math:
$1 = 4 $2 = 2 $3 = x loop: $2 = $2 -1 $2 = $2 * 2^2 $lo = $3 * $1 $3 = $lo "contents of memory address in $2" = $3 if $2 != $1 goto loop
Comments
Post a Comment