Friday, 9 August 2013

MIPS Need help in Calculating Branch Target Address

MIPS Need help in Calculating Branch Target Address

Here is a sample code I have written in MIPS to learn how to calculate
branch target address. I assembled the code in Mars 4.3 but I don't
understand how Mars 4.3 found these : 0x00000003 and 0xfffffff4 values for
branch. I already looked at this similar question but formula doesn't
match which with Mars 4.3 or maybe I'm wrong.
.data
read_num_p: .asciiz "Num"
.text
read_num_loop: li $v0, 4 #prompt for number and read input
la $a0, read_num_p
syscall
li $v0, 5
syscall
la $t9,read_num_end
beqz $v0, read_num_end #test for exit
add $t0, $t0, $v0 #add num to total & incr counter
addi $t1, $t1, -1
b read_num_loop
read_num_end:
move $v0, $t0 #Load values to be returned




Also, here is the external link to that screen shot

No comments:

Post a Comment