Chapter 2 Anatomy of a computer

© Christian Jacob
Chapter 2
Anatomy of a computer
2.1
Layers of Virtual Machines
2.2
The Register Machine Model
2.2.1
2.2.2
2.2.3
2.2.4
Main components of a von Neumann computer architecture
CPU and RAM
Execution of Machine Instructions
Machine Language
2.3
Hardware Components of a Computer
2.4
References
Chapter Overview
Chapter 2: Anatomy of a Computer
Page 2
2.1
© Christian Jacob
Layers of Virtual Machines
Physical Representation
Applications
Boolean
Circuits
Register
Machine
...
Operating
System
many
layers
inbetween
First
Back
TOC
Prev Next
Last
Chapter 2: Anatomy of a Computer
Page 3
2.2
© Christian Jacob
The Register Machine Model
2.2.1 Main components of a von Neumann computer
architecture
Control Unit
Input Unit
Memory
Output Unit
ALU
Burks, Goldstine, von Neumann (Princeton, 1946/47)
First
Back
TOC
The Register Machine Model
Prev Next
Last
Chapter 2: Anatomy of a Computer
Page 4
© Christian Jacob
“Von Neumann Architecture”
• The computer architecture is problem-independent.
⇒ Universal Computer:
- Arithmetic Logical Unit — Memory — Control Unit — Input /
Output Unit
• Program and data both reside in memory.
• Each memory location has an address, through which its contents
can be accessed.
• In general, program commands are stored in consecutive memory
locations.
• There are jump commands.
• There are conditional jumps.
• The binary number system is used.
First
Back
TOC
The Register Machine Model
Prev Next
Last
Chapter 2: Anatomy of a Computer
Page 5
© Christian Jacob
2.2.2 CPU and RAM
Data bus transports
data from RAM to the
CPU for processing
RAM
CPU
Random
Access
Memory
Central
Processing
Unit
Data bus transports
the processed data to
RAM, so it can be displayed,
output, or stored on disk
The CPU
processes data
RAM contains data
and instructions (programs)
how to process the data
First
Back
TOC
The Register Machine Model
Prev Next
Last
Chapter 2: Anatomy of a Computer
Page 6
© Christian Jacob
2.2.2 Arithmetic Logical Unit (ALU)
Data
Result
RAM
ALU
Register 1
Register 2
4
5
Addition
Control
Unit
+
9
Accumulator
First
Back
TOC
The Register Machine Model
Prev Next
Last
Chapter 2: Anatomy of a Computer
Page 7
© Christian Jacob
ALU / RAM Performance:
• 1. The data to be processed arrives from RAM and is held in
registers.
• 2. A signal from the Control Unit indicates which arithmetic or
logical operation to perform.
• 3. The ALU performs the operation and places the result in the
accumulator.
• 4. The results are usually sent to RAM so that they can be output or
stored on disk.
First
Back
TOC
The Register Machine Model
Prev Next
Last
Chapter 2: Anatomy of a Computer
Page 8
© Christian Jacob
2.2.3 Execution of Machine Instructions
Load jump address
Instruction
Pointer
Load data address
Program
address
Fetch opcode and mod
1
Memory
Addressing
Increment
instruction
pointer
Control
Unit
3
3
5
ALU
RAM
4
Load/store data
2
First
Back
TOC
Accu
Load constant
Load instruction
The Register Machine Model
Address /
Operator Constant
Instruction Register
Prev Next
Last
Chapter 2: Anatomy of a Computer
Page 9
© Christian Jacob
2.2.4 Machine Language
• Elementary operations:
- data transfer
- program control
- arithmetic and logic operations
- move operations
- interrupt handling
• Binary command representation
• Regular structure of all the commands
First
Back
TOC
The Register Machine Model
Prev Next
Last
Chapter 2: Anatomy of a Computer
Page 10
© Christian Jacob
Command formats:
- 1-address command
Operation
Address of
Operand 2
- 2-address command
Operation
Address of
Operand 1 & Result
Address of
Operand 2
- 3-address command
Operation
First
Back
TOC
Address of
Operand 1
Address of
Operand 2
The Register Machine Model
Address of
Result
Prev Next
Last
Chapter 2: Anatomy of a Computer
Page 11
© Christian Jacob
Machine Language Example
Opcode dual
hex.
0000
0
Halt. End of program execution
HLT
0001
1
Load operand to accumulator
LOA
0010
2
Store accumulator at designated address
STI
0011
3
Add operand to accumulator
ADD
0100
4
Subtract operand from accumulator
SUB
0101
5
Multiply operand with accumulator
MUL
0110
6
Divide accumulator by operand
DIV
0111
7
Unconditional jump
JMP
1000
8
Jump if accumulator = 0
JEZ
1001
9
Jump if accumulator > 0
JGZ
1010
A
Jump if accumulator < 0
JLZ
1100
C
Stack commands
1101
D
Jump to subroutine
JSR
1110
E
Return from subroutine
RET
1111
F
Index commands
First
Back
TOC
Description of the Operation
Mnemo.
-
The Register Machine Model
Prev Next
Last
Chapter 2: Anatomy of a Computer
Page 12
© Christian Jacob
Example:
The word 0011 0100 1001 1101 in a memory cell can be …
• a decimal number: 13469
• a command:
0011
0
100
10011101
- 0011:
add operand to accumulator
- 0:
one word command
- 100:
constant operand (“immediate operand”)
- 10011101:
15710
⇒ “Add 157 to the contents of the accumulator.”
First
Back
TOC
The Register Machine Model
Prev Next
Last
Page 13
Chapter 2: Anatomy of a Computer
2.3
Hardware Components of a Computer
© Christian Jacob
Central Components:
- CPU
- Main memory (RAM)
Peripheral Devices
• Input devices
- Keyboard
- Pointing devices: mouse, trackpads, trackballs, pens, joysticks
- Scanners, optical character readers (OCR)
- Microphone
First
Back
TOC
Hardware Components of a Computer
Prev Next
Last
Chapter 2: Anatomy of a Computer
Page 14
© Christian Jacob
• Output devices
- Monitor (+ special-purpose processor: video card)
- Printer
- Speakers (+ special-purpose processor: sound card)
• Input-output devices
- Floppy disk drive (capacity: 1.44M to 2.88M, M = Mega Byte)
- Hard disk drive (capacity: > 20G, G = Giga Byte)
- Optical storage devices (CD-ROM, DVD)
- Modem
- Connections to Local Area Networks (LANs)
- Connections to Wide Area Networks (WANs)
• Input and output drivers (= software to interface to external
devices)
First
Back
TOC
Hardware Components of a Computer
Prev Next
Last
Chapter 2: Anatomy of a Computer
Page 15
2.4
© Christian Jacob
References
• G. Blank and R. Barnes, The Universal Machine, Boston, MA: WCB/
McGraw-Hill, 1998. Chapters 1.3 and 8.
First
Back
TOC
References
Prev Next
Last