+ All Categories
Home > Documents > 26 October

26 October

Date post: 13-Jan-2016
Category:
Upload: neron
View: 18 times
Download: 0 times
Share this document with a friend
Description:
26 October. Questions? Instruction Execution. Five Execution Steps. Instruction Fetch Instruction Decode and Register Fetch Execution, Memory Address Computation, or Branch Completion Memory Access or R-type instruction completion - PowerPoint PPT Presentation
18
10/18/2005 Comp 120 Fall 2005 1 26 October • Questions? Instruction Execution
Transcript
Page 1: 26 October

10/18/2005 Comp 120 Fall 2005 1

26 October

• Questions?• Instruction Execution

Page 2: 26 October

10/18/2005 Comp 120 Fall 2005 2

Five Execution Steps

• Instruction Fetch

• Instruction Decode and Register Fetch

• Execution, Memory Address Computation, or Branch Completion

• Memory Access or R-type instruction completion

• Memory Read Completion

INSTRUCTIONS TAKE FROM 3 - 5 CYCLES!• A FSM looks at the op-code to determine how many...

Page 3: 26 October

10/18/2005 Comp 120 Fall 2005 3

• Use PC to get instruction and put it in the Instruction Register.• Increment the PC by 4 and put the result back in the PC.• Can be described succinctly using RTL "Register-Transfer Language"

IR = Memory[PC]; IR is “Instruction Register”PC = PC + 4;

What is the advantage of updating the PC now?

Step 1: Instruction Fetch

Page 4: 26 October

10/18/2005 Comp 120 Fall 2005 4

• Read registers rs and rt in case we need them

• Compute the branch address in case the instruction is a branch

• RTL:

A = Reg[IR[25-21]];B = Reg[IR[20-16]];ALUOut = PC + (sign-extend(IR[15-0]) << 2);

• We aren't setting any control lines based on the instruction type (we are busy "decoding" it in our control logic)

Step 2: Instruction Decode and Register Fetch

Page 5: 26 October

10/18/2005 Comp 120 Fall 2005 5

• ALU is performing one of three functions, based on instruction type

• Memory Reference:

ALUOut = A + sign-extend(IR[15-0]);

• R-type:

ALUOut = A op B;

• Branch:

if (A==B) PC = ALUOut;

Step 3 (instruction dependent)

Page 6: 26 October

10/18/2005 Comp 120 Fall 2005 6

• Loads and stores access memory

MDR = Memory[ALUOut]; MDR is Memory Data Register

orMemory[ALUOut] = B;

• R-type instructions finish

Reg[IR[15-11]] = ALUOut;

Step 4 (R-type or memory-access)

Page 7: 26 October

10/18/2005 Comp 120 Fall 2005 7

• Reg[IR[20-16]]= MDR;

Step 5 Memory Read Completion

Page 8: 26 October

10/18/2005 Comp 120 Fall 2005 8

Summary:

Step nameAction for R-type

instructionsAction for memory-reference

instructionsAction for branches

Action for jumps

Instruction fetch IR = Memory[PC]PC = PC + 4

Instruction A = Reg [IR[25-21]]decode/register fetch B = Reg [IR[20-16]]

ALUOut = PC + (sign-extend (IR[15-0]) << 2)

Execution, address ALUOut = A op B ALUOut = A + sign-extend if (A ==B) then PC = PC [31-28] IIcomputation, branch/ (IR[15-0]) PC = ALUOut (IR[25-0]<<2)jump completion

Memory access or R-type Reg [IR[15-11]] = Load: MDR = Memory[ALUOut]completion ALUOut or

Store: Memory [ALUOut] = B

Memory read completion Load: Reg[IR[20-16]] = MDR

Page 9: 26 October

10/18/2005 Comp 120 Fall 2005 9

Data Path with Control (5.28)

Page 10: 26 October

10/18/2005 Comp 120 Fall 2005 10

FSM Control (5.31)

Page 11: 26 October

10/18/2005 Comp 120 Fall 2005 11

IFetch and Decode (5.32)

Page 12: 26 October

10/18/2005 Comp 120 Fall 2005 12

Memory Ref (5.33)

Page 13: 26 October

10/18/2005 Comp 120 Fall 2005 13

R-type (5.34)

Page 14: 26 October

10/18/2005 Comp 120 Fall 2005 14

Branch (5.35)

Page 15: 26 October

10/18/2005 Comp 120 Fall 2005 15

Jump (5.36)

Page 16: 26 October

10/18/2005 Comp 120 Fall 2005 16

Full State Diagram

Page 17: 26 October

10/18/2005 Comp 120 Fall 2005 17

FSM

Page 18: 26 October

10/18/2005 Comp 120 Fall 2005 18

Highlight

• Who’s been to the fair?• Go!• You can have your picture taken with W!


Recommended