The Von Neumann Architecture
The Von Neumann Architecture
The Von Neumann Architecture
Architecture
Chapter 5.1-5.2
Von Neumann
Architecture
Designing Computers
All computers more or less based on the same
basic design, the Von Neumann Architecture!
CMPUT101 Introduction
Memory
ALU (Arithmetic/Logic Unit)
Control Unit
Input/Output System (I/O)
Control Unit
ALU
Input-Output
Communicate with
"outside world", e.g.
Screen
Execute program
Keyboard
Storage devices
Do arithmetic/logic operations
...
requested by program
CMPUT101 Introduction (c) Yngvi Bjorns
4
Memory Subsystem
Memory, also called RAM (Random Access Memory),
Consists of many memory cells (storage units) of a fixed size.
Each cell has an address associated with it: 0, 1,
All accesses to memory are to a specified address.
A cell is the minimum unit of access (fetch/store a complete cell).
The time it takes to fetch/store a cell is the same for all cells.
RAM
0000000000000001
0
1
2
1 bit
2N
...
2N-1
Memory sizes:
Kilobyte (KB)
Megabyte(MB)
Gigabyte (GB)
= 210 =
1,024 bytes
= 220 =
1,048,576 bytes
= 230 = 1,073,741,824 bytes
~
~
~
1 thousand
1 million
1 billion
RAM is
volatile (can only store when power is on)
relatively expensive
CMPUT101 Introduction
Operations on Memory
Fetch (address):
Fetch a copy of the content of memory cell with the specified
address.
Non-destructive, copies value in memory cell.
CMPUT101 Introduction
MDR
F/S
Memory
decoder
circuit
Fetch/Store
controller
Fetch(address)
Load address into MAR.
Decode the address in MAR.
Copy the content of memory cell with
specified address into MDR.
Store(address, value)
...
CMPUT101 Introduction
Input/Output Subsystem
Handles devices that allow the computer system to:
Communicate and interact with the outside world
Screen, keyboard, printer, ...
Store information (mass-storage)
Hard-drives, floppies, CD, tapes,
10
I/O Controllers
Speed of I/O devices is slow compared to RAM
RAM
~ 50 nsec.
Hard-Drive ~ 10msec. = (10,000,000 nsec)
Solution:
I/O Controller, a special purpose processor:
Has a small memory buffer, and a control logic to control I/O
device (e.g. move disk arm).
Sends an interrupt signal to CPU when done read/write.
11
I/O controller
I/O Buffer
Control/Logic
I/O device
CMPUT101 Introduction
12
13
ALU circuitry:
R0
R1
R2
Rn
ALU circuitry
Bus:
Data path interconnecting the
registers to the ALU circuitry.
CMPUT101 Introduction (c) Yngvi Bjorns
GT EQ LT
14
15
Machine Language
Instructions
Example: ADD X, Y
16
CMPUT101 Introduction
17
Typical Machine
Instructions
Notation:
LOAD X
Load content of memory location X to R
STORE X
Load content of R to memory location X
MOVE X, Y Copy content of memory location X to loc. Y
(not absolutely necessary)
CMPUT101 Introduction
18
Machine Instructions
(cont.)
Arithmetic
ADD X, Y, Z
CON(Z) = CON(X) + CON(Y)
ADD X, Y
CON(Y) = CON(X) + CON(Y)
ADD X
R = CON(X) + R
similar instructions for other operators, e.g. SUBTR,OR, ...
Compare
COMPARE X, Y
Compare the content of memory cell X to the content of memory
cell Y and set the condition codes (CCR) accordingly.
E.g. If CON(X) = R then set EQ=1, GT=0, LT=0
CMPUT101 Introduction
19
Machine Instructions
(cont.)
Branch
JUMP X
JUMPGT X
Control
HALT
CMPUT101 Introduction
20
Example
Pseudo-code: Set A to B + C
Assuming variable:
A stored in memory cell 100, B stored in memory cell
150, C stored in memory cell 151
Machine language (really in binary)
LOAD
ADD
STORE
or
(ADD
150
151
100
150, 151, 100)
CMPUT101 Introduction
21
CMPUT101 Introduction
IR
Instruction
Decoder
22
von Neumann
Architecture
CMPUT101 Introduction
23
End of loop
CMPUT101 Introduction
24
PC --> MAR
Fetch signal
MDR --> IR
PC + 1 --> PC
Decode Phase
CMPUT101 Introduction
25
Example:
LOAD X (load value in addr. X into register)
IR_address -> MAR
Fetch signal
MDR --> R
ADD X
left as an exercise
CMPUT101 Introduction
26
LOAD X
STORE X
CLEAR X
ADD X
INCREMENT X
SUBTRACT X
DECREMENT X
COMPARE X
CON(X) --> R
R --> CON(X)
0 --> CON(X)
R + CON(X) --> R
CON(X) + 1 --> CON(X)
R - CON(X) --> R
CON(X) - 1 --> CON(X)
JUMP X
JUMPGT X
JUMPxx X
IN X
OUT X
HALT
0111
1000
1001
...
1101
1110
1111
CMPUT101 Introduction
27