Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 46

Introduction

to
Computer Organization
12-05-2014 Tariq Ahmed 2
Representation of Basic
Information

The basic functional units of computer are made
of electronics circuit and it works with electrical
signal.
We provide input to the computer in form of
electrical signal and get the output in form of
electrical signal.
There are two basic types of electrical signals,
namely, analog and digital.
The analog signals are continuous in nature and
digital signals are discrete in nature.
12-05-2014 Tariq Ahmed 3
Representation of Basic
Information

Computer is a digital device, which works
on two levels of signal.
We say these two levels of signal as
High(1) and Low(0)
The smallest unit of information that is
represented in computer is known as Bit (
Binary Digit ), which is either 0 or 1. Four
bits together is known as Nibble, and Eight
bits together is known as Byte.
12-05-2014 Tariq Ahmed 4
Computer Organization and
Architecture
The task that the computer designer handles is a
complex one: Determine what attributes are
important for a new machine, then design a
machine to maximize performance while staying
within cost constraints.
This task has many aspects, including
instruction set design, functional organization,
logic design, and implementation.
While looking for the task for computer design,
both the terms computer organization and
computer architecture come into picture.
12-05-2014 Tariq Ahmed 5
Architecture & Organization
Architecture is those attributes visible to the
programmer or those parameters that have a direct
impact on the logical execution of a program
Instruction set, number of bits used for data
representation, I/O mechanisms, addressing
techniques.
e.g. Is there a multiply instruction?
Organization is how features are implemented means
Computer organization refers to the operational units
and their interconnections that realize the architectural
specifications.
Control signals, interfaces, memory technology.
e.g. Is there a hardware multiply unit or is it done by
repeated addition?
12-05-2014 Tariq Ahmed 6
Basic Computer Model and
different units of Computer

12-05-2014 Tariq Ahmed 7
Structure - Top Level
Computer
Main
Memory
Input
Output
Systems
Interconnection
Peripherals
Communication
lines
Central
Processing
Unit
Computer
12-05-2014 Tariq Ahmed 8
Structure - The CPU
Computer
Arithmetic
and
Logic Unit
Control
Unit
Internal CPU
Interconnection
Registers
CPU
I/O
Memory
System
Bus
CPU
12-05-2014 Tariq Ahmed 9
Structure - The Control Unit
CPU
Control
Memory
Control Unit
Registers and
Decoders
Sequencing
Logic
Control
Unit
ALU
Registers
Internal
Bus
Control Unit
12-05-2014 Tariq Ahmed 10
In this small computer, we do not consider about Input and Output unit. We
will consider only CPU and memory module. Assume that somehow we
have stored the program and data into main memory. We will see how CPU
can perform the job depending on the program stored in main memory.
Assumption is that students understand common terms like program, CPU,
memory etc. without knowing the exact details.

