Ch. 5: Processor + Memory December 12, 2008 Ch. 5: Processor + - - PowerPoint PPT Presentation

ch 5 processor memory
SMART_READER_LITE
LIVE PREVIEW

Ch. 5: Processor + Memory December 12, 2008 Ch. 5: Processor + - - PowerPoint PPT Presentation

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design Ch. 5: Processor + Memory December 12, 2008 Ch. 5: Processor + Memory Overview of Implementation Combinational Elements Sequential Logic


slide-1
SLIDE 1

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

  • Ch. 5: Processor + Memory

December 12, 2008

  • Ch. 5: Processor + Memory
slide-2
SLIDE 2

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Processor: Datapath and Control

Goal:

implement hardware to execute instructions study issues of performance

Basic instruction set:

lw, sw (memory reference) add, sub, and, or, slt (arithmetic-logical) beq, j (branches)

  • Ch. 5: Processor + Memory
slide-3
SLIDE 3

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Generic Implementation

Figure: Cycle of Execution Instruction

  • Ch. 5: Processor + Memory
slide-4
SLIDE 4

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Outline

1

Overview of Implementation Two more details

2

Combinational Elements

3

Sequential Logic Elements Clock Latches and Flip Flops Register File Memory Design

4

MIPS Processor Design Pipelining Example: Load Instruction

  • Ch. 5: Processor + Memory
slide-5
SLIDE 5

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Steps of Executing an Instruction

1: All classes of instructions require initially:

Fetch instruction from memory Read value of CPU registers (1 or 2)

  • Ch. 5: Processor + Memory
slide-6
SLIDE 6

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Steps of Executing an Instruction

2: Common amongst all (except j): after reading registers, use ALU

calculate address (memory reference) to add (arithmetic-logical) compare (branches)

  • Ch. 5: Processor + Memory
slide-7
SLIDE 7

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Steps of Executing an Instruction

3: Different for each class

access memory to r/w (memory reference) write from ALU to register (arithmetic-logical) change PC to jump address (branch)

  • Ch. 5: Processor + Memory
slide-8
SLIDE 8

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Abstract View of Implementation

  • Ch. 5: Processor + Memory
slide-9
SLIDE 9

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Choice for Data

Can’t just join the wires

  • Ch. 5: Processor + Memory
slide-10
SLIDE 10

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Choice for Function

Figure: Some Units with Choice for Function

  • Ch. 5: Processor + Memory
slide-11
SLIDE 11

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Adding details

Figure: Adding multiplexors and control

  • Ch. 5: Processor + Memory
slide-12
SLIDE 12

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Logic Elements

Combinational elements

without memory; o/p depends on i/p basic elements: AND, OR, AND, . . . ALU, multiplexors

  • Ch. 5: Processor + Memory
slide-13
SLIDE 13

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Logic Elements

Combinational elements

without memory; o/p depends on i/p basic elements: AND, OR, AND, . . . ALU, multiplexors

Sequential or state elements

  • /p depends on i/p + current state

memory, registers

  • Ch. 5: Processor + Memory
slide-14
SLIDE 14

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Outline

1

Overview of Implementation Two more details

2

Combinational Elements

3

Sequential Logic Elements Clock Latches and Flip Flops Register File Memory Design

4

MIPS Processor Design Pipelining Example: Load Instruction

  • Ch. 5: Processor + Memory
slide-15
SLIDE 15

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Multiplexor

Select one i/p out of many, based on a signal

  • Ch. 5: Processor + Memory
slide-16
SLIDE 16

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Multiplexor

Select one i/p out of many, based on a signal 1-bit Mux with 4 input lines

Figure: Select I0, I1, I2, I3 based on S0, S1

  • Ch. 5: Processor + Memory
slide-17
SLIDE 17

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

32-bit Multiplexor

Figure: 32-bit Mux with 2 input lines

  • Ch. 5: Processor + Memory
slide-18
SLIDE 18

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

32-bit Multiplexor

Figure: 32-bit Multiplexor construction

  • Ch. 5: Processor + Memory
slide-19
SLIDE 19

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

One-bit Adder

Simple adder:

1 bit numbers carry in, carry out

  • Ch. 5: Processor + Memory
slide-20
SLIDE 20

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

One-bit Adder

Simple adder:

1 bit numbers carry in, carry out Figure: One-bit adder

  • Ch. 5: Processor + Memory
slide-21
SLIDE 21

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

One-bit Adder

Simple adder:

