-- This program will calculate the GCD of the values stored in inport0 and inport1 Main : -- lw $s0, FFF8($zero) // Load word from the InPort0 to $S0/R16 -- lw $s1, FFFC($zero) // Load word from the InPort1 to $S1/R17 loop: -- beq $s1, $s0, Exit_the_Loop // If $s1 == $s0, Exit the loop -- sltu $t0, $s1, $s0 // if S1 < S0, t0 = 1; else t0 =0 -- bne $t0, $zero, skip // if t0 != 0, branch to skip -- subu $s1, $s1, $s0 // $s1= $s1- $s0 -- j loop // jump to loop skip: -- subu $s0, $s0, $s1 // $s0= $s0 - $s1 -- j loop // jump to loop Exit_the_Loop: -- sw $s0, FFFC($zero) // store s1 to the outport1 End: -- j End // infinite loop