leziwn.cs 2023. 11. 8. 02:04
Immediate Generation Unit

Immediate Generation Unit

: 32-bit로 sign-extenstion

 

 

Branch Implementation
  • Branch 하지 않으면: PC+4
  • Branch 하면: (Sign-extended offset field << 1) + PC

Cf) MIPS: (Sign-extended offset field << 2) + (PX + 4)

 

▷ beq에서 branch할 지 여부를 결정하는 방법

: ALU에서의 subtration 연산을 하여 그 값이 0이 되면 (Zero == 1)이 되는데, (Zero == 1)이고, branch signal 또한 1일 때 branch한다.

beq

 


Creating a Single Datapath
Full Datapath

Full Datapath

  1. IF: Instruction Fetch
  2. ID: Instruction Decode
  3. ALU: ALU operation
  4. MEM: Memory read/write
  5. WB: Write back

Cf) ImmGen:

  • lw/sw: offset sign-extension
  • branch: offset sign-extension + PC

 

 

How to Use the ALU?

How to Use the ALU?

 

ALU Control

ALU Control
ALUOp, Funct --> ALU control

: Funct (4-bit), ALUOp (2-bit)를 이용하여, ALU Control (4-bit)을 계산한다.

 

Multiple Levels of Decoding

Multiple Levels of Decoding

: Control에서 ALUOp를 계산하고, 그 값이 Function field와 합쳐져서 ALU control이 계산된다. (multiple level of decoding)

 

Truth Table for ALU Control Bits

Truth Table for ALU Control Bits

 

Designing the Control Unit

Designing the Control Unit

 

 

R-Type Instruction
  1. IF: Instruction Fetch, and PC is incremented.
  2. ID: Instruction Decode.
  3. ALU: ALU operation
  4. WB: Wirte back

R-Type Instruction

Cf) Control
: Control에서 모든 control signal을 계산한다. 나온 것들은 모두 그대로 쓰이는데, ALU control만이 Control에서 계산된 ALUOp와 Function이 합쳐져서 계산되는 것이다.

 

 

Load Instruction
  1. IF
  2. ID
  3. ALU: offset + x2 (주소 계산)
  4. MEM
  5. WB

Load Instruction

 

 

Branch-on-Equal Instruction
  1. IF
  2. ID
  3. ALU
  4. WB

Branch-on-Equal Instruction

  • Branch signal과 Zero signal이 둘 다 1일 때, branch한다.
  • branch하면 PC 값은 (sign-extended offset + PC)가 되고, branch하지 않으면 PC 값은 (PC + 4)가 된다.

 


Performance Issues
  • 가장 긴 delay가 clock period를 결정한다.

--> We will improve performance by pipelining!

 

Sequantial Laundry vs. Pipelined Laundary

Sequantial Laundry vs. Pipelined Laundary

 

Pipelining Analogy

Pipelining Analogy

 

 

 

 

출처: 이화여자대학교 윤명국교수님 컴퓨터구조