이 강의는 instruction이 CPU에서 실행될 때의 execution cycle을 중심으로,
그 실행이 clock과 memory access에 의해 어떻게 제어되는지를 설명한다.
Single-cycle processor를 기준으로 instruction execution의 전체 흐름을 정리한다.
Execution cycle은 하나의 instruction이
CPU에서 실행되기 위해 거치는 단계들의 논리적 순서이다.
Single-cycle processor에서는:
하나의 instruction이 one clock cycle 안에 완료된다
모든 execution stage가 하나의 clock period에 포함된다
clock cycle time은 가장 오래 걸리는 instruction을 기준으로 결정된다
즉, clock은 instruction execution의 시간적 기준(time reference) 역할을 한다.
Instruction execution은 다음과 같은 stage로 구성된다.
Instruction Memory에서 instruction을 fetch
Program Counter (PC)가 가리키는 address 사용
PC는 다음 instruction address로 update됨
instruction의 opcode와 field를 decode
Register File에서 source register 값을 read
immediate value가 필요한 경우 준비됨
ALU를 사용해 연산 수행
arithmetic / logical operation 수행
load / store instruction의 경우 memory address 계산
branch instruction의 경우 condition evaluation 수행
Data Memory 접근이 이루어지는 stage
load instruction: memory read
store instruction: memory write
arithmetic instruction은 이 stage에서 memory를 사용하지 않음
Execution cycle에서 memory는 두 가지 형태로 사용된다.
Instruction Memory
IF stage에서 instruction fetch에 사용
Data Memory
MEM stage에서 load / store instruction에 의해 사용
Single-cycle processor에서는 instruction memory와 data memory 접근이 하나의 clock cycle 안에서 모두 발생한다.
Single-cycle 구조의 특징은 다음과 같다.
모든 instruction이 동일한 execution cycle 구조를 가짐
instruction 종류에 관계없이 한 clock cycle에 완료됨
unused stage가 있어도 cycle은 그대로 소모됨
이로 인해 구조는 단순하지만,
clock cycle time이 길어질 수 있고
hardware 자원의 효율적인 사용에는 한계가 있다
강의자료 5에서 다루는 핵심은 다음과 같다.
Execution cycle은 instruction 실행의 단계적 흐름이다
Clock은 execution cycle의 시간 기준을 제공한다
Instruction memory와 data memory는 서로 다른 stage에서 사용된다
Single-cycle processor에서는 모든 execution이 한 clock cycle 안에 이루어진다
이 모델은 이후 multi-cycle과 pipelined execution을 이해하기 위한 기준이 된다