Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Architecture Lecture 2 Abhinav Agarwal Veeramani V.

Similar presentations


Presentation on theme: "Computer Architecture Lecture 2 Abhinav Agarwal Veeramani V."— Presentation transcript:

1 Computer Architecture Lecture 2 Abhinav Agarwal Veeramani V.

2 Quick Recap Various metrics in design of processor The interface & internal structure Instruction Set Architecture  Assembly instructions  Instruction encoding add r1, r2, r3 000111000010001000011

3 Outline RISC Multi-cycle execution Pipelining

4 Reduced Instruction Set Computer (RISC) Limited no. of instructions Fixed Length Simple to decode Easier to implement in hardware Prevalent in all commercial processors at the core level Counterpart – C(omplex)ISC  Intel processors  Multi-operation instructions  Still Intel processors have switched to RISC at second level

5 Execution Cycle of a RISC Instruction Five main phases of Instruction Lifecycle 1. IF: Instruction Fetch Read Instruction Memory at PC Bring the instruction into the CPU 2. ID/RF: Instruction Decode/Register Fetch Translate the opcode of the instruction to appropriate control signals No. of operands Registers clearly specified in instruction code Fetch operand values from the registers

6 Execution Cycle of a RISC Instruction 3. EX: ALU computation  Activate appropriate functional unit – Adder, Multiplier, Divider, Logical Unit  Why no Subtracter? 4. MEM: Memory Operation Load/Store data from/to Data Memory 5. WR: Register Write Write the final result value into register

7 A Picture speaks a thousand words

8 Multi Cycle Execution Cycle Per Instruction (CPI) Kinds of Implementation: 1. One cycle for each stage  Cycle time determined by longest stage  CPI = ? 2. Combine all stages into a single cycle  Cycle time determined by worst case instruction  CPI = 1

9 Execution Snapshot: Cycle 1IF 00010 PC AddressInstr 00000Mov r2, 2A 00001Mov r3, 12 00010Add r1,r2,r3 00011Store r1,0(r4) 00100XXXX 00101XXXX 000111 00001 00010 00011

10 Execution Snapshot: Cycle 2ID/RF Add r1, r2, r3 00011 PC AddressInstr 00000Mov 00001Mov 00010add 00011Store 00100XXXX 00101XXXX 000111 00001 00010 00011 RegData r112 H r22A H r312 H r400 H r501 H

11 Execution Snapshot: Cycle 3EX RegData r112 H r22A H r312 H r400 H r501 H 00011 PC AddressInstr 00000Mov 00001Mov 00010add 00011Store 00100XXXX 00101XXXX 000111 00001 00010 00011 Adder 122A Add r1, r2, r3

12 Execution Snapshot: Cycle 4MEM 00011 PC AddressInstr 00000Mov 00001Mov 00010add 00011Store 00100XXXX 00101XXXX 000111 00001 00010 00011 Adder 122A ?? RegData r112 H r22A H r312 H r400 H r501 H Add r1, r2, r3

13 Execution Snapshot: Cycle 5WB 00011 PC AddressInstr 00000Mov 00001Mov 00010add 00011Store 00100XXXX 00101XXXX 000111 00001 00010 00011 Adder RegData r13C H r22A H r312 H r400 H r501 H Add r1, r2, r3

14 Execution Snapshot: Cycle 1IF 00011 PC AddressInstr 00000Mov 00001Mov 00010add 00011Store 00100XXXX 00101XXXX 111001 00001 00100 00000 store r1, 0(r4)

15 Instruction Execution Timeline Sequential Execution Low utilization of functional units Alternative ? IFID/ RF EXME M WB IFID/ RF EXME M IFID/ RF EXME M WB Instruction Execution Timeline add r1, r2, r3 store r1, 0(r4)

16 Pipelining: Concept and Example Washing machine, Dryer, Iron source: http://cse.stanford.edu/class/sophomore-college/projects-00/risc/pipelining/http://cse.stanford.edu/class/sophomore-college/projects-00/risc/pipelining/

17 Pipelining Concept Remarkable Insight or Common Sense source: http://cse.stanford.edu/class/sophomore-college/projects-00/risc/pipelining/http://cse.stanford.edu/class/sophomore-college/projects-00/risc/pipelining/ Time Savings: Per person0% Overall42%

18 Implementation of Pipelining in RISC Parallelism in all 5 stages New instruction every cycle Best case scenario IFID/RFEXMEMWB IFID/RFEXMEMWB IFID/RFEXMEMWB IFID/RFEXMEMWB IFID/RFEXMEMWB Inst Time

19 Hardware Requirements source: http://cse.stanford.edu/class/sophomore-college/projects-00/risc/pipelining/http://cse.stanford.edu/class/sophomore-college/projects-00/risc/pipelining/

20 Problems Data hazards  Dependent Instructions add r1, r2, r3 store r1, 0(r4) Control Hazards  Branches resolution bnz r1, label add r1, r2, r3 label: sub r1, r2, r3 Structural Hazards IFID/RFEXMEMWB IFID/RFEXMEMWB IFID/RFEXMEMWB IFID/RFEXMEMWB IFID/RFEXMEMWB

21 References Wikipedia: CPU Parallelism http://en.wikipedia.org/wiki/Central_processing_unit#Parallelism http://en.wikipedia.org/wiki/Central_processing_unit#Parallelism http://www.cs.iastate.edu/~prabhu/Tutorial/PIPELINE/pipe_title.html


Download ppt "Computer Architecture Lecture 2 Abhinav Agarwal Veeramani V."

Similar presentations


Ads by Google