• No results found

w10_processor_structure_and_functions1.pdf

N/A
N/A
Protected

Academic year: 2020

Share "w10_processor_structure_and_functions1.pdf"

Copied!
18
0
0

Loading.... (view fulltext now)

Full text

(1)

W

ILLIAM

S

TALLINGS

C

OMPUTER

O

RGANIZATION

AND

A

RCHITECTURE

8

TH

E

DITION

Chapter 12

Processor Structure and Function

CPU S

TRUCTURE

 CPU must:

 Fetch instructions

 Interpret instructions

 Fetch data

 Process data

 Write data

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(2)

CPU W

ITH

S

YSTEMS

B

US

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

3

CPU I

NTERNAL

S

TRUCTURE

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(3)

R

EGISTERS

 CPU must have some working space (temporary

storage)

 Called registers

 Number and function vary between processor

designs

 One of the major design decisions  Top level of memory hierarchy

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

5

U

SER

V

ISIBLE

R

EGISTERS

 General Purpose  Data

 Address

 Condition Codes

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(4)

GENERAL PURPOSE REGISTERS (1)

 May be true general purpose  May be restricted

 May be used for data or addressing  Data Registers hold only Data  Address Register

 Segment Pointer

 Index Register

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

7

GENERAL PURPOSE REGISTERS (2)

 If we Make them general purpose

 Increase flexibility and programmer options

 Increase instruction size & complexity

 If we Make them specialized

 Smaller (faster) instructions

 Less flexibility

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(5)

H

OW

M

ANY

GP R

EGISTERS

?

 Between 8 - 32

 If Fewer = more memory references

 More does not reduce memory references and

takes up processor real estate

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

9

R

EGISTER

H

OW BIG

?

 Large enough to hold full address  Large enough to hold full word

 Often possible to combine two data registers

 C programming

 double int a;

 long int a;

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(6)

C

ONDITION

C

ODE

R

EGISTERS

 Sets of individual bits

 e.g. result of last operation was zero

 Can be read (implicitly) by programs

 e.g. Jump if zero

 Can not (usually) be set by programs

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

11

C

ONTROL

& S

TATUS

R

EGISTERS

 Program Counter

 Instruction Decoding Register  Memory Address Register  Memory Buffer Register

 Revision: what do these all do?

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(7)

P

ROGRAM

S

TATUS

W

ORD

 A set of bits

 Includes Condition Codes  Sign of last result

 Zero  Carry  Equal  Overflow

 Interrupt enable/disable  Supervisor

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

13

O

THER

R

EGISTERS

 May have registers pointing to:

 Process control blocks (see O/S)

 Interrupt Vectors (see O/S)

 N.B. CPU design and operating system design

are closely linked

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(8)

E

XAMPLE

R

EGISTER

O

RGANIZATIONS

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

15

I

NDIRECT

C

YCLE

 May require memory access to fetch operands  Indirect addressing requires more memory

accesses

 Can be thought of as additional instruction

subcycle

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(9)

I

NSTRUCTION

C

YCLE WITH

I

NDIRECT

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

17

I

NSTRUCTION

C

YCLE

S

TATE

D

IAGRAM

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(10)

D

ATA

F

LOW

(I

NSTRUCTION

F

ETCH

)

 PC contains address of next instruction  Address moved to MAR

 Address placed on address bus  Control unit requests memory read

 Result placed on data bus, copied to MBR, then to

IR

 Meanwhile PC incremented by 1

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

19

D

ATA

F

LOW

(D

ATA

F

ETCH

)

 IR is examined

 If indirect addressing, indirect cycle is performed

 Right most N bits of MBR transferred to MAR

 Control unit requests memory read

 Result (address of operand) moved to MBR

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(11)

D

ATA

F

LOW

(F

ETCH

D

IAGRAM

)

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

21

D

ATA

F

LOW

(I

NDIRECT

D

IAGRAM

)

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(12)

D

ATA

F

LOW

(E

XECUTE

)

 May take many forms

 Depends on instruction being executed  May include

 Memory read/write

 Input/Output

 Register transfers

 ALU operations

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

23

P

REFETCH

 Fetch accessing main memory

 Execution usually does not access main memory  Can fetch next instruction during execution of

current instruction

 Called instruction prefetch

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(13)

I