Consider the Arithmetic and Logic Unit (ALU) of Central Processing
Unit :
Consider an ALU which can perform four arithmetic operations and four logical
operations.
To distinguish between arithmetic and logical operation, we may use a signal
line,
0 - in that signal, represents an arithmetic operation and
1 - in that signal, represents a logical operation.
In the similar manner, we need another two signal lines to distinguish
between four arithmetic operations.
12-05-2014 Tariq Ahmed 11
12-05-2014 Tariq Ahmed 12
But in computer, we need more storage space for proper functioning
of the Computer.
Some of them are inside CPU, which are known as register. Other
bigger chunk of storage space is known as primary memory or main
memory. The CPU can work with the information available in
main memory only.
To access the data from memory, we need two special registers one
is known as Memory Data Register (MDR) and the second one
is Memory Address Register (MAR).
Data and program is stored in main memory. While executing a
program, CPU brings instruction and data from main memory,
performs the tasks as per the instruction fetch from the memory.
After completion of operation, CPU stores the result back into the
memory.
In next section, we discus about memory organization for our small
machine.
12-05-2014 Tariq Ahmed 13
`
Main Memory Organization
Main memory unit is the storage unit, There are several location for
storing information in the main memory module.
The capacity of a memory module is specified by the number of memory
location and the information stored in each location.
A memory module of capacity 16 X 4 indicates that, there are 16
location in the memory module and in each location, we can store 4 bit
of information.
We have to know how to indicate or point to a specific memory location.
This is done by address of the memory location.
We need two operation to work with memory.
READ Operation: This operation is to retrieve the data from memory
and bring it to CPU register
WRITE Operation: This operation is to store the data to a memory
location from CPU register .
We need some mechanism to distinguish these two
operations READ and WRITE.
12-05-2014 Tariq Ahmed 14
With the help of one signal line, we can differentiate these two operations. If
the content of this signal line is
0, we say that we will do a READ operation; and if it is
1, then it is a WRITE operation.
To transfer the data from CPU to memory module and vice-versa, we need
some connection. This is termed as DATA BUS.
The size of the data bus indicate how many bit we can transfer at a time.
Size of data bus is mainly specified by the data storage capacity of each
location of memory module.
We have to resolve the issues how to specify a particular memory location
where we want to store our data or from where we want to retrieve the data.
This can be done by the memory address. Each location can be specified
with the help of a binary address.
If we use 4 signal lines, we have 16 different combinations in these four
lines, provided we use two signal values only (say 0 and 1).
To distinguish 16 location, we need four signal lines. These signal lines use
to identify a memory location is termed as ADDRESS BUS.
Size of address bus depends on the memory size. For a memory module of
capacity of 2n location, we need n address lines, that is, an address bus of
size n.
12-05-2014 Tariq Ahmed 15
We use a address decoder to decode the address that are present
in address bus
As for example, consider a memory module of 16 location and each
location can store 4 bit of information
The size of address bus is 4 bit and the size of the
data bus is 4 bit
The size of address decoder is 4 X 16.
There is a control signal named R/W.
If R/W = 0, we perform a READ operation and
if R/W = 1, we perform a WRITE operation
If the contents of address bus is 0101 and contents of data bus is
1100 and R/W = 1, then 1100 will be
written in location 5.
If the contents of address bus is 1011 and R/W=0, then the contents
of location 1011 will be placed in data bus.
12-05-2014 Tariq Ahmed 16
Flow of Information
The parts are connected to one another by
a collection of wires called a bus
Figure 5.2 Data flow through a von Neumann architecture
Processor
12-05-2014 Tariq Ahmed 17
Von Neumann Architecture
There are 3 major units in a computer tied together by buses:
1) Memory The unit that stores and retrieves instructions and
data.
2) Processor: The unit that houses two separate components:
The control unit: Repeats the following 3 tasks
Fetches an instruction from memory
Decodes the instruction
Executes the instruction
The arithmetic/logic unit (ALU): Performs mathematical
and logical operations.
3) Input/Output (I/O) Units: Handle communication with the
outside world.
12-05-2014 Tariq Ahmed 18
Von Neumann Architecture
The architecture is named after the mathematician,
John von Neumann, who supposedly proposed storing
instructions in the memory of a computer and using a control
unit to handle the fetch-decode-execute cycle:
fetch an instruction
decode the instruction
execute the instruction
Although we think of data being stored in a computer, in
reality, both data and instructions are stored there.

In one of our programming chapters, well see the format of
a typical instruction. Right now, think of it as a sequence of
0s and 1s.
12-05-2014 Tariq Ahmed 19
More Detail on Computer Architecture
12-05-2014 Tariq Ahmed 20
Memory
Memory is a
collection of
cells,
each with a
unique physical
address
The size of a cell
is normally a
power of 2,
typically a byte
today.
12-05-2014 Tariq Ahmed 21
Memory
A cell is the
smallest
addressable unit of
memory i.e. one
cell can be read
from memory or
one cell can be
written into
memory, but
nothing smaller.
12-05-2014 Tariq Ahmed 22
RAM and ROM
RAM stands for Random Access Memory
Inherent in the idea of being able to access each
location is the ability to change the contents of each
location
ROM stands for Read Only Memory
The contents in locations in ROM cannot be changed
RAM is volatile, ROM is not
This means that RAM does not retain its bit
configuration when the power is turned off,
but ROM does
12-05-2014 Tariq Ahmed 23
MEMORY UNIT
(or RAM- Random Access Memory)
Each cell has an address, starting
at 0 and increasing by 1 for each
cell.
A cell with a low address is just as
accessible as one with a high
address- hence the name RAM.
The width of the cell determines
how many bits can be read or
written in one machine operation.
MAR is Memory Address Register
MDR is Memory Data Register
12-05-2014 Tariq Ahmed 24
What is a Register?
Data can be moved into and out of registers
faster than from memory.
If we could replace all of memory with
registers, we could produce a very, very fast
computer ...
But, the price would be terribly prohibitive.
Most computers have quite a few registers
that serve different purposes.
Well see how the MAR and the MDR are
used.

12-05-2014 Tariq Ahmed 25
How does the memory unit
work?
Trace the following operation:
Store data D in memory location 0. D
D
0
0 D
0 D
s
D
12-05-2014 Tariq Ahmed 26
How does the memory unit
work?
Trace the following operation:
1) Fetch data D from memory location 1.
2) Obtain an instruction I from memory
location 7.

How does the computer distinguish
between 1) and 2) above?

We need to look at the control unit later.
1
D
f
D
I
12-05-2014 Tariq Ahmed 27
USING THE DECODER CIRCUIT TO SELECT
MEMORY LOCATIONS

0
1
2
3
4
5
6
7



15
4 x 2
4

decoder
1
0 1 1 1
MAR
0
0
0
0
12-05-2014 Tariq Ahmed 28
The decoder circuit doesn't scale well--- i.e. as the
number of bits in the MAR increases, the number of
output lines for the decoder goes up exponentially.
Most computers today have an MAR of 32 bits. Thus, if the
memory was laid out as we showed it, we would need a 32 x
2
32
decoder!
Note 2
32
is 2
2
2
30
= 4 G

So most memory is not 1 dimensional, but 2-dimensional (or
even 3-dimensional if banked memory is used).
12-05-2014 Tariq Ahmed 29
2-D MEMORY
0 1 1 1
MAR
2 x 4
decoder
2 x 4
decoder
columns
rows
Note that a 4 x 16 decoder was
used for the 1-D memory.
12-05-2014 Tariq Ahmed 30
Arithmetic/Logic Unit (ALU)
Performs basic arithmetic operations such as
adding
Performs logical operations such as AND, OR,
and NOT
Most modern ALUs have a small amount of
registers where the work takes place.
For example, adding A and B, we might find A
stored in one register, B in another, and their
sum stored in, say, A, after the adder computes
the sum.
12-05-2014 Tariq Ahmed 31
The ALU Uses a Multiplexer
R
AL1
AL2
ALU
circuits
multiplexer
selector lines
output
GT EQ LT
condition code register
Register R
Other registers
12-05-2014 Tariq Ahmed 32
ADD X


X
D
D
ADD X
f
ALU1 & ALU2
E
E+D E
D
E+D
E+D
12-05-2014 Tariq Ahmed 33
Control Unit
A Control Unit is the unit that handles the
central work of the computer.
There are two registers in the control unit
The instruction register (IR) contains the instruction
that is being executed
The program counter (PC) contains the address of
the next instruction to be executed
The ALU and the control unit together are
called the Central Processing Unit, or CPU
12-05-2014 Tariq Ahmed 34
ALL A COMPUTER DOES IS ...

Repeat forever (or until you pull the plug or
the system crashes)
1) FETCH (the instruction)
2) DECODE (the instruction)
3) EXECUTE (the instruction)
12-05-2014 Tariq Ahmed 35
The Fetch-Execute Cycle
Fetch the next instruction
Decode the instruction
Execution Cycle
Gets data if needed
Execute the instruction
Normally Get data if needed is considered part of the
Execute the instruction.
12-05-2014 Tariq Ahmed 36
Figure 5.3 The Fetch-Execute Cycle
(3)
(a)
(b)
12-05-2014 Tariq Ahmed 37
How Does the Control Unit Work?
The PC holds the
address of the next
instruction to be
executed.
Whatever is stored at
that address is
assumed to be an
instruction.
Once the
instruction is
fetched, the PC
is incremented.
12-05-2014 Tariq Ahmed 38
Input/Output Units
An input unit is a device through which
data and programs from the outside
world are entered into the computer
Keyboard, the mouse, and scanning
devices
An output unit is a device through which
results stored in the computer memory
are made available to the outside world
Printers and video display terminals
12-05-2014 Tariq Ahmed 39
THE I/O DEVICES
Pictorially, these
look the
simplest, but in
reality, they form
the most diverse
part of a
computer.
Includes:
keyboards, monitors, joysticks, mice, tablets,
lightpens, spaceballs, ....
12-05-2014 Tariq Ahmed 40
I/O UNITS
Processor Memory
I/O buffer
Control-logic
I/0 device
Each device is different, but
most are interrupt driven.
This means when the I/O
device wants attention, it
sends a signal (the interrupt)
to the CPU.
12-05-2014 Tariq Ahmed 41
IN X


X
D
IN X
s
D
D
12-05-2014 Tariq Ahmed 42
OUT X


X
D
D
OUT X
f
D
12-05-2014 Tariq Ahmed 43
Secondary Storage Devices
Because most of main memory is volatile
and limited, it is essential that there be
other types of storage devices where
programs and data can be stored when
they are no longer being processed
Secondary storage devices can be
installed within the computer box at the
factory or added later as needed
12-05-2014 Tariq Ahmed 44
Magnetic Disks
A read/write head travels across a spinning
magnetic disk, retrieving or recording data
Figure 5.8
The organization
of a magnetic disk
12-05-2014 Tariq Ahmed 45
Compact Disks
A CD drive uses a laser to read
information stored optically on a plastic
disk
CD-ROM is Read-Only Memory
DVD stands for Digital Versatile Disk
12-05-2014 Tariq Ahmed 46
Are All Architectures the von
Neumann Architecture?
No.
One of the bottlenecks in the von Neuman
Architecture is the fetch-decode-execute cycle.
With only one processor, that cycle is difficult to
speed up.
I/O has been done in parallel for many years.
Why have a CPU wait for the transfer of data
between the memory and the I/O devices?
Most computers today also multitask they make it
appear that multiple tasks are being performed in
parallel (when in reality they arent as well see when
we look at operating systems).
But, some computers do allow multiple processors.

You might also like