chapter06 cpu design

52
2011/3/22 1 Chapter 6 CPU DESIGN

Upload: billydelacru167

Post on 08-Apr-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 1/52

Page 2: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 2/52

2011/3/22 2

Specifying a CPU

� Fetch cycle± Fetch an instruction from memory, then go to the

decode cycle.� Decode cycle

± Decode the instruction-that is, determine whichinstruction has been fetched, then go to the

execute cycle fit that instruction.

� Execute cycle± Execute the instruction, then go to fetch the next

instruction.

Page 3: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 3/52

2011/3/22 3

Generic CPU state diagram

Page 4: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 4/52

2011/3/22 4

Specifications for a very simple CPU

� To illustrate the CPU design process,

consider this small and somewhat impractical

CPU. It can access 64 bytes of memory, eachbyte being 8 bits wide.

� The CPU does this by outputting 6-bit

address on its output pins A[5..0] and reading

in the 8-bit value from memory on its inputsD[7..0].

Page 5: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 5/52

2011/3/22 5

Specifications for a very simple CPU

� AC (same as in SAP-1)± An 8-bit accumulator labeled AC

� AR (MAR in SAP-1)± A 6-bit address register 

� PC (same as in SAP-1)± A 6-bit program counter 

� DR (B in SAP-1 & MBR in SAP-2)± A 8-bit data register 

� IR (same as in SAP-1)± A 2-bit instruction register 

Page 6: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 6/52

2011/3/22 6

Instruction set for the very simple CPU

Instruction Instruction Code Operation

ADD 00AAAAAA ACnAC+M[AAAAAA]

AND 01AAAAAA ACnAC^M[AAAAAA]

JMP 10AAAAAA GOTO AAAAAA

INC 11AAAAAA ACnAC+1

Page 7: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 7/52

2011/3/22 7

Fetching Instructions From Memory

� FETCH1� ARnPC

� FETCH 2� DRnM, PCnPC+1

� FETCH 3� IRnDR[7..6], ARnDR[5..0]

Page 8: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 8/52

2011/3/22 8

Fetch cycle for the very simple CPU

Page 9: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 9/52

Page 10: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 10/52

2011/3/22 10

Fetch and decode cycles for the very

simple CPU

Page 11: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 11/52

Page 12: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 12/52

2011/3/22 12

Executing Instruction

� JMP

± JMP1: PCn DR[5..0]

� INC± INC1: ACn AC + 1

Page 13: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 13/52

2011/3/22 13

Complete state diagram for the very

simple CPU

Page 14: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 14/52

2011/3/22 14

Establishing Required Data Paths

� The operations associated with each state for 

this CPU are

� FETCH1: ARnPC

� FETCH 2: DRnM, PCnPC+1

� FETCH 3: IRnDR[7..6], ARnDR[5..0]

� ADD1: DRnM

� ADD2: ACnAC+DR

� JMP1: PCn DR[5..0]

� INC1: ACn AC + 1

Page 15: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 15/52

2011/3/22 15

Establishing Required Data Paths

� To design the data paths, we can take one of 

two approaches.

± Direct path� Between each pair of components that transfer data.

± Bus

� Within the CPU and route data between components via

the bus.

Page 16: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 16/52

2011/3/22 16

Preliminary register section for the very

simple CPU

Page 17: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 17/52

Page 18: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 18/52

2011/3/22 18

Final register section for the very simple

CPU

Page 19: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 19/52

2011/3/22 19

Design a very simple ALU

� The ALU for this CPU performs only twofunctions

± ADDs its two inputs or � Using a standard 8-bit parallel adder 

± Logically ANDs its two inputs� Using eight 2-input AND gates

� The outputs of the adder and AND gates areinput to an 8-bit 2 to1 multiplexer.

� The control input of the MUX is called S (for select)

Page 20: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 20/52

2011/3/22 20

A very simple ALU

Page 21: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 21/52

2011/3/22 21

Designing The Control Unit Using

Hardwired Control

� There are two primary methodologies for 

designing control.

± Hardwired control� Uses sequential and combinatorial logic to generate

control signals

± Microsequenced control

� Uses a lookup memory to output the control signals

Page 22: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 22/52

2011/3/22 22

Designing The Control Unit Using

Hardwired Control

� The simplest control unit has threecomponents

± Counter � Contains the current state

± Decoder � Takes the current states and generates individual signals

for each state

± Logic� Take the individual state signals and generate the control

signals for each component, as well as the signals tocontrol the counter 

Page 23: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 23/52

2011/3/22 23

Generic hardwired control unit

Page 24: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 24/52

2011/3/22 24

Generic hardwired control unit

� For this CPU, there are a total of 9 states.

� 4-bit counter needed.

Page 25: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 25/52

2011/3/22 25

Control signals for Counter 

� INC

± Asserted when the control unit is traversing sequential states,

during FETCH1, FETCH2, ADD1, and AND1

� CLR

± Asserted at the end of each execute cycle to return to the

fetch cycle; this happens during ADD2, AND2, JMP1, and

INC1

� LD± Asserted at the end of fetch cycle during state FETCH3

Page 26: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 26/52

2011/3/22 26

Hardwired control unit for the Very Simple

CPU

Page 27: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 27/52

