Computer Science/Computer Architecture

[컴퓨터구조] Lecture 14: The Processor - Part3

kangkyunghyun 2026. 2. 12. 01:18
728x90
반응형

경희대학교 김정욱 교수님의 컴퓨터구조 강의를 기반으로 정리한 글입니다.

Overview of Pipelining

  • Pipelining: 여러 인스트럭션들이 중첩해서 실행시키는 기법

Pipeline Instruction-execution (5 stages)

  1. 메모리에서 인스트럭션을 Fetch
  2. 인스트럭션을 decoding하는 동안 레지스터를 Read
  3. 작업을 수행하거나 주소 계산
  4. Data memory의 operand에 접근
  5. 레지스터에 결과를 Write

Pipelining Speed-Up Discussion

Single cycle vs. Pipelined performace

Pipelining speed-up

  • stage들이 완벽하게 밸런스를 이루고 있으면

  • 하지만 이런 경우는 없음

인스트럭션 3개의 실행 시간 비교

  • Nonpipelined: 2400ps
  • Pipelined: 1400ps
  • 약 1.71배 차이

인스트럭션 1,000,003개의 실행 시간 비교

  • Nonpipelined: 1,000,000 * 800ps + 2400ps ≅ 800,000,000ps
  • Pipelined: 1,000,000 * 200ps + 1400ps ≅ 200,000,000ps
  • 약 4배 차이

Pipelined Datapath and Control

5 stages of Pipelining

  1. IF: Instruction Fetch
  2. ID: Instruction decode and register file read
  3. EX: Execution or address calculation
  4. MEM: Data memory access
  5. WB: Write back
  • 보통 왼쪽에서 오른쪽으로 진행
  • 예외1: WB stage
  • 예외2: PC의 next value 선택

Pipeline register

  • CC1 내부의 Instruction Memory는 다음 4개의 스테이지와 공유
  • CC2의 IM이 fetch되면, CC1의 IM 값은 삭제될 수 있음
  • 각각의 인스트럭션 값을 보존하기 위해(나머지 4단계), IM으로부터 읽어온 값은 레지스터에 저장됨

Pipelined datapath with pipeline register

Five stages

1. Instruction fetch

  • PC address는 4만큼 더해지고, 다음 clock cycle을 준비하기 위해 PC로 돌아옴
  • 이렇게 더해진 주소는 IF/ID pipeline register에 저장됨 → beq 같은 나중 명령어를 위해 필요

2. Instruction decode and register file read

  • IF/ID pipeline register에 기반하여 3개의 값을 얻음 → sign-extend 32-bits, 2개의 레지스터 데이터
  • 3개의 값 모두 ID/EX pipeline register에 저장됨
  • 증가된 PC address도 저장됨

3. Execute or address calculation

  • ID/EX pipeline register에 기반하여 EX/MEM pipeline register에 저장할 3개의 값을 얻음
  • (PC+4) + sign-extended 32-bits, Zero, ALU result

4. Memory address

  • EX/MEM pipeline register로부터 얻은 address를 이용하여 MEM/WB pipeline register에 메모리로부터 읽은 데이터를 저장

5. Write-back

  • MEM/WB pipeline register에서 데이터를 읽어서 레지스터 파일에 저장
  • sw 일 때는 아무 일도 일어나지 않음

Graphically Representing Pipelines

  • Multiple clock cycle pipeline diagram의 두 가지 스타일

1. 모든 디테일을 포함하지 않는 경우

2. 모든 디테일을 포함하는 경우(전통적인 방식)

Single clock cycle pipeline diagram

Pipelined Control

  • Control signals는 EX, M, WB으로 나뉨
  • IF, ID 단계는 아직 디코드가 끝나지 않음 → 뭘 할지 모름 → Control signal 없음
  • 아직 사용되지 않은 Control signals는 전달

728x90
반응형