Anda di halaman 1dari 10

1 - Overview of a Computer

COL 100 - Introduction to Computer Science


Department of Computer Science and Engineering
Indian Institute of Technology Delhi

Components of a Computer
CPU

Address,
Data

Memory

Bus (wires+control)

I/O
Device
(keyboard)

I/O
Device2
(monitor)

I/O
Device3
(mouse)

P. R. Panda, I.I.T Delhi

Editor

Writing and Executing


a Program
Compiler
Executable

Program

Stored
in
disk

Loader

INPUT
(keyboard,
mouse)
CPU
OUTPUT
(monitor,
printer)
P. R. Panda, I.I.T Delhi

MEMORY
Instructions
and Data

Elementary Unit: Instruction


Executable Program is a Sequence of
Instructions
in machine language (understood by CPU)
generated from high-level program by Compiler

This sequence is first loaded into memory


CPU accesses and executes the instructions
from memory
one instruction at a time
P. R. Panda, I.I.T Delhi

Computer Memory
Address

Logical array of locations


Each location has an
ADDRESS
Start address is 0
End address depends on
amount of memory present
in computer
Instructions and Data are
stored in these locations
P. R. Panda, I.I.T Delhi

0
1
2

254
255
A memory with
256 locations

Loading a Program to Memory


Sequence of
instructions first
loaded into memory
Execution: interpret
one instruction at a
time

Stored
in
disk

100

Inst 1

101

Inst 2

102

...

103

Inst n

254
255

P. R. Panda, I.I.T Delhi

What does an Instruction


look like?
Sample
Instruction:
4 FIELDS

First
Operand
Address

Which
Operation?

Second
Operand
Address

Destination
Address

Compiler
ADD
...
x = y + z;
...

200

201

202

203

...

201

202

Instruction

P. R. Panda, I.I.T Delhi

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

So, the whole instruction


consists of just 4 numbers

10

201

202

Encoded Instruction
P. R. Panda, I.I.T Delhi

200

Instruction Set of a CPU


The example instruction is an 11digit number

2 digits for Operation type


3 digits for Operand 1
3 digits for Operand 2
3 digits for Destination

Such an instruction can support

Operation
Type Operand1
Addr Operand2
Dest
Addr
Addr
ADD

100 operation types


operands can occupy any of
1000 locations

Instruction Set of a CPU


the set of valid instructions
recognised by the CPU

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)

Attempt to keep frequently used data closer to CPU

Registers CPU
inside

L1
Cache

L2
Cache
P. R. Panda, I.I.T Delhi

Main
Memory

Disk

Anda mungkin juga menyukai