branch Instructions

  • 일반적으로는 순차적인 명령 수행을 위해, RV32I에서는 각 명령 후에 PC가 명령어의 크기만큼(4byte)씩 증가함
  • branch 명령어는 PC가 코드의 섹션을 건너뛰거나 이전 코드를 반복할 수 있도록 함
    • Conditional branch
      • beq (branch if equal) : if (a == b)
      • bne (branch if not equal) : if (a != b)
      • blt (branch if less than) : if (a < b)
      • bge (branch if greater than or equal) : if (a >= b) (단, a, b is signed)
      • bltu (branch if less than for unsigned) : if (a < b) (단, a, b is unsigned)
      • bgeu (branch if greater than or equal for unsigned) : if (a >= b)
    • Unconditional branch (ex. jump)
      • jal (jump and link)
      • jalr (jump and link register)

 


 

beq, bne, blt, bge, bltu, bgeu

 

 


 

slt, sltu, slti, sltiu

 

 

 


 

jal

 

 


 

Procedure (Function)

  • 프로그래머들은 프로그램을 짜기 위해 프로시저(또는 함수)를 사용함
  • 파라미터(인자)는 프로시저와 프로그램의 나머지 부분간의 인터페이스 역할을 함

 

 


 

jal - ret pair

 

 

 


 

jalr (jump and link register)

 

'cs 공부 > 컴퓨터 구조' 카테고리의 다른 글

Lec4. RISC-V Instructions #2  (2) 2023.05.07
Lec4. RISC-V & RISC-V Instructions #1  (0) 2023.04.27
Lec3. Performance  (0) 2023.04.26
Lec2. Instructions and High-level to Machine Code  (0) 2023.04.25
Lec1. Computer and Technology  (0) 2023.04.25

+ Recent posts