MPROVED

P

ERFORMANCE

 But not doubled:

 Fetch usually shorter than execution

Prefetch more than one instruction?

 Any jump or branch means that prefetched instructions are not the required instructions  Add more stages to improve performance

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

25

P

IPELINING

 Fetch instruction FI  Decode instruction DI  Calculate operands CO  Fetch operands FO  Execute instructions EI

 Write result WO

 Overlap these operations

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(14)

S

IX

S

TAGE

I

NSTRUCTION

P

IPELINE

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

27

T

IMING

D

IAGRAM FOR

I

NSTRUCTION

P

IPELINE

O

PERATION

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(15)

T

HE

E

FFECT OF A

C

ONDITIONAL

B

RANCH ON

I

NSTRUCTION

P

IPELINE

O

PERATION

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

29

S

PEEDUP

F

ACTORS

WITH

I

NSTRUCTION

P

IPELINING

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(16)

M

ULTIPLE

S

TREAMS

 Have two pipelines

 Prefetch each branch into a separate pipeline  Use appropriate pipeline

 Leads to bus & register contention

 Multiple branches lead to further pipelines being

needed

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

31

P

REFETCH

B

RANCH

T

ARGET

 Target of branch is prefetched in addition to

instructions following branch

 Keep target until branch is executed  Used by IBM 360/91

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(17)

I

NTEL

80486 P

IPELINING  Fetch

 From cache or external memory

 Put in one of two 16-byte prefetch buffers

 Fill buffer with new data as soon as old data consumed  Average 5 instructions fetched per load

 Independent of other stages to keep buffers full  Decode stage 1

 Opcode & address-mode info  At most first 3 bytes of instruction

 Can direct D2 stage to get rest of instruction  Decode stage 2

 Expand opcode into control signals  Computation of complex address modes  Execute

 ALU operations, cache access, register update  Writeback

 Update registers & flags

 Results sent to cache & bus interface write buffers

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

33

ARM P

ROCESSOR

O

RGANIZATION

 Many variations depending on ARM version  Data exchanged between processor and memory

through data bus

 Data item (load/store) or instruction (fetch)  Instructions go through decoder before execution  Pipeline and control signal generation in control

unit

 Data goes to register file

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

(18)

P

RIVILEGED

M

ODES  System Mode

 Not exception

 Uses same registers as User mode  Can be interrupted by…

 Supervisor mode  OS

 Software interrupt usedd to invoke operating system services  Abort mode

 memory faults  Undefined mode

 Attempt instruction that is not supported by integer core

coprocessors

 Fast interrupt mode

 Interrupt signal from designated fast interrupt source  Fast interrupt cannot be interrupted

 May interrupt normal interrupt  Interrupt mode

 Interrupt signal from any other interrupt source

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

li

R

iz

vi

35

ARM R

EGISTER

O

RGANIZATION

 37 x 32-bit registers

 31 general-purpose registers

 Some have special purposes

 E.g. program counters

 Six program status registers

 Registers in partially overlapping banks

 Processor mode determines bank

P

re

pa

re

d

b

y

E

n

gi

n

ee

r

S

M

A

sim

A

References

Related documents

From north to south, sites are (1) Jedediah Smith and Del Norte Coast Redwoods State Park, (2) USFS Redwood Experimental Forest, (3) Prairie Creek Redwoods State Park, (4)

Table 2 reports the segmentation performance produced by majority voting, joint label fusion using a single imaging modal- ity and joint label fusion using two imaging modalities

“to support the academic and intellectual mission of Texas Tech University through the collection, preservation, documentation, and research of scientific and cultural material, and

Specifically, I introduce putty-clay production technology in the style of Gilchrist and Williams (2000, 2004, 2005) into an international trade model considered by Baxter (1992),

With rare exceptions, HPAI viruses found in nature have always contained the H5 or H7 hemagglutinin.10,61-63 Two exceptions were H10 viruses that technically fit the

(You must make a request in writing to obtain access to your healtll intormation. You may obtain a form to request access by using the contact information listed at the end of

The intent of the survey was to uncover the attitudes and behaviors of clinicians involved with the electronic medical record, either those responsible for the actual documentation

The interview questions concerned the teachers’ teaching contexts (institution, workload, colleagues, students, professional development activities), attitudes towards