Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction CPU performance factors

Similar presentations


Presentation on theme: "Introduction CPU performance factors"— Presentation transcript:

1 Introduction CPU performance factors
- Instruction count; determined by ISA and compiler - CPI and Cycle time; determined by CPU hardware We will examine a simplified MIPS implementation in this course and a more realistic pipelined version in the next. Simple subset of machine instructions, shows most aspects - Memory reference: lw, sw - Arithmetic/logical: add, sub, and, or, slt - Control transfer: beq, j August 2009 © McQuain, Feng & Ribbens

2 Review of MIPS Machine Language
Simple instructions, all 32 bits wide Very structured, no unnecessary baggage Only three instruction formats: R funct shamt rd rt rs op 16-bit immediate 26-bit immediate I J Basic arithmetical-logical instructions are R-format. Load/store/conditional branch instructions are I-format. Jump/unconditional branch instructions are J-format. August 2009 © McQuain, Feng & Ribbens ©2009 McQuain & Ribbens 2

3 Instruction Execution
PC  instruction memory, fetch instruction Register numbers  register file, read registers Depending on instruction class - Use ALU to calculate - Arithmetic result - Memory address for load/store - Branch target address - Access data memory for load/store - PC  target address or PC + 4 August 2009 © McQuain, Feng & Ribbens

4 CPU Overview August 2009 © McQuain, Feng & Ribbens

5 Need for Selection Mechanisms
Must choose which one goes back to PC. BUT, you cannot just join wires together to achieve this… Compute address for sequential execution. Compute address for conditional branch. August 2009 © McQuain, Feng & Ribbens

6 Need for Control Logic The 2x1 multiplexor must have a 1-bit control line to select between the two inputs. There must be a combinational circuit that determines which input should be selected and passed through to the PC. So, under what condition(s) should the branch address be used? … if we're executing a conditional branch instruction and the condition has evaluated to true. August 2009 © McQuain, Feng & Ribbens

7 Control Questions What's the logic for controlling the other MUXes?
What control settings will the ALU need? What goes here? August 2009 © McQuain, Feng & Ribbens

8 Logic Design Basics Information encoded in binary
- Low voltage = 0, High voltage = 1 - One wire per bit - Multi-bit data encoded on multi-wire buses Combinational elements - Operate on data - Output is purely a function of input State (sequential) elements - Store information - Output/state depends on input and on previous state August 2009 © McQuain, Feng & Ribbens

9 Clocking Methodology Combinational logic transforms data during clock cycles - Between clock edges - Input from state elements, output to state element - Longest delay determines clock period August 2009 © McQuain, Feng & Ribbens

10 Building a Datapath Datapath
- Elements that process data and addresses in the CPU - Registers, ALUs, mux’s, memories, … We will build a MIPS datapath incrementally - Refining the overview design August 2009 © McQuain, Feng & Ribbens

11 Increment by 4 for next instruction
Instruction Fetch Increment by 4 for next instruction 32-bit register August 2009 © McQuain, Feng & Ribbens

12 R-Format Instructions
Read two register operands Perform arithmetic/logical operation Write register result funct shamt rd rt rs op August 2009 © McQuain, Feng & Ribbens

13 Load/Store Instructions
Read register operands Calculate address using 16-bit offset - Use ALU, but sign-extend offset Load: Read memory and update register Store: Write register value to memory 16-bit immediate rt rs op August 2009 © McQuain, Feng & Ribbens

14 Branch Instructions Read register operands Compare operands
- Use ALU, subtract and check Zero output Calculate target address - Sign-extend displacement - Shift left 2 places (word displacement) - Add to PC + 4 - Already calculated by instruction fetch 16-bit immediate rt rs op August 2009 © McQuain, Feng & Ribbens

15 Sign-bit wire replicated
Branch Instructions Just re-route wires Sign-bit wire replicated August 2009 © McQuain, Feng & Ribbens


Download ppt "Introduction CPU performance factors"

Similar presentations


Ads by Google