B-types
-
Instructions for Making DecisionsComputer Science/Computer Architecture and Organization 2021. 4. 26. 22:40
If-then-else 컴퓨터와 단순 계산기와 다른점은 바로 판단할 수 있는 기능이다. input과 계산된 결과값에 따라서 컴퓨터는 다른 instruction을 수행할 수 있다. 주로 Java나 C와 같은 high-level programming language에서는 if statement를 이용한다. (때로는 go to도 사용한다). RISC-V assembly language는 go to 가 있는 if statement와 비슷한 두개의 decision-making instructions, 즉 판단 명령어가 있다. 첫번째로는 다음과 같다. beq rs1, rs2, L1 rs1의 값이 rs2의 값과 같으면, L1에 해당하는 문장으로 가라는 뜻이다. beq는 branch if equal 을 의미한다. 다..