Docsity

Processor Architecture: Performance Metrics & Exception Handling in Computer Org., Study notes of Computer Architecture and Organization

Toggle sidebar
bg1
Page 1
Processor Architecture VI:
Wrap-Up
CSCE 230J
Computer Organization
Dr. Steve Goddard
http://cse.unl.edu/~goddard/Courses/CSCE230J
2
Giving credit where credit is due
Most of slides for this lecture are based on
slides created by Dr. Bryant, Carnegie
Mellon University.
I have modified them and added new
slides.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Processor Architecture: Performance Metrics & Exception Handling in Computer Org. and more Study notes Computer Architecture and Organization in PDF only on Docsity!

Processor Architecture VI:

Wrap-Up

CSCE 230J

Computer Organization

Dr. Steve Goddard

[email protected]

http://cse.unl.edu/~goddard/Courses/CSCE230J

2

Giving credit where credit is due

 Most of slides for this lecture are based on

slides created by Dr. Bryant, Carnegie

Mellon University.

 I have modified them and added new

slides.

3

Overview

Wrap-Up of PIPE Design

 Performance analysis

 Fetch stage design

 Exceptional conditions

Modern High-Performance Processors

 Out-of-order execution

4

Performance Metrics

Clock rate

 Measured in Megahertz or Gigahertz

 Function of stage partitioning and circuit design

 Keep amount of work per stage small

Rate at which instructions executed

 CPI: cycles per instruction

 On average, how many clock cycles does each instructionrequire?

 Function of pipeline design and benchmark programs

 E.g., how frequently are branches mispredicted?

7

Fetch Logic Revisited

During Fetch Cycle

1. Select PC

2. Read bytes frominstruction memory

3. Examine icode todetermine

instruction length

4. Increment PC

Timing

 Steps 2 & 4 requiresignificant amount

of time F

D rB

M_icode

PredictPC

icode ifun rA valC valP

Instruction Instructionmemorymemory

incrementincrementPC^ PC

predPC

regids^ Need

Instr^ NeedvalC valid SplitSplitByte 0 Align Align Bytes 1-

SelectPC

M_BchM_valA W_icodeW_valM

8

Standard Fetch Timing

 Must Perform Everything in Sequence

 Can’t compute incremented PC until know how much toincrement it by

Select PC Mem. Read Increment

need_regids, need_valC

1 clock cycle

9

A Fast PC Increment Circuit

3-bit adder

need_ValC

0 need_regids

29-bitincre-

menter

MUX

High-order 29 bits Low-order 3 bits

High-order 29 bits Low-order 3 bits 0 1

PC

incrPC

Slow Fast

carry

10

Modified Fetch Timing

29-Bit Incrementer

 Acts as soon as PC selected

 Output not needed until final MUX

 Works in parallel with memory read

Select PC Mem. Read Incrementer

need_regids, need_valC 3-bit add MUX

1 clock cycle

Standard cycle

13

Exception Examples

Detect in Fetch Stage

irmovlrmmovl $100,%eax%eax,0x10000(%eax) # invalid address

jmp $-1 # Invalid jump target

.byte 0xFF # Invalid instruction code

halt # Halt instruction

Detect in Memory Stage

14

Exceptions in Pipeline Processor #

Desired Behavior

 rmmovl should cause exception

#irmovl demo-exc1.ys $100,%eax

rmmovlnop %eax,0x10000(%eax) # Invalid address

.byte 0xFF # Invalid instruction code

0x000: irmovl $100,%eax

1 2 3 4 0x006: rmmovl %eax,0x1000(%eax)^ F^ D F^ DE^ ME 0x00c: 0x00d: nop.byte 0xFF F D F

W

5 M E D

Exception detected

Exception detected

15

Exceptions in Pipeline Processor #

Desired Behavior

 No exception should occur

#0x000: demo-exc2.ys xorl %eax,%eax # Set condition codes

0x002:0x007: jne tirmovl $1,%eax # Not taken

0x00d:0x013: irmovlhalt $2,%edx

0x014: t: .byte 0xFF # Target

0x000: xorl %eax,%eax

1 2 3 F D E 0x002: 0x014: t: .byte 0xFF jne t F D 0x???: (I’m lost!)^ F

Exception detected

0x007: irmovl $1,%eax

4 M E F^ D

W

5 M D F^ E^ M E D

6

W M E

7

W M

8

W

9

16

Maintaining Exception Ordering

 Add exception status field to pipeline registers

 Fetch stage sets to either “AOK,” “ADR” (when bad fetchaddress), or “INS” (illegal instruction)

 Decode & execute pass values through

 Memory either passes through or sets to “ADR”

 Exception triggered only when instruction hits write back

F predPC

W exc icode valE valM dstE dstM M exc icode Bch valE valA dstE dstM E exc icode ifun valC valA valB dstE dstM srcA srcB D exc icode ifun rA rB valC valP

19

Rest of Exception Handling

Calling Exception Handler

 Push PC onto stack

 Either PC of faulting instruction or of next instruction

 Usually pass through pipeline along with exception status

 Jump to handler address

  Usually fixed address Defined as part of ISA

Implementation

 Haven’t tried it yet!

20

Modern CPU Design

Execution Execution

FunctionalUnits

Instruction Control Instruction Control

Integer/Branch Add FP Mult/Div FP Load Store

InstructionCache

Cache^ Data

Control^ Fetch InstructionDecode

Address Instructions Prediction Operations OK?

Addr. (^) DataAddr. Data

GeneralInteger Operation Results

RetirementUnit RegisterFile RegisterUpdates

21

Instruction Control

Grabs Instruction Bytes From Memory  Based on Current PC + Predicted Targets for Predicted Branches

 Hardware dynamically guesses whether branches taken/not takenand (possibly) branch target

Translates Instructions Into  Primitive steps required to perform instruction Operations

 Typical instruction requires 1–3 operations

Converts Register References Into  Abstract identifier linking destination of one operation with sources Tags

of later operations

Instruction Control Instruction Control

InstructionCache Control^ Fetch InstructionDecode

Address Instructions Operations

RetirementUnit RegisterFile

Instruction Control Instruction Control

InstructionCache Control^ Fetch InstructionDecode

Address Instructions Operations

RetirementUnit RegisterFile

22

Execution Unit

 Multiple functional units  Each can operate in independently

 Operations performed as soon as operands available

  Not necessarily in program order Within limits of functional units

 Control logic

 Ensures behavior equivalent to sequential program execution

Execution Execution

Integer/Branch Add FP Mult/Div FP Load Store FunctionalUnits

Cache^ Data

PredictionOK?

Addr. (^) DataAddr. Data

GeneralInteger Operation Results

RegisterUpdates Operations

25

PentiumPro Operation

Translates instructions dynamically into “Uops”

 118 bits wide

 Holds operation, two sources, and destination

Executes Uops with “Out of Order” engine

 Uop executed when

 Operands available

 Functional unit available

 Execution controlled by “Reservation Stations”  Keeps track of data dependencies between uops

 Allocates resources

26

PentiumPro Branch Prediction

Critical to Performance

 11–15 cycle penalty for misprediction

Branch Target Buffer

 512 entries

 4 bits of history

 Adaptive algorithm

 Can recognize repeated patterns, e.g., alternating taken–nottaken

Handling BTB misses

 Detect in cycle 6

 Predict taken for negative offset, not taken for positive

 Loops vs. conditionals

27

Example Branch Prediction

Branch History

 Encode information about prior history of branchinstructions

 Predict whether or not branch will be taken

State Machine

 Each time branch taken, transition to right

 When not taken, transition to left

 Predict branch taken when in state Yes! or Yes?

T T T

Yes! Yes? No? No!

NT

T

NT NT

NT

28

Pentium 4 Block Diagram

 Next generation microarchitecture

Intel Tech. JournalQ1, 2001