1 bit numbers carry in, carry out Figure: One-bit adder

cout = a · b + a · cin + b · cin sum = a xor b xor cin

  • Ch. 5: Processor + Memory
slide-22
SLIDE 22

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

32-bit adder

Constructing 32-bit adder from 1-bit adders

  • Ch. 5: Processor + Memory
slide-23
SLIDE 23

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Simple One-bit ALU

Figure: One-bit ALU: AND, OR, ADD

  • Ch. 5: Processor + Memory
slide-24
SLIDE 24

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Simple One-bit ALU

Figure: One-bit ALU: AND, OR, ADD

00 → AND 01 → OR 10 → ADD

  • Ch. 5: Processor + Memory
slide-25
SLIDE 25

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Adding Subtraction

Negate b and add

  • Ch. 5: Processor + Memory
slide-26
SLIDE 26

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Adding Subtraction

Negate b and add

Figure: Adding subtraction

  • Ch. 5: Processor + Memory
slide-27
SLIDE 27

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Adding Subtraction

Negate b and add

Figure: Adding subtraction Figure: Control signals

  • Ch. 5: Processor + Memory
slide-28
SLIDE 28

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

32-bit ALU

  • Ch. 5: Processor + Memory
slide-29
SLIDE 29

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Adding set-less-than

Can be implemented with subtraction For all except LSB: output is 0 For LSB: output is sign(A − B)

  • Ch. 5: Processor + Memory
slide-30
SLIDE 30

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Adding set-less-than

Can be implemented with subtraction For all except LSB: output is 0 For LSB: output is sign(A − B) Strategy:

Input of all ALU’s except LSB: 0 (passes through) Input of LSB: Set output of MSB

  • Ch. 5: Processor + Memory
slide-31
SLIDE 31

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

ALU Designs with SLT

Figure: ALU for non-MSB bits with 5 functions Figure: ALU for MSB bit (with shiny overflow detection!)

Operation: 3, BInvert: 1

  • Ch. 5: Processor + Memory
slide-32
SLIDE 32

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

32-bit ALU with SLT

Figure: 32-bit ALU with Set-Less-Than

  • Ch. 5: Processor + Memory
slide-33
SLIDE 33

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Outline

1

Overview of Implementation Two more details

2

Combinational Elements

3

Sequential Logic Elements Clock Latches and Flip Flops Register File Memory Design

4

MIPS Processor Design Pipelining Example: Load Instruction

  • Ch. 5: Processor + Memory
slide-34
SLIDE 34

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Clock and Clocking Methodology

When should a sequential element’s state be written/read

in a synchronous system Figure: Clock Signal

  • Ch. 5: Processor + Memory
slide-35
SLIDE 35

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Clock and Clocking Methodology

When should a sequential element’s state be written/read

in a synchronous system Figure: Clock Signal

Edge-triggered clocking

fall or rise is active causes state change usually rise

  • Ch. 5: Processor + Memory
slide-36
SLIDE 36

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Clock

I/p, O/p to combinational elements → sequential elements

  • Ch. 5: Processor + Memory
slide-37
SLIDE 37

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Clock

I/p, O/p to combinational elements → sequential elements

∵ they don’t store anything Figure: Combinational Logic behavior with Clock

  • Ch. 5: Processor + Memory
slide-38
SLIDE 38

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

S-R Latch

Simplest memory element Output = stored value Change stored value: set-reset Unclocked

  • Ch. 5: Processor + Memory
slide-39
SLIDE 39

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

S-R Latch

Simplest memory element Output = stored value Change stored value: set-reset Unclocked

Figure: S-R Latch Figure: Operation of the S-R Latch

  • Ch. 5: Processor + Memory
slide-40
SLIDE 40

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

D Latch

Output = stored value Stored value changes based on clock (enable)

Figure: D Latch Figure: D Latch Operation

  • Ch. 5: Processor + Memory
slide-41
SLIDE 41

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

D Latch

Output = stored value Stored value changes based on clock (enable)

Figure: D Latch Figure: D Latch Operation

Functioning:

C = 1 ⇒ Q = D C = 0 ⇒ Q = Dprevious

  • Ch. 5: Processor + Memory
slide-42
SLIDE 42

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

D Flip-Flop

Slightly more complicated than the latch

Figure: D Flip-Flop Figure: D Flip-Flop and Latch

  • Ch. 5: Processor + Memory
slide-43
SLIDE 43

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

D Flip-Flop

