[CA] Lecture #18
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한다.
Creating a Single Datapath
Full Datapath
- IF: Instruction Fetch
- ID: Instruction Decode
- ALU: ALU operation
- MEM: Memory read/write
- WB: Write back
Cf) ImmGen:
- lw/sw: offset sign-extension
- branch: offset sign-extension + PC
How to Use the ALU?
ALU Control
: Funct (4-bit), ALUOp (2-bit)를 이용하여, ALU Control (4-bit)을 계산한다.
Multiple Levels of Decoding
: Control에서 ALUOp를 계산하고, 그 값이 Function field와 합쳐져서 ALU control이 계산된다. (multiple level of decoding)
Truth Table for ALU Control Bits
Designing the Control Unit
R-Type Instruction
- IF: Instruction Fetch, and PC is incremented.
- ID: Instruction Decode.
- ALU: ALU operation
- WB: Wirte back
Cf) Control
: Control에서 모든 control signal을 계산한다. 나온 것들은 모두 그대로 쓰이는데, ALU control만이 Control에서 계산된 ALUOp와 Function이 합쳐져서 계산되는 것이다.
Load Instruction
- IF
- ID
- ALU: offset + x2 (주소 계산)
- MEM
- WB
Branch-on-Equal Instruction
- IF
- ID
- ALU
- WB
- 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
Pipelining Analogy
출처: 이화여자대학교 윤명국교수님 컴퓨터구조