Von-Neumann Motherboard

Let’s make a Computer
CBP 2013-14
Comp 1017 Digital Technologies
1
Let’s make a CPU
CBP 2013-14
Comp 1017 Digital Technologies
2
Pentium
CBP 2004-5
Comp 1017 Digital Technologies
3
Arithmetic Logic Unit
ALU
Input A
Integer Execution Unit
Input B
3
add
2
5
3
sub
2
1
Output
CBP 2004-5
Comp 1017 Digital Technologies
4
Multimedia MMX
ALU
Input A
Input B
ALU
Output
CBP 2004-5
Comp 1017 Digital Technologies
5
Processing Idea Nr. 1
Move data in and out of data memory
1. Move data from memory
3
2. add
2
5
0
3
1
2
2
3
Data Memory
5
4
3. Move data into memory
CBP 2004-5
Comp 1017 Digital Technologies
6
Processing Idea Nr.2
Move instructions into CPU from code memory
Instruction Memory
(Code Memory)
mov 3 in from memory
3
mov 2 in from memory
IP
add the two numbers
add
2
5
0
3
1
2
2
3
mov the result to memory
5
4
Program
CBP 2004-5
Comp 1017 Digital Technologies
7
Registers-1
AX
6
BX
0
6
1
8
8
4
CBP 2004-5
Comp 1017 Digital Technologies
8
Registers-2
AX
6
BX
0
6
1
8
8
MAR
4
4
CBP 2004-5
Comp 1017 Digital Technologies
9
Our CPU so far …
0
1
Instruction
Memory
Data
Memory
mar
ip
CBP 2004-5
4
Comp 1017 Digital Technologies
10
SAM-2
CBP 2004-5
Comp 1017 Digital Technologies
11
Hierarchy of Programming
1. Application
2. Written in HLL (C)
w=x+y;
mov ax,[x]
mov bx,[y]
add ax, bx
mov [w],ax
3. CPU executes machine
code
CBP 2004-5
Comp 1017 Digital Technologies
12
Moving data into Registers
For example …
mov ax , [1]
mov bx , [2]
Instruction
Memory
CBP 2004-5
AX
8
BX
7
mar
0
5
1
8
2
7
3
6
4
1
Comp 1017 Digital Technologies
mov ax , [1]
mov bx , [2]
13
Moving data into Memory
For example …
mov [3] , ax
mov [0] , bx
Instruction
Memory
CBP 2004-5
AX
8
mov [3] , ax
mov [0], bx
BX
7
mar
0
7
5
1
8
2
7
3
8
6
4
1
Comp 1017 Digital Technologies
14
Adding Numbers
For example …
Add ax,bx
Instruction
Memory
CBP 2004-5
AX
BX
8
7
8
7
15
mar
0
5
1
8
2
7
3
6
4
1
Comp 1017 Digital Technologies
add ax , bx
15
I’ve never
wrestled with
such a complex
problem before
It must take a lot
of organization
and control !
CBP 2004-5
Comp 1017 Digital Technologies
16
Pentium
Organization
and control
CBP 2004-5
Comp 1017 Digital Technologies
17
Fetch-Execute Cycle
1. Fetch instruction
from memory
5. Write back results to
registers
ax <- ALU
add ax , bx
4. Do any Memory
Access
2. Decode the instruction
and read any registers
ALU <- ax
ALU <- bx
CBP 2004-5
(Data cache)
None needed
3. Do any ALU operations
ax + bx
(execute units)
Comp 1017 Digital Technologies
18
Fetch-Exec : State 1
Instruction Fetch
add ax , bx
add ax bx
AX
BX
3
1
add ax,bx
CBP 2004-5
Comp 1017 Digital Technologies
0
3
1
8
2
7
3
1
4
9
19
Fetch-Exec : State 2
Decode, Register
Operations
add ax , bx
add ax bx
AX
BX
3
1
3
1
add ax,bx
CBP 2004-5
Comp 1017 Digital Technologies
0
3
1
8
2
7
3
1
4
9
20
Fetch-Exec : State 3
ALU Operation
add ax , bx
add ax bx
AX
BX
add ax,bx
1
3
4
CBP 2004-5
Comp 1017 Digital Technologies
0
3
1
8
2
7
3
1
4
9
21
Fetch-Exec : State 4
Memory Access
add ax , bx
add ax bx
AX
BX
add ax,bx
1
3
4
CBP 2004-5
Comp 1017 Digital Technologies
0
3
1
8
2
7
3
1
4
9
22
Fetch-Exec : State 5
Register Write
add ax , bx
add ax bx
BX
add ax,bx
3
1
8
2
7
3
1
4
9
4
1
3
4
CBP 2004-5
0
Comp 1017 Digital Technologies
23
Fetch-Execute Cycle
(Organization and Control)
1. Fetch instruction
from memory
5. Write back results to
registers
Data into ax
mov ax , [1]
4. Do any Memory
Access
2. Decode the instruction
and read any registers
Read memory
at addr ‘1’
Read the ‘1’
3. Do any ALU operations
(execute units) Put ‘1’ into MAR
CBP 2004-5
Comp 1017 Digital Technologies
24
Fetch-Exec : State 1
Instruction Fetch
mov ax , [1]
mov ax , [1]
CBP 2004-5
mov ax
1
Comp 1017 Digital Technologies
0
3
1
8
2
7
3
1
4
9
25
Fetch-Exec : State 2
Decode, Register
Operations
mov ax , [1]
mov ax , [1]
CBP 2004-5
mov ax
1
Comp 1017 Digital Technologies
0
3
1
8
2
7
3
1
4
9
26
Fetch-Exec : State 3
ALU Operation
mov ax , [1]
mov ax , [1]
mov ax
1
1
CBP 2004-5
Comp 1017 Digital Technologies
0
3
1
8
2
7
3
1
4
9
27
Fetch-Exec : State 4
Memory Access
mov ax , [1]
mov ax , [1]
mov ax
1
8
1
CBP 2004-5
Comp 1017 Digital Technologies
0
3
1
8
2
7
3
1
4
9
28
Fetch-Exec : State 5
Register Write
mov ax , [1]
mov ax , [1]
mov ax
1
8
8
1
CBP 2004-5
Comp 1017 Digital Technologies
0
3
1
8
2
7
3
1
4
9
29
Pentium
1.
Fetch
2.
Decode
3.
ALU
4.
Mem Ops
5.
Reg Write
1
2
3
4
5
CBP 2004-5
Comp 1017 Digital Technologies
30