Slightly more complicated than the latch

Figure: D Flip-Flop Figure: D Flip-Flop and Latch

Latch: state changes with change in input and clock being asserted (=1) Flip-flop: state changes only on clock rise

  • Ch. 5: Processor + Memory
slide-44
SLIDE 44

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

D Flip-Flop

Slightly more complicated than the latch

Figure: D Flip-Flop Figure: D Flip-Flop and Latch

Latch: state changes with change in input and clock being asserted (=1) Flip-flop: state changes only on clock rise

not as transparent as latch Only flip-flops since using edge-triggered clocking

  • Ch. 5: Processor + Memory
slide-45
SLIDE 45

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Registers

Figure: Simple register made with flip-flop

  • Ch. 5: Processor + Memory
slide-46
SLIDE 46

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Register File Design

Set of registers

Read/write by supplying register no. (and data) Uses D Flip-Flop as building block

  • Ch. 5: Processor + Memory
slide-47
SLIDE 47

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Register File Design

Set of registers

Read/write by supplying register no. (and data) Uses D Flip-Flop as building block Figure: Register File Design 2 read ports, 1 write port

  • Ch. 5: Processor + Memory
slide-48
SLIDE 48

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

MIPS Register File

32, 32-bit registers

Figure: MIPS registers

5-bit read and write lines 32-bit data lines

  • Ch. 5: Processor + Memory
slide-49
SLIDE 49

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Reading from Register Files

Figure: Reading from RF - internals Figure: Reading from RF - the lines

  • Ch. 5: Processor + Memory
slide-50
SLIDE 50

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Writing to Register Files

Figure: Writing to RF - internals Figure: Writing to RF - the lines

  • Ch. 5: Processor + Memory
slide-51
SLIDE 51

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Introduction

Two technologies

Static Random Access Memory Dynamic Random Access Memory both volatile

Constructed from smaller chips Each chip has a configuration:

128M*1: 128M addressable locations of 1-bit each 16M*8: 16M addressable locations of 8-bit each

  • Ch. 5: Processor + Memory
slide-52
SLIDE 52

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Memory Chip Design

read/write: 8 bits wide 32K addressable locations Functioning:

CS (Chip Select): 1 for r/w R=0, W=0 ⇒ chip not being accessed R=0, W=1 ⇒ write data in Din at Address location R=1, W=0 ⇒ read into Dout the value from chip at location Address Figure: A 32K*8 RAM

  • Ch. 5: Processor + Memory
slide-53
SLIDE 53

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

SRAM Structure

Figure: Bsic Structural Design of 4X2 SRAM Chip

  • Ch. 5: Processor + Memory
slide-54
SLIDE 54

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Outline

1

Overview of Implementation Two more details

2

Combinational Elements

3

Sequential Logic Elements Clock Latches and Flip Flops Register File Memory Design

4

MIPS Processor Design Pipelining Example: Load Instruction

  • Ch. 5: Processor + Memory
slide-55
SLIDE 55

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Introduction

Implementation of MIPS System

Datapath: MIPS Processor + Memory also control unit

Single cycle design: all instructions take one clock-cycle

  • Ch. 5: Processor + Memory
slide-56
SLIDE 56

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Introduction

Implementation of MIPS System

Datapath: MIPS Processor + Memory also control unit

Single cycle design: all instructions take one clock-cycle

long clock period (accomodate slowest instruction) cannot reuse resources in a single cycle ⇒ duplication

  • Ch. 5: Processor + Memory
slide-57
SLIDE 57

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Datapath Elements

Figure: Elements used in MIPS Datapath

  • Ch. 5: Processor + Memory
slide-58
SLIDE 58

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Edge-triggered Methodology

Figure: Edge-triggered Methodology

  • Ch. 5: Processor + Memory
slide-59
SLIDE 59

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Edge-triggered Methodology

Figure: Edge-triggered Methodology

Execution strategy:

read content of a state element at beginning of clock cycle send values through a combinational element write result to a state element at end of clock cycle

edge-triggered ⇒ read and write in same cycle

  • Ch. 5: Processor + Memory
slide-60
SLIDE 60

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

PC Increment

Figure: PC Increment Circuit

  • Ch. 5: Processor + Memory
slide-61
SLIDE 61

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Datapath for R-type Instructions

  • Ch. 5: Processor + Memory
slide-62
SLIDE 62

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Datapath for load/save Instructions

Control signals:

