Components of a Computer
CPU
Address,
Data
Memory
Bus (wires+control)
I/O
Device
(keyboard)
I/O
Device2
(monitor)
I/O
Device3
(mouse)
Editor
Program
Stored
in
disk
Loader
INPUT
(keyboard,
mouse)
CPU
OUTPUT
(monitor,
printer)
P. R. Panda, I.I.T Delhi
MEMORY
Instructions
and Data
Computer Memory
Address
0
1
2
254
255
A memory with
256 locations
Stored
in
disk
100
Inst 1
101
Inst 2
102
...
103
Inst n
254
255
First
Operand
Address
Which
Operation?
Second
Operand
Address
Destination
Address
Compiler
ADD
...
x = y + z;
...
200
201
202
203
...
201
202
Instruction
200
Encoding an Instruction
ADD is one operation type
Other operand types: SUB,
MULT, COMPARE...
We can ENCODE each
operation type by a number
ADD: 10
SUB: 11
MULT: 12
etc.
Operation
Type Operand1
Addr Operand2
Dest
Addr
Addr
ADD
201
202
200
Instruction
Encoding
10
201
202
Encoded Instruction
P. R. Panda, I.I.T Delhi
200
Operation
Type Operand1
Addr Operand2
Dest
Addr
Addr
ADD
201
202
200
Instruction
Encoding
2-digits
3-digits
3-digits
3-digits
10
201
202
200
Encoded Instruction
P. R. Panda, I.I.T Delhi
Memory Hierarchy
Larger the memory, slower the access time
Memory organised as hierarchy of levels
Registers (one word in each register) - an integer can
be stored in a register
Cache (103 to 106 words)
Main memory (107 to 1010 words)
Disk (>1010 words)
Registers CPU
inside
L1
Cache
L2
Cache
P. R. Panda, I.I.T Delhi
Main
Memory
Disk