Computer Architecture/컴퓨터구조[05]
[CA] Lecture #16 - Ch4: The Processor
leziwn.cs
2023. 11. 5. 11:00
Ch4: The Processor
- Building a Datapath
- Pipeline
- Hazards
- Structural hazard
- Data hazard
- Control hazard
Introduction Execution
- IF: Instruction Fetch
PC를 instruction을 가지고 있는 메모리로 보내서, fetch the instruction from that memory. (Instruction Memory) - ID: Instruction Decode
instruction format을 통해 읽어야 할 레지스터를 확인하고, 레지스터 값을 읽는다. (Register File) - ALU: ALU 연산 (ALU)
- MEM: Memory read(lw), write(sw) (Data Memory)
- WB: Write back to the register file. (Register File)
Cf) Pipeline Hazard
- 만약 Instruction Memory와 Data Memory로 나눠져 있지 않고 하나의 메모리라면, IF와 MEM가 동시에 발생할 때, Structural hazard 발생 가능
- 만약 ID와 WB이 동시에 일어난다면, Register File에서 레지스터 값을 읽는 stage와 레지스터 값에 쓰는 stage가 겹치기 때문에, Data hazard 발생 가능
- Branch 연산의 경우, ALU에서 subtraction이 완료되어 Zero control이 1이 되어야, branch를 결정할 수 있음. Branch를 결정하면, memory에서 instruction fetch를 해야 하기 때문에 IF stage임. (Control hazard)
▶ R-format: IF --> ID --> ALU --> WB
▶ Load word: IF --> ID --> ALU(add) --> MEM(read) --> WB
▶ Store word: IF --> ID --> ALU(add) --> MEM(write) --> WB
▶ Branch: IF --> ID --> ALU(sub)
▶ Jump: IF
출처: 이화여자대학교 윤명국교수님 컴퓨터구조, 이화여자대학교 이형준교수님 컴퓨터구조