Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS61C L20 Datapath © UC Regents 1 Microprocessor James Tan Adapted from D. Patterson’s CS61C Copyright 2000.

Similar presentations


Presentation on theme: "CS61C L20 Datapath © UC Regents 1 Microprocessor James Tan Adapted from D. Patterson’s CS61C Copyright 2000."— Presentation transcript:

1 CS61C L20 Datapath © UC Regents 1 Microprocessor James Tan Adapted from D. Patterson’s CS61C http://www.cs.berkeley.edu/~pattrsn/61CF00 Copyright 2000 UCB

2 CS61C L20 Datapath © UC Regents 2 Five Components of a Computer Processor (active) Computer Control Datapath Memory (passive) (where programs, data live when running) Devices Input Output Keyboard, Mouse Display, Printer Disk (where programs, data live when not running)

3 CS61C L20 Datapath © UC Regents 3 The CPU °Processor (CPU & ALU): does data manipulation and decision-making °Control: part of the processor which tells the datapath what needs to be done

4 CS61C L20 Datapath © UC Regents 4 Stages of the Machine Cycle °Problem: a single, atomic block which “executes an instruction” (performs all necessary operations beginning with fetching the instruction) would be too bulky and inefficient °Solution: break up the process of “executing an instruction” into stages, and then connect the stages to create the whole datapath smaller stages are easier to design easy to optimize (change) one stage without touching the others

5 CS61C L20 Datapath © UC Regents 5 Stages of the Machine Cycle °What general steps do they have in common? °Stage 1: Instruction Fetch no matter what the instruction, the instruction word must first be fetched from memory also, this is where we Increment PC (that is, PC = PC + 1, to point to the next instruction)

6 CS61C L20 Datapath © UC Regents 6 Stages of the Machine Cycle °Stage 2: Instruction Decode upon fetching the instruction, we next gather data from the fields (decode all necessary instruction data) first, read the Opcode to determine instruction type and field lengths etc (Page 10.12 tells you how the instruction format may look like.)

7 CS61C L20 Datapath © UC Regents 7 Stages of the Machine Cycle °Stage 3: ALU Execute Take place at Arithmetic-Logic Unit the real work of most instructions is done here: arithmetic (+, -, *, /), shifting, logic (&, |), comparisons

8 CS61C L20 Datapath © UC Regents 8 Stages of the Machine Cycle °Stage 4: Store result in Memory the load and store instructions are done during this stage most instructions write the result of some computation into a register examples: arithmetic, logical, shifts, loads, slt what about stores, branches, jumps? -don’t write anything into a register at the end -these remain idle during this fifth stage

9 CS61C L20 Datapath © UC Regents 9 Generic Steps=> Machine Cycle PC instruction memory +4 rt rs rd registers ALU Data memory imm 1. Instruction Fetch 2. Decode/ Register Read 3. Execute4. Memory 5. Reg. Write

10 CS61C L20 Datapath © UC Regents 10 Machine Cycle (Page 10.14-10.15) °ADD A $15, X Stage 1: Fetch this instruction from Memory and load it to Instruction Register, inc. PC Details: (PC = 0127)  Address Register: -(Address Register) = 0127 (PC) + 1  PC(new PC = 0128) -Address Register = 0127  Address Bus (Data Bus)  Data Register (Data Register)  Instruction

11 CS61C L20 Datapath © UC Regents 11 Machine Cycle (Page 10.16-10.17) Compute the indexed address of the operand Fetch the Operand -(PC = 0128)  Address Register: -(PC) + 1  PC(new PC = 0129) -Address Register = 0127  Address Bus -(Address Register)  Address Bus Memory Read -(Data Bus)  Data Register -(Data Register)  one ALU Input -(Index Register)  the other ALU Input ALU ADD[ Index Register + Offset] -(Output of ALU)  Address Register Address of Operand = (Index Reg + 15) = 242A

12 CS61C L20 Datapath © UC Regents 12 Machine Cycle (Page 10.18-10.19) (Address Register)=242A  Address Bus Memory Read -(Data Bus) = 1D  Data Register -(Data Register) = 1D  One ALU Input -(Accumulator A) = A1  The other ALU Input ALU ADD [1D + A1]  A = BE 16

13 CS61C L20 Datapath © UC Regents 13 Machine Cycle (Page 20) ADD A $15, X The time taken to execute this cycle is five MPU cycles. -1 St MPU cycle [Fetch Phase] –Fetch & Decode the first byte of the instruction. -2 nd MPU cycle [Execute Phase…] –Obtain the ‘Operand Address Field’. 2 nd byte of the instruction, and put it in it in Data Register -3 rd MPU cycle –Calculate the address of the Operand. –i.e. ADD it to Index Register

14 CS61C L20 Datapath © UC Regents 14 Machine Cycle (Page 20) °ADD A $15, X 4 th MPU Cycle -Get the Operand and place it in the Data Register 5 th MPU Cycle -Perform the required addition

15 CS61C L20 Datapath © UC Regents 15 10.4 Programming Model of CPU (Pg 10.21) Accumulator A Accumulator B Program Counter Stack Pointer Index Register Condition Code Register -Carry Flag -Overflow Flag -Zero Flag -Negative Flag


Download ppt "CS61C L20 Datapath © UC Regents 1 Microprocessor James Tan Adapted from D. Patterson’s CS61C Copyright 2000."

Similar presentations


Ads by Google