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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -