let’s make a computer

30
CBP 2013-14 Comp 1017 Digital Technologies 1 Let’s make a Computer

Upload: kamali

Post on 23-Feb-2016

30 views

Category:

Documents


0 download

DESCRIPTION

Let’s make a Computer. Let’s make a CPU. Pentium. Input A. Input B. 3. 3. 2. 2. add. sub. 5. 1. Output. Arithmetic Logic Unit. ALU. Integer Execution Unit. Input A. Input B. ALU. Output. Multimedia MMX. ALU. 0. 1. 2. 3. 3. 2. 3. 2. 4. add. 5. 5. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Let’s make a  Computer

Comp 1017 Digital Technologies 1CBP 2013-14

Let’s make a Computer

Page 2: Let’s make a  Computer

Comp 1017 Digital Technologies 2CBP 2013-14

Let’s make a CPU

Page 3: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 3

Pentium

Page 4: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 4

Arithmetic Logic Unit

Input A Input B

Output

ALU Integer Execution Unit

5

3 2add 1

3 2sub

Page 5: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 5

Input A Input B

Output

ALU

ALU

Multimedia MMX

Page 6: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 6

5

3 2add

0

1

2

3

4

3

2

5

Processing Idea Nr. 1

Move data from memory

Move data into memory3.

2.

1.

Data Memory

Move data in and out of data memory

Page 7: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 7

5

3 2add

0

1

2

3

4

3

2

5

Processing Idea Nr.2

IP

(Code Memory)

mov 3 in from memorymov 2 in from memoryadd the two numbersmov the result to memory

Instruction Memory

Program

Move instructions into CPU from code memory

Page 8: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 8

Registers-1

0

1

4

6 8

6

8

AX BX

Page 9: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 9

Registers-2

0

1

4

6 8

6

8

4

AX BX

MAR

Page 10: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 10

ip

Data Memory

Instruction

Memory

0

1

4mar

Our CPU so far …

Page 11: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 11

SAM-2

Page 12: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 12

Hierarchy of Programming

2. Written in HLL (C)

3. CPU executes machine code

mov ax,[x]mov bx,[y]add ax, bxmov [w],axw = x + y ;

1. Application

Page 13: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 13

Moving data into Registers

Instruction Memory

0

1

2

mar 3

4

mov ax , [1]

85

8

76

1

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

For example …

Page 14: Let’s make a  Computer

Comp 1017 Digital Technologies 14CBP 2004-5

Moving data into Memory

Instruction Memory

0

1

2

mar 3

4

mov [3] , ax

85

8

76

1

BXAXmov [3] , axmov [0], bx

mov [0] , bx 7

For example …

8

7

Page 15: Let’s make a  Computer

Comp 1017 Digital Technologies 15CBP 2004-5

Adding Numbers

Instruction Memory

0

1

2

mar 3

4

add ax , bx

85

76

1

BXAXAdd ax,bx

7

For example …

8

8 715

Page 16: Let’s make a  Computer

Comp 1017 Digital Technologies 16CBP 2004-5

I’ve never wrestled with

such a complex

problem beforeIt must take a lot of organization and control !

Page 17: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 17

Pentium

Organization and control

Page 18: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 18

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

add ax , bx

4. Do any Memory Access

ALU <- ax ALU <- bx

ax + bx

(Data cache)

ax <- ALU

None needed

Page 19: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 19

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 20: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 20

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 21: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 21

0

1

4

3

2

Fetch-Exec : State 3ALU Operation

8

3

7

1

9

add ax , bx

add ax,bx

add ax bxAX BX

3 14

Page 22: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 22

0

1

4

3

2

Fetch-Exec : State 4Memory Access

8

3

7

1

9

add ax , bx

add ax,bx

add ax bxAX BX

3 14

Page 23: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 23

0

1

4

3

2

Fetch-Exec : State 5Register Write

8

3

7

1

9

add ax , bx

add ax,bx

add ax bxBX

3 14

4

Page 24: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 24

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 25: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 25

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 26: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 26

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 27: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 27

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 28: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 28

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 29: Let’s make a  Computer

Comp 1017 Digital Technologies 29CBP 2004-5

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 30: Let’s make a  Computer

CBP 2004-5 Comp 1017 Digital Technologies 30

Pentium

5

12

3

4

1. Fetch2. Decode3. ALU4. Mem Ops5. Reg Write