CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4...

35
CBP 2005-6 Comp 1017 Digital Techno logies 1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley

Transcript of CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4...

Page 1: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 1

Let’s make a Computer

… at least the CPU …

Pentium 4

Pentium 3

Opteron

Ultra Sparc 1

21364Itanium 2 McKinley

Page 2: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 2

Page 3: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 3

CPU

Memory

Keyboard

VDU

Computer Program (Code)

1 do this

2 do that

3 now this

4 goto 1

Page 4: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 4

Program Memory

2. High Level Language like ‘C’

3. Assembler Instructions

mov ax,[x]

mov bx,[y]

add ax, bx

mov [w],ax

w = x + y ;

1. Application

Let’s consider a spreadsheet cell which

adds two numbers x + y. This cell and its instruction

is in memory. But it is REPRESENTED in

different ways

Inside the CPU

Page 5: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 5

Pentium

Data Cache Code Cache

Instruction Fetch

Instruction Decode

Execution Unit

Page 6: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 6

Minimalist CPU

What do we need to build a CPU?

“Execution Unit”ALU (Arithmetic Logic Unit)

Memory (to store intermediate data)

Input Output

A good Name

Page 7: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 7

Arithmetic Logic Unit

Input A Input B

Output

ALU

Integer Execution Unit

5

3 2

add 1

3 2

sub

Page 8: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 8

Input A Input B

Output

ALU

ALU

MMX instructions add bits of images together! Useful for multimedia

Multimedia MMX

Page 9: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 9

5

3 2

add

0

1

2

3

4

3

2

5

Processing Idea Nr. 1

Move data from memory

Move data into memory3.

2.

1.

Memory DRAM, Hard Disk ..

Move data in and out of data memory store

Page 10: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 10

5

3 2

add

0

1

2

3

4

3

2

5

Processing Idea Nr.2

IP

(Code Memory)

mov 3 in from memory

mov 2 in from memory

add the two numbers

mov the result to memory

Instruction Memory

Program

Move instructions into CPU from code memory

Page 11: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 11

Registers

0

1

4

6 8

6

8

4

Registers are high-speed memory on the CPU chip

Parking places for data on the move

AX and BX are used for ALU operations

MAR is memory address register, here 4. So result, 6+8=14 will go into memory cell address 4

AX BX

MAR

Page 12: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 12

ip

Data Memory

Instruction

Memory

0

1

4

mar

Our computer so far …

Page 13: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 13

Instruction

Memory

A couple of extra bits

Data Memory

0

1

4

Instruction Register

Memory Data Register 2

8

34

34

2

Data

Address

add ax,bx

1. Line of code goes in

2. Electrical bit signals come out

2.

1.

• Energize ax• Energize bx• Select ALU “add"

Page 14: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 14

SAM-2

Page 15: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 15

Moving data into Registers

Instruction

Memory

0

1

2

mar 3

4

mov ax , [1]

85

8

7

6

1

BXAXmov ax , [1] mov bx , [2]mov bx , [2] 7

For example …

Page 16: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 16

Moving data into Memory

Instruction

Memory

0

1

2

mar 3

4

mov [3] , ax

85

8

7

6

1

BXAXmov [3] , axmov [0], bx

mov [0] , bx 7

For example …

8

7

Page 17: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 17

Adding Numbers

Instruction

Memory

0

1

2

mar 3

4

add ax , bx

85

7

6

1

BXAXAdd ax,bx

7

For example …

… this means ‘ add ax to bx,

put the answer in ax’8

8 7

15

Page 18: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 18

I’ve never wrestled with

such a complex

problem before

It must take a lot of organization and control !

Page 19: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 19

Pentium

Organization and

control

Page 20: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 20

Fetch-Execute Cycle

1. Fetch instruction from memory

2. Decode the instruction and read any

registers

3. Do any ALU operations (execute units)

5. Write back results to registers

(Organization and Control)

add ax , bx

4. Do any Memory Access

ALU <- ax ALU <- bx

ax + bx

(Data cache)

ax <- ALU

None needed

Page 21: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 21

add ax , bx

add ax,bx

add ax

0

1

4

3

2

bx

Fetch-Exec : State 1Instruction Fetch

8

3

7

1

9

3 1

AX BX

Page 22: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 22

0

1

4

3

2

Fetch-Exec : State 2Decode, Register Operations

8

3

7

1

9

add ax , bx

add ax,bx

add ax bx

3 1

3 1

AX BX

Page 23: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 23

0

1

4

3

2

Fetch-Exec : State 3ALU Operation

8

3

7

1

9

add ax , bx

add ax,bx

add ax bx

AX BX

3 1

4

Page 24: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 24

0

1

4

3

2

Fetch-Exec : State 4Memory Access

8

3

7

1

9

add ax , bx

add ax,bx

add ax bx

AX BX

3 1

4

Page 25: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 25

0

1

4

3

2

Fetch-Exec : State 5Register Write

8

3

7

1

9

add ax , bx

add ax,bx

add ax bx

BX

3 1

4

4

Page 26: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 26

Fetch-Execute Cycle

1. Fetch instruction from memory

2. Decode the instruction and read any

registers

3. Do any ALU operations (execute units)

5. Write back results to registers

(Organization and Control)

mov ax , [1]

4. Do any Memory Access

Read the ‘1’

Put ‘1’ into MAR

Data into ax

Read memory at addr ‘1’

Page 27: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 27

mov ax , [1]

mov ax , [1]mov ax

0

1

4

3

2

1

Fetch-Exec : State 1Instruction Fetch

8

3

7

1

9

Page 28: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 28

mov ax , [1]

mov ax , [1]mov ax

0

1

4

3

2

1

Fetch-Exec : State 2Decode, Register Operations

8

3

7

1

9

Page 29: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 29

mov ax , [1]

mov ax , [1]mov ax

0

1

4

3

2

1

Fetch-Exec : State 3ALU Operation

1

8

3

7

1

9

Page 30: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 30

mov ax , [1]

mov ax , [1]mov ax

0

1

4

3

2

1

Fetch-Exec : State 4Memory Access

1

8

3

7

1

9

8

Page 31: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 31

mov ax , [1]

mov ax , [1]mov ax

0

1

4

3

2

1

Fetch-Exec : State 5Register Write

1

8

3

7

1

9

88

Page 32: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 32

Pentium

5

1

2

3

4

1. Fetch

2. Decode

3. ALU

4. Mem Ops

5. Reg Write

Page 33: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 33

The first microprocessor

KeypadLots of

ElectronicsLCD Display

Keypad LCD Display

Code Memory

Programmable Electronics

A dedicated design ...

... or a re- usable design

Page 34: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.
Page 35: CBP 2005-6Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley.

CBP 2005-6 Comp 1017 Digital Technologies 35