architecture - Incrementing program counter on branch address -
how increment program counter using mips instruction? have code below:
if (r[rs] > 0) r[rs] = r[rs] - 1 else pc = pc + 4 - branch address
so far think works:
slt $t0, $rs, $rt #this pseudoinstruction translation r[rs] > 0 bne $t0, $zero, else add $rs, $rs, -1 #add -1 $rs decrement else: #do here: maybe jump branch address? jr branch address how branch address?
slt $t0, $rs, $rt #this pseudoinstruction translation r[rs] > 0 bne $t0, $zero, else add $rs, $rs, -1 #add -1 $rs decrement b endif else: # else endif: # rest of program
Comments
Post a Comment