[막간 RISC-V 설명, feat. GPT]
Instruction set- 컴퓨터의 레파토리, 아키텍처 Specific (맥락은 유사)
RISC-V Instruction Set
Arithmetic Operation
Register Operands
x0 | the constant value 0 |
---|---|
x1 | return address |
x2 | stack pointer |
x3 | global pointer |
x4 | thread pointer |
x5-x7, x28-x31 | temporaries |
x8 | frame pointer |
x9, x18, x27 | saved registers |
x10 - x11 | function arguments/results |
x12 - x17 | function arguments |
Memory Operands
메인 메모리는 복합 데이터 형태로 쓰임 (배열, 구조체, 동적 데이터 등)
arithmetic 연산할 때; Ld = 메모리 → 레지스터, St = 레지스터 → 메모리
메모리는 Byte 단위
RISC-V는 Little Endian ; B31:B0 라는 뜻인듯
RISC-V는 일부 다른 ISA와 달리 메모리에 Word 할당 필요 없음
Immediate Operands
Bit연산 Range (64bit 기준)
Instruction의 표현
Instruction도 machine code라고 하는 binary encoding됨
RISC-V는 32bit 인코딩 (규칙성위해 포맷은 통일돼 있다?)
R-Format
I-Format
S-Format
Stored Program Computer
Instruction도 Binary 형태로 Data 처럼 저장됨
Instruction과 data가 모두 메모리에 있음
Program이 Program 위에서 동작할 수 있게 됨 (컴파일러, 링커 등)
Binary 레벨 호환성 → 컴파일된 프로그램이 다른 컴퓨터에서 동작 가능
(Standardized ISAs)
Bit 연산 (Logical 연산)
Conditional Operation
Basic Blocks - instruction의 연속으로 이뤄진 블럭