how delayed branching happen in following case?

115 views Asked by At

I have a part of a code in assembly. I want to know how delayed branching happen in following case.

Loop:;*** Compare R1 and R2
seq r3,r1,r2 ;Compiar R1 == R2 ? if yes r3 =1 if not r3 = 0
bnez r3,Result //call a Result label in bellow
sgt r3,r1,r2 ;R1 > R2 ? //first delayed slot
bnez r3,r1Greater

r2Greater:;*** subtract r1 from r2
sub r2,r2,r1
j Loop

r1Greater:;*** subtract r2 from r1
sub r1,r1,r2
j Loop

Result: ;*** Write the result (R1)
multi f3,f1,f2
cvti2f f4,r1
div f3,f3,f4
sw PrintfValue,r1
addi r14,r0,PrintfPar
trap 5

;*** end
trap 0
0

There are 0 answers