caller calls callee Set register x10(a0) - x17(a7) with the arguments in order before caling the function. (8 registers) If the function takes more than 8 arguments, the rest of the arguments are passed to the callee using memory. RISC-V calle convention is designed to pass only one value from callee to caller Use register x10(a0) - x11(a1) x10 [31:0] x11 [63: 32] If we do not have to use a0, a1..
전체 글
개ㄱ발은 기세다. 줄여서 객기.
memory "address" is also a 32-bit (non-negative) integer. memory -> register: Load (need address & destination register) register -> memory: Store (need address & source register) C code 1: g = h + A[8]; g in x1, h in x2, base address (starting address) of A in x3 A is an 'int' type array (array: list of values) Compiled RISC-V code: Index "8" requires an offset of 32 lw x10, 32(x3) # lw = load ..

Instructions and data are represented in binary. (machine code) Instructions and data are stored in memory (set of bytes) Operating system will load the program binary from the disk and put it to the memory -> CPU ready to execute the program RISC-V의 모든 instruction은 32-bit, 즉 1 word의 길이로 나타내며, little endian으로 나타낸다. 한 마디로, 우리는 뒤에서부터 읽어 해석해야 한다. - Instruction fields opcode: operation code (0~6비트까지..
Operation C JAVA RISC-V Bitwise AND & & and, andi Bitwise OR | | or, ori Bitwise XOR ^ ^ xor, xori Bitwise NOT ~ ~ xor, xori Shift left > srli and x9, x10, x11 or x9, x10, x11 xor x9, x10, x11 쉽게 생각하면 같으면 0, 다르면 1 if x11 = -1 (0xFFFFFFFF), x9 = ~x10 (x11이 모든 비트가 다 1이라면 xor 연산을 통해 1은 0으로 0은 1로 바뀔 것이기 때문) RISC-V has xori a XORI -1 == NOT a Pseudo-instruction: not not x10, x11 -> xori x10, x11, -1 ..
그냥 add instruction과 addi instruction은 다르다. addi에서 뒤에 붙은 i는 immediate을 의미한다. -> constant data included in an instruction addi x22, x23, 4 여기서 x23은 one register file operand, 4는 one constant value다. 주의해야할 점은 subi instruction은 없다는 것이다. instead, just use a negative integer value. x23에서 1을 빼서 x22에 저장하고 싶어! 라고 하면 subi x22, x23, 1 같지만, subi instruction은 없으므로 우리는 addi x22, x23, -1로 작성할 수 있다. 이유: By redu..
1. High-level code closer to the problem domain better productivity & portability 2. Assembly code Human-readable representation of the machine code Can use symbolic names (labels) 3. Machine code Instructions encoded in binary format No symbols (doesn't have labels identified by human beings) 컴퓨터 하드웨어에게 일을 시키려면 하드웨어가 알아들을 수 있는 언어로 말을 해야 한다. 컴퓨터 언어에서 단어를 명령어(instruction) 이라 하고 그 어휘를 명령어 집합(instr..
교재 연습 문제를 풀다보니 1.0E6개의 명령어를 실행하는 프로그램이 있다고 나온다. 1.0E6...? 1.0E6이 뭐여 1.0E6 = 1.0 x 10^6 이라고 한다.. 바로 아래 문제에 1.0E9, 1.2E9라는 숫자도 나오는데 이를 적용해보면 1.0 x 10^9, 1.2 x 10^9가 될거다. 궁금증 해결~!

SPEC CPU Benchmark : Programs used to measure performance 사용자의 실제 작업부하에 대한 성능을 잘 반영할 것으로 생각되는 프로그램들로 구성된 작업부하 SPECratio: 기준 프로세서의 실행시간을 측정하려는 컴퓨터의 실행시간으로 나누어 실행시간 정규화한 결과 SPECratio가 클수록 성능이 더 좋은 컴퓨터! -> 시간의 역수 Aggregating Performance Ratios : Use the geometric mean to aggregate the ratios 이 형님 어마무시하게 생기심 ㄷ ㄷ 식은 무섭게 생겼지만 교수님께서 주신 예시를 보면서 Arithmetic mean과 비교하면 좀 수월하다. Computer 1 execution time Com..