Computer Science 254 2. MIPS : Non-Leaf Procedure Non-Leaf Procedure 자신도 어떤 함수에서 call되는 callee이며, return 되기 전에 다른 함수를 호출한다. => Nested call을 수행한다. => callee이면서 caller인 procedure 다른 procedure을 call하기 전에 자신의 caller에게 받았던 $a, $ra을 stack에 저장하고, call이 끝나면 다시 복원해야 한다. $a, $ra $a, $ra, $s, local variables의 각 개수는 컴파일러가 알고 있다. Caller (선택) $a : argument register 저장 → 자신에게 넘어온 것만 저장 (필수) $ra : return address 저장 → 무조건 저장 Callee (선택) $s : saved register 저장 →.. 2021. 5. 9. 2. MIPS : Program Execution Program Execution 프로그램의 실행은 abstraction level의 관점에서 크게 2가지로 분류할 수 있다. Abstraction Level Abstraction level은 HLL과 ISA로 나뉜다. HLL(High-Level Language) 생산성을 높이기 위한 interface machine language의 interface ISA HW/SW interface Program Execution Abstraction level에 따라 아래처럼 나뉠 수 있다. 결국 HLL의 관점에서 프로그램의 실행은 procedure call-return의 반복으로 볼 수 있다. HLL 관점 statement, function이 하나씩 실행되는 과정 * statement, function : HLL의.. 2021. 4. 22. 2. MIPS : Control Instruction Control Instructions = Branch instruction, Jump instrucition Instruction의 20%가 control instruction일 정도로 common case이다. 때문에 이를 single instruction으로 표현할 필요가 있기에 만들어졌다. Control instruction은 control flow(program execution flow)을 바꾼다. 즉 PC(Program Counter)의 값을 변경한다. 언제 jump하는지에 따라서 다음과 같이 구분된다. Conditional jump 조건이 충족할 때만 jump 수행 beq, bne Unconditional jump 항상 jump을 수행 무엇을 이용하여 jump하는지에 따라 구분 jump ta.. 2021. 4. 20. 2. MIPS : ALU and Data Transfer Instruction ALU Instruction ALU는 산술 연산과 논리 연산을 담당한다. Register Arithmetic Instruction Addressing mode는 instruction이 어떤 operand를 가질 수 있는지를 결정하는 것이다. RISC의 ALU instruction은 레지스터 기반으로, register addressing mode와 R-format을 사용한다. 변수나 데이터는 레지스터에 저장되어, 레지스터로 사용된다. 모든 arithmetic operation은 3개의 operand를 가진다. 2개는 source이고, 1개는 destination이다. 예 : add a, b, c 예시 C 코드에서 f = (g + h) - (i + j)라는 코드는 다음과 같이 MIPS code로 컴파일 된다.. 2021. 4. 17. 2. MIPS : Instruction Format & Addressing Mode Instruction Format ENIAC은 아니었지만 현대의 컴퓨터는 모두 stored program computer이다. 따라서 프로그램은 컴퓨터에 저장된다. 이를 위해서 instruction은 binary instruction(machine code)로 변환되어야 한다. MIPS는 32-bit instruction word로 encode된다. 이를 위해 32-bit instruction을 어떻게 나눠서 opcode, operand 등을 encoding 할 것인지 결정해야 한다. MIPS는 3종류의 구조가 있고, I-type instruction, R-type instruction, J-type instruction이다. Format Operand 개수 Operand 구성 Instructions I.. 2021. 4. 17. 이전 1 ··· 40 41 42 43 44 45 46 ··· 51 다음