Topic 14 How CPU works? Professor Peter YK Cheung Dyson School of - - PowerPoint PPT Presentation

topic 14 how cpu works
SMART_READER_LITE
LIVE PREVIEW

Topic 14 How CPU works? Professor Peter YK Cheung Dyson School of - - PowerPoint PPT Presentation

Topic 14 How CPU works? Professor Peter YK Cheung Dyson School of Design Engineering URL: www.ee.ic.ac.uk/pcheung/teaching/DE1_EE/ E-mail: p.cheung@imperial.ac.uk PYKC 9 June 2020 Topic 14 Slide 1 DE 1.3 - Electronics 1 A Very Simple


slide-1
SLIDE 1

Topic 14 Slide 1 PYKC 9 June 2020 DE 1.3 - Electronics 1

Topic 14 How CPU works?

URL: www.ee.ic.ac.uk/pcheung/teaching/DE1_EE/ E-mail: p.cheung@imperial.ac.uk Professor Peter YK Cheung Dyson School of Design Engineering

slide-2
SLIDE 2

Topic 14 Slide 2 PYKC 9 June 2020 DE 1.3 - Electronics 1

A Very Simple Central Processing Unit

◆ Based on von Neumann model ◆ Stored program and data in memory ◆ Central Processing Unit (CPU)

contains:

  • Arithmetic/Logic Unit (ALU)
  • Control Unit
  • Registers

CPU Memory I/O

◆ Look into memory, sees ‘1’ and ‘0’. Meaning depends on context. ◆ All computers requires at least three types of signals (buses):

❖ address bus - which location ❖ data bus - carries the contents of the location ❖ control bus - governs the information transfer

slide-3
SLIDE 3

Topic 14 Slide 3 PYKC 9 June 2020 DE 1.3 - Electronics 1

A Very Simple CPU

slide-4
SLIDE 4

Topic 14 Slide 4 PYKC 9 June 2020 DE 1.3 - Electronics 1

A Very simple CPU

◆ Let us design a simple processor MU0 with 16-bit instruction and minimal

hardware:-

  • Program Counter (PC) - holds address of the next instruction to exec
  • Accumulator (ACC) - holds data being processed
  • Arithmetic Logic Unit (ALU) - performs operations on data
  • Instruction Register (IR) - holds current instruction code being executed

◆ Let us further assumes that the processor only has 8 instructions and can

  • nly access a maximum of 4k 16-bit words (212) of memory.

◆ The 16-bit instruction code (machine code) has a format: ◆ Note top 4 bits define the operation code (opcode) and the bottom 12 bits

define the memory address of the data

slide-5
SLIDE 5

Topic 14 Slide 5 PYKC 9 June 2020 DE 1.3 - Electronics 1

Instruction Set

1 2 3 4 5 6 7

slide-6
SLIDE 6

Topic 14 Slide 6 PYKC 9 June 2020 DE 1.3 - Electronics 1

Caught in the Act!

◆ CPU reading the first op-code PC ACC IR decoder ALU addr reg data reg

MU0

000 LDA 02E

0 02E

Assembly program machine code

001 ADD 02F

2 02F

002 STO 030

1 030

003

STP

7 000

004

  • 005

006

  • 02E

AAAA

AAAA

02F

1111 1111

030

  • ...
slide-7
SLIDE 7

Topic 14 Slide 7 PYKC 9 June 2020 DE 1.3 - Electronics 1

Instruction 1: LDA 02E

PC=000 ACC IR=002E decoder ALU addr reg data reg

MU0

0 02E

machine code

2 02F 1 030 7 000

  • AAAA

1111

  • PC = 001

ACC=AAAA

IR=002E decoder ALU addr reg data reg

MU0

Cycle 1 Cycle 2

000 001 002 003 004 005 006 02E 02F 030

... Fetch Instruction Read Data

slide-8
SLIDE 8

Topic 14 Slide 8 PYKC 9 June 2020 DE 1.3 - Electronics 1

Instruction 2: ADD 02F

PC=001

ACC=AAAA

IR=202F decoder ALU addr reg data reg

MU0

0 02E

machine code

2 02F 1 030 7 000

  • AAAA

1111

  • PC=002

ACC=AAAA

IR=202F decoder ALU addr reg data reg

MU0

Cycle 1 Cycle 2

000 001 002 003 004 005 006 02E 02F 030

... Fetch Instruction

Do ADD

slide-9
SLIDE 9

Topic 14 Slide 9 PYKC 9 June 2020 DE 1.3 - Electronics 1

Instruction 3: ST0 030

PC=002

ACC=BBBB

IR=1030 decoder ALU addr reg data reg

MU0

0 02E

machine code

2 02F 1 030 7 000

  • AAAA

1111 BBBB

  • PC=003

ACC=BBBB

IR=1030 decoder ALU addr reg data reg

MU0

Cycle 1 Cycle 2

000 001 002 003 004 005 006 02E 02F 030

... Fetch Instruction

Write Data

slide-10
SLIDE 10

Topic 14 Slide 10 PYKC 9 June 2020 DE 1.3 - Electronics 1

Instruction 4: STP

PC=003

ACC=BBBB

IR=7000 decoder ALU addr reg data reg

MU0

0 02E

machine code

2 02F 1 030 7 000

  • AAAA

1111 BBBB

  • Cycle 1

000 001 002 003 004 005 006 02E 02F 030

... Fetch Instruction

slide-11
SLIDE 11

Topic 14 Slide 11 PYKC 9 June 2020 DE 1.3 - Electronics 1

A video on “How a CPU is made?”