2011/3/22 27

Control signal generation for the Very

Simple CPU

Page 28: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 28/52

2011/3/22 28

Design Verification

� 0: ADD 4

� 1: AND 5

� 2: INC

� 3: JMP 0

� 4: 27H

� 5: 39H

Page 29: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 29/52

2011/3/22 29

Execution Trace

Page 30: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 30/52

2011/3/22 30

Design And Implementation Of A

Relatively Simple CPU

� Specifications for relatively simple CPU

� Fetching and decoding instruction

� Executing instruction

� Establishing data paths

� Design of a relatively simple ALU

� Designing the control unit using hardwiredcontrol

� Design verification

Page 31: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 31/52

2011/3/22 31

Design And Implementation Of A

Relatively Simple CPU

� 16-bit address register, AR 

� 16-bit program counter, PC

� 8-bit data register, DR 

� 8-bit instruction register, IR 

� 8-bit temporary register, TR � 64K bytes of memory (16-bit address)

Page 32: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 32/52

2011/3/22 32

Specifications for relatively simple CPU

Page 33: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 33/52

2011/3/22 33

Fetching and decoding instruction

Page 34: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 34/52

2011/3/22 34

Instruction format� 25 : JUMP 1234H

� The instruction would be stored in memory as

25 : 0000 0101 (JUMP) ± OP Code

26 : 0011 0100 (34H) ± low-order 8 bits of address

27 : 0001 0010 (12H) ± high-order 8 bits of address

� Save memory !

Page 35: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 35/52

2011/3/22 35

� NOP± NOP1 : (No operation)

� LDAC± LDAC1 : DRnM, PCnPC+1, ARnAR+1 (high-order half 

address)

± LDAC2 : TRnDR, DRnM, PCnPC+1 (TR ± low-order)

± LDAC3 : ARnDR, TR (DR ± high-order)

± LDAC4 : DRnM

± LDAC5 : ACnDR

�FETCH1: ARnPC

�FETCH 2: DRnM, PCnPC+1

�FETCH 3: IRnDR, ARnPC (low-order half address)

Page 36: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 36/52

2011/3/22 36

Executing instruction

� STAC

± STAC1 : DRnM, PCnPC+1, ARnAR+1

± STAC2 : TRnDR, DRnM, PCnPC+1± STAC3 : ARnDR, TR

± STAC4 : DRnAC

± STAC5 : MnDR

� MVAC and MOVR

± MVAC1 : RnAC

± MOVR1 : ACnR

Page 37: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 37/52

2011/3/22 37

� JMPZ and JPNZ± JMPZY1 : DRnM, ARnAR+1

± JMPZY2 : TRnDR, DRnM

± JMPZY3 : PCnDR, TR

± JMPZN1 : PCnPC+1

± JMPZN2 : PCnPC+1

± JPNZY1 : DRnM, ARnAR+1± JPNZY2 : TRnDR, DRnM

± JPNZY3 : PCnDR, TR

± JPNZN1 : PCnPC+1

± JPNZN2 : PCnPC+1

�FETCH1: ARnPC

�FETCH 2: DRnM, PCnPC+1

�FETCH 3: IRnDR, ARnPC (low-order half address)

Page 38: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 38/52

2011/3/22 38

Executing instruction

� The remaining instruction

Page 39: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 39/52

2011/3/22 39

Complete state diagram for the Relatively

Simple CPU

Page 40: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 40/52

2011/3/22 40

Establishing data paths

� Refer to page 242

� AR and PC must be able to perform a parallel

load and increment� DR, IR, R, and TR must be able to load data

in parallel

� AC will require a lot of work, as will Z

Page 41: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 41/52

Page 42: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 42/52

2011/3/22 42

Generic bidirectional data pin

Page 43: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 43/52

2011/3/22 43

Final register section for the Relatively

Simple CPU

Page 44: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 44/52

2011/3/22 44

Design of a relatively simple ALU

�� All transfers that modify the contents of ACAll transfers that modify the contents of AC

� Indicate the source of their operands ± arith sec

� Rewriting each operation as the sum of twovalues and a carry ± implemented by adder 

Page 45: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 45/52

2011/3/22 45

A relatively Simple ALU

Arith secLogic sec

Page 46: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 46/52

2011/3/22 46

Designing the the control unit using

hardwired controlState generation for a Relatively Simple CPU Input to CU

Page 47: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 47/52

2011/3/22 47

control signal values for a Relatively

Simple CPU - part� Reference table 6.6 =ILDAC^T5

Page 48: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 48/52

Page 49: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 49/52

2011/3/22 49

Register section for he relatively Simple

CPU using multiple buses

Page 50: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 50/52

2011/3/22 50

Exercise

� 2, 6, 7, 10, 19

Page 51: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 51/52

2011/3/22 51

Real World Example: internal architecture

of the 8085 microprocessor ± Self study

� ALU

� Register section

� Address buffer and address/data buffer 

� Interrupt control block

� Control section

� Instruction decoder and machine cycleencoding block

� Serial I/O control block

Page 52: Chapter06 CPU Design

8/7/2019 Chapter06 CPU Design

http://slidepdf.com/reader/full/chapter06-cpu-design 52/52

2011/3/22 52

Internal organization of the 8085

microprocessor