YYYEJI

[MIPS] Unconditional Branch Instructions (Jump etc.) 본문

Computer architectures

[MIPS] Unconditional Branch Instructions (Jump etc.)

YEJI ⍢ 2022. 9. 25. 11:51
728x90

JUMP - 16bits

새로운 target 주소(PC)로 점프하는 instruction입니다.

Ex) J label → PC = target address

(Memory addressing mode와 굉장히 밀접한 관련이 있다.)

 

op = 2 word address

(Jump instruction의 op code는 2)

 

 

 

Jump Register  - 26bits

JR  $ra              # PC  ←  $ra

( $ra  → 31 register)

op = 0 rs = 31 rt = 0 rd = 0 shamt = 0 func = 8

(R type 이기 때문에 op code는 0)

(function code가 8이면 JR instruction)

($ra가 31번째 있기 때문에 rs가 31번)

(나머지는 0으로 채워줌)

 

 

 

 

Jump and Link - 32bits

JAL label         # $ra ← PC; PC ← Target address

op = 3 word address

(PC에 값을 $ra에 잠깐 보관해두고, PC 값 target address니까 target addreess로 점프)

 

 

 

 

◡̈