risc-v
-
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 을 의미한다. 다..
-
Logical OperationsComputer Science/Computer Architecture and Organization 2021. 4. 25. 18:39
Operations 워드 전체에 대한 처리뿐만 아니라, 일부 비트들 또는 워드내에 8bit로 저장된 문자를 검사하는등의 작업또한 필요했다. 여러개 비트들을 워드로 packing하는 작업과 워드를 비트 단위로 나누는 unpacking작업을 간단하게 하는 연산들이 추가되었는데, 이러한 instructions(명령어)를 logical operations, 논리연산 명령어라고 부른다. 다음은 C언어와 자바의 RISC-V의 logical operations를 보여준다. 예를 들어서, Java 에서 다음과같이 왼쪽으로 4번 자리이동을 시키는 명령어를 실행시키면? int x=9; int y = x
-
RISC-V FieldsComputer Science/Computer Architecture and Organization 2021. 4. 25. 13:26
Field RISC-V Instruction Fields들에는 다음과 같은 이름이 붙어있다. opcode (0 - 6, 7bits): basic operation of the instruction rd (7 - 11, 5 bits): register destination operand. Gets result of the operation. funct3 (12 - 14, 3 bits): Additional opcode field rs1 (15 - 19, 5 bits): first register source operand rs2 (20 - 24, 5 bits): second register source operand funct7 (25 - 31, 7 bits): Additional opcode field ..
-
RISC-V assembly languageComputer Science/Computer Architecture and Organization 2021. 4. 21. 23:21
컴퓨터와 대화를 하기 위해서는 그(?)가 사용하는 언어를 해야하는데 그것을 instructions 라고 부르고, 그 어휘를 instruction set 이라고 부른다. 그중에 하나가 전에 소개한 MIPS 이고, 오늘 소개할것은 RISC-V 인데, UC Berkely 에서 2010년에 개발되었다. MIPS는 1980년부터 개발이 시작되었고, RISC-V는 MIPS와 매우 흡사한 디자인이다. 또다른 언어로 Intel x86이 있는데, 1970년대 시작했고, 현재까지도 강력하게 쓰이고 있다. 그렇다면 MIPS와 마찬가지로 아래 주어진 코드를 RISC-V로 옮겨보자. Compiling Two C Assignment Statements into RISC-V This segment of a C program con..