Pipelining

박영재·2024년 10월 2일
post-thumbnail

Pipelining

One instruction is executed through multiple stages.

Stages

Typically, an instruction execution consists of the following stages:

  1. Fetch (IF - Instruction Fetch): The instruction is retrieved from memory.
  2. Decode (ID - Instruction Decode): The fetched instruction is decoded to determine the operation and the operands involved.
  3. Execute (EX): The operation specified by the instruction is performed, which may involve arithmetic or logical calculations.
  4. Memory Access (MEM): If the instruction requires reading from or writing to memory (for load/store instructions), this stage handles those operations.
  5. Write Back (WB): The results of the execution are written back to the register file.

Example

  • I1: ADD R1, R2, R3
  • I2: SUB R4, R5, R6
  • I3: LW R7, 100(R8)

Without Pipelining:

CycleFetch (IF)Decode (ID)Execute (EX)Memory (MEM)Write Back (WB)
1I1
2I1
3I1
4I1
5I1
6I2
7I2
8I2
9I2
10I2
11I3
12I3
13I3
14I3
15I3

With Pipelining

CycleFetch (IF)Decode (ID)Execute (EX)Memory (MEM)Write Back (WB)
1I1
2I2I1
3I3I2I1
4I3I2I1
5I3I2I1
6I3I2
7I3

There's some pitfalls such as problems from branching, but pipelining obviously improves performance

profile
People live above layers of abstraction beneath which engineers reside

0개의 댓글