fetch-execute cycle fetch the next instruction decode execute it

Tags:

Post on 17-Jan-2016

279 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Machine Code and the Fetch-Execute Cycle

Fetch-Execute Cycle

• Fetch the next instruction• Decode• Execute It

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

PC

MBR

CIR

Op-Code Operand

ACC

ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

PC

2000

MBR

CIR

Op-Code Operand

ACC

ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

1 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

2000

PC

2000

MBR

CIR

Op-Code Operand

ACC

ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

1 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

2000

PC

2002

MBR

CIR

Op-Code Operand

ACC

ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

1 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

2000

PC

2002

MBR

CIR

Op-Code Operand

ACC

ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

1 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

2000

PC

2002

MBR

100A

CIR

Op-Code Operand

ACC

ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

FETCH1

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

2000

PC

2002

MBR

100A

CIR

Op-Code Operand

0001 0000 0000 1010

ACC

ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

1 DECODE

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

2000

PC

2002

MBR

100A

CIR

Op-Code Operand

0001 0000 0000 1010

ACCALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

DECODE

Instruction Decoded

1

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

2000

PC

2002

MBR

100A

CIR

Op-Code Operand

0001 0000 0000 1010

ACC

0AALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

EXECUTE1

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

2002

PC

2002

MBR

CIR

Op-Code Operand

ACC

0AALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

2 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

2002

PC

2004

MBR

CIR

Op-Code Operand

ACC

0AALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

2 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

2002

PC

2004

MBR

CIR

Op-Code Operand

ACC

0AALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

2 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

2002

PC

2004

MBR

8019

CIR

Op-Code Operand

ACC

0AALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

FETCH2

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

2002

PC

2004

MBR

8019

CIR

Op-Code Operand

1000 0000 0001 1001

ACC

0AALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

2 DECODE

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

2000

PC

2004

MBR

8019

CIR

Op-Code Operand

1000 0000 0001 1001

ACC

0AALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

DECODE

Instruction Decoded

2

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 00

001A 00

001B 00

001C 00

MAR

0019

PC

2004

MBR

0A

CIR

Op-Code Operand

1000 0000 0001 1001

ACC

0AALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

EXECUTE2

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

0019

PC

2004

MBR

0A

CIR

Op-Code Operand

1000 0000 0001 1001

ACC

0AALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

2 EXECUTE

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2004

PC

2004

MBR

CIR

Op-Code Operand

ACC

ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

3 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2004

PC

2006

MBR

CIR

Op-Code Operand

ACC

ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

3 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2004

PC

2006

MBR

CIR

Op-Code Operand

ACC

ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

3 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2004

PC

2006

MBR

1005

CIR

Op-Code Operand

ACC

ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

FETCH3

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2004

PC

2006

MBR

1005

CIR

Op-Code Operand

0001 0000 0000 0101

ACC

ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

3 DECODE

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2004

PC

2006

MBR

1005

CIR

Op-Code Operand

0001 0000 0000 0101

ACCALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

DECODE

Instruction Decoded

3

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2004

PC

2006

MBR

1005

CIR

Op-Code Operand

0001 0000 0000 0101

ACC

05ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

EXECUTE3

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2006

PC

2006

MBR

CIR

Op-Code Operand

ACC

05ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

4 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2006

PC

2008

MBR

CIR

Op-Code Operand

ACC

05ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

4 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2006

PC

2008

MBR

CIR

Op-Code Operand

ACC

05ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

4 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2006

PC

2008

MBR

4019

CIR

Op-Code Operand

ACC

05ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

FETCH4

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2006

PC

2008

MBR

4019

CIR

Op-Code Operand

0100 0000 0001 1001

ACC

05ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

4 DECODE

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2006

PC

2008

MBR

4019

CIR

Op-Code Operand

0100 0000 0001 1001

ACC

05ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

DECODE

Instruction Decoded

4

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

019

PC

2008

MBRCIR

Op-Code Operand

0100 0000 0001 1001

ACC

05ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

EXECUTE4

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

019

PC

2008

MBRCIR

Op-Code Operand

0100 0000 0001 1001

ACC

05ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

EXECUTE4

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

019

PC

2008

MBR

0A

CIR

Op-Code Operand

0100 0000 0001 1001

ACC

05ALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

EXECUTE4

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

019

PC

2008

MBR

0A

CIR

Op-Code Operand

0100 0000 0001 1001

ACCALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

EXECUTE4

0A + 05 = 0F

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

019

PC

2008

MBR

0A

CIR

Op-Code Operand

0100 0000 0001 1001

ACC

0FALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

EXECUTE4

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2008

PC

2008

MBR

CIR

Op-Code Operand

ACC

0FALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

5 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2008

PC

2010

MBR

CIR

Op-Code Operand

ACC

0FALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

5 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2008

PC

2010

MBR

CIR

Op-Code Operand

ACC

0FALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

5 FETCH

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2008

PC

2010

MBR

801A

CIR

Op-Code Operand

ACC

0FALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

FETCH5

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2008

PC

2010

MBR

801A

CIR

Op-Code Operand

1000 0000 0001 1100

ACC

0FALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

5 DECODE

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

2008

PC

2010

MBR

801A

CIR

Op-Code Operand

1000 0000 0001 1100

ACC

0FALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

DECODE

Instruction Decoded

5

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 00

001B 00

001C 00

MAR

001A

PC

2010

MBR

0F

CIR

Op-Code Operand

1000 0000 0001 1100

ACC

0FALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

5 EXECUTE

Instruction Memory

2000 100A (LOAD #10)

2002 8019 (STORE 25)

2004 1005 (LOAD #05)

2006 4019 (ADD 25)

2008 801A (STORE 26)

Data Memory

0018 00

0019 0A

001A 0F

001B 00

001C 00

MAR

001A

PC

2010

MBR

0F

CIR

Op-Code Operand

1000 0000 0001 1100

ACC

0FALU

PC Program Counter

MAR Memory Address Register

MBR Memory Buffer Register

CIR Current Instruction Register

ALU Arithmetic and Logic Unit

ACC Accumulator

5 EXECUTE

top related