lw, sw: ALU control=0010 (for address calculations) sw: Memread=0, Memwrite=1, Regwrite=0 lw: Memread=1, Memwrite=0, Regwrite=1

  • Ch. 5: Processor + Memory
slide-63
SLIDE 63

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Datapath for lw, sw and R-type Instructions

  • Ch. 5: Processor + Memory
slide-64
SLIDE 64

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Datapath for beq Instruction

  • Ch. 5: Processor + Memory
slide-65
SLIDE 65

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Datapath for R-type, lw/sw, beq Instructions

  • Ch. 5: Processor + Memory
slide-66
SLIDE 66

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Datapath and Control Circuit

  • Ch. 5: Processor + Memory
slide-67
SLIDE 67

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Control Signals and Opcode

Figure: Control signals depend on the Opcode

  • Ch. 5: Processor + Memory
slide-68
SLIDE 68

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Control Signal Generation

  • Ch. 5: Processor + Memory
slide-69
SLIDE 69

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Datapath for R-type, lw/sw, beq, j Instructions

Figure: The complete datapath

  • Ch. 5: Processor + Memory
slide-70
SLIDE 70

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Control Circuit with Jump Included

  • Ch. 5: Processor + Memory
slide-71
SLIDE 71

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

About Single-cycle design

Inefficient design Single-cycle design ⇒ CPI = ?

  • Ch. 5: Processor + Memory
slide-72
SLIDE 72

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

About Single-cycle design

Inefficient design Single-cycle design ⇒ CPI = ?

CPI = 1

Slowest instruction ≡ Longest possible machine path

  • Ch. 5: Processor + Memory
slide-73
SLIDE 73

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

About Single-cycle design

Inefficient design Single-cycle design ⇒ CPI = ?

CPI = 1

Slowest instruction ≡ Longest possible machine path

the load instruction; uses 5 functional units:

instruction memory register file ALU data memory register file

  • Ch. 5: Processor + Memory
slide-74
SLIDE 74

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

About Single-cycle design

Inefficient design Single-cycle design ⇒ CPI = ?

CPI = 1

Slowest instruction ≡ Longest possible machine path

the load instruction; uses 5 functional units:

instruction memory register file ALU data memory register file

Fastest?

  • Ch. 5: Processor + Memory
slide-75
SLIDE 75

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

About Single-cycle design

Inefficient design Single-cycle design ⇒ CPI = ?

CPI = 1

Slowest instruction ≡ Longest possible machine path

the load instruction; uses 5 functional units:

instruction memory register file ALU data memory register file

Fastest?

probably jump

  • Ch. 5: Processor + Memory
slide-76
SLIDE 76

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

About Single-cycle design

Acceptable if fewer instructions

  • Ch. 5: Processor + Memory
slide-77
SLIDE 77

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

About Single-cycle design

Acceptable if fewer instructions

used in older, simpler ISA implementations

  • Ch. 5: Processor + Memory
slide-78
SLIDE 78

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

About Single-cycle design

Acceptable if fewer instructions

used in older, simpler ISA implementations

terrible for ISA with complex instructions, such as floating point operations

  • Ch. 5: Processor + Memory
slide-79
SLIDE 79

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

About Single-cycle design

Acceptable if fewer instructions

used in older, simpler ISA implementations

terrible for ISA with complex instructions, such as floating point operations Dual problems:

violates ”make the common-case faster” principle (performance) need to duplicate hardware (cost)

  • Ch. 5: Processor + Memory
slide-80
SLIDE 80

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Improvements over Single-cycle Design

Two ways to improve (performance and cost):

multi-cycle design:

some instructions run faster than others

  • Ch. 5: Processor + Memory
slide-81
SLIDE 81

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Improvements over Single-cycle Design

Two ways to improve (performance and cost):

multi-cycle design:

some instructions run faster than others

Pipelining:

Overlap execution of instructions

  • Ch. 5: Processor + Memory
slide-82
SLIDE 82

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

  • Ch. 5: Processor + Memory
slide-83
SLIDE 83

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Pipelining: Introduction

Run multiple instructions in parallel Improves performance and hardware utilization similar to assembly line, laundry cleaning

  • Ch. 5: Processor + Memory
slide-84
SLIDE 84

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Example of Pipelining

  • Ch. 5: Processor + Memory
slide-85
SLIDE 85

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Introduction

First: identify steps in instruction execution

  • Ch. 5: Processor + Memory
slide-86
SLIDE 86

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Introduction

First: identify steps in instruction execution Five steps in any MIPS instruction:

Fetch instruction Read registers (while simultaneously decoding) Execute operation / calculate address Access data memory Write results to register

  • Ch. 5: Processor + Memory
slide-87
SLIDE 87

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Execution Time Improvement with Pipelining

Figure: Total time for each instruction Figure: Single-cycle non-pipelined execution

  • Ch. 5: Processor + Memory
slide-88
SLIDE 88

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Execution Time Improvement with Pipelining

Figure: Total time for each instruction Figure: Single-cycle non-pipelined execution

Total execution time: 800 * 3 = 2400 ps

  • Ch. 5: Processor + Memory
slide-89
SLIDE 89

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Execution Time Improvement with Pipelining

Figure: Pipelined execution

Total execution time: << 2400 ps

  • Ch. 5: Processor + Memory
slide-90
SLIDE 90

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Pipelined Execution

Clock cycle relates to single operation, rather than an instruction Accomodate the slowest operation: 200 ps Read and write to register can happen in different halves of same cycle

  • Ch. 5: Processor + Memory
slide-91
SLIDE 91

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Pipelining the Datapath

Figure: Datapath without pipelining

Data flows left-to-right through stages, except

write to register and write to PC does not affect current instruction

  • Ch. 5: Processor + Memory
slide-92
SLIDE 92

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Instruction Execution in Pipeline

Figure: Instruction execution in single-cycle datapath with pipeline

Virtually every instruction has its own datapath, but staggered

  • Ch. 5: Processor + Memory
slide-93
SLIDE 93

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Pipelinig the Datapath

Need to store data for an instruction as it passes through the datapath

for e.g., the value read from IM must be stored so it’s available for later stages ⇒ add registers at every stage

Each instruction advances to next stage on clock cycle

  • Ch. 5: Processor + Memory
slide-94
SLIDE 94

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Pipelining the Datapath

Figure: Pipelined Datapath

  • Ch. 5: Processor + Memory
slide-95
SLIDE 95

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

  • Ch. 5: Processor + Memory
slide-96
SLIDE 96

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

First Stage

Figure: Instruction Fetch

  • Ch. 5: Processor + Memory
slide-97
SLIDE 97

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

First Stage

Figure: Instruction Fetch

Fetch instruction; Increment PC (save in IF/ID register also)

  • Ch. 5: Processor + Memory
slide-98
SLIDE 98

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Second Stage

Figure: Instruction decode and register read

  • Ch. 5: Processor + Memory
slide-99
SLIDE 99

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Second Stage

Figure: Instruction decode and register read

Store in ID/EX registers:

Incremented PC address 2 register values sign extended offset

  • Ch. 5: Processor + Memory
slide-100
SLIDE 100

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Third Stage

Figure: Execute or Address Calculation

  • Ch. 5: Processor + Memory
slide-101
SLIDE 101

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Third Stage

Figure: Execute or Address Calculation

add register 1 to offset sum place in EX/MEM register

  • Ch. 5: Processor + Memory
slide-102
SLIDE 102

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Fourth Stage

Figure: Memory Access

  • Ch. 5: Processor + Memory
slide-103
SLIDE 103

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Fourth Stage

Figure: Memory Access

load the memory data into MEM/WB register

  • Ch. 5: Processor + Memory
slide-104
SLIDE 104

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Fifth Stage

Figure: Write Back

  • Ch. 5: Processor + Memory
slide-105
SLIDE 105

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Fifth Stage

Figure: Write Back

Read from MEM/WB register into register file Error?

  • Ch. 5: Processor + Memory
slide-106
SLIDE 106

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Fifth Stage

Figure: Write Back

Read from MEM/WB register into register file Error?

save address for register file is not preserved

  • Ch. 5: Processor + Memory
slide-107
SLIDE 107

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Corrected Pipeline Datapath

Figure: Correction made for load instruction

  • Ch. 5: Processor + Memory
slide-108
SLIDE 108

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Control Lines

Store and pass Control signals as well

  • Ch. 5: Processor + Memory
slide-109
SLIDE 109

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Control Lines

Store and pass Control signals as well

Figure: Including control signals

  • Ch. 5: Processor + Memory
slide-110
SLIDE 110

Overview of Implementation Combinational Elements Sequential Logic Elements MIPS Processor Design

Complete Pipelined Architecture

Figure: Datapath and Control of Pipelined MIPS

  • Ch. 5: Processor + Memory