Mod 1
Mod 1
Mod 1
& ARCHITECTURE
Sub. code:- 18EC35
Basic Structure of
Computers
1.1 Computer Types
Modern computers can be divided roughly
into four general categories:
1. Embedded computers
2. Personal computers
3. Servers
4. Supercomputers
Embedded computers
• They are integrated into a larger device or
system in order to automatically monitor and
control a physical process or environment.
• They are used for a specific purpose rather
than for general processing tasks.
• Typical applications include industrial and
home automation, appliances,
telecommunication products, and vehicles.
Personal computers (PC)
• PCs are used in homes, educational institutions,
and business & engineering , primarily for
dedicated individual use.
• They support a variety of applications such as –
- general computation,
- document preparation,
- computer-aided design,
- audiovisual entertainment,
- interpersonal communication, and
- Internet browsing.
Different types of PCs
• Desktop computers serve general needs and
fit within a typical personal workspace.
• Workstation computers offer higher
computational capacity and more powerful
graphical display capabilities for engineering
and scientific work.
• Notebook computers is a personal computer
in a smaller lightweight package. They can
operate on batteries to provide mobility.
Servers
• They are large computers that are shared by a
potentially large number of users who access them
from some form of personal computer over a public
or private network.
• Such computers have large databases and provide
information processing for a government agency or
a commercial organization.
Supercomputers and Grid computers
• Supercomputers are used for the highly demanding
computations needed in weather forecasting,
engineering design and simulation, and scientific work.
• They have a high cost.
• Grid computers provide a more cost-effective
alternative.
• They combine a large number of personal computers
and disk storage units in a physically distributed high-
speed network, called a grid.
• By evenly distributing the computational workload
across the grid, it is possible to achieve high
performance on large applications.
Cloud computing.
• Cloud is a term used to describe data centers
available to many users over the Internet.
• Cloud computing is the on demand delivery of
computing services such as servers, storage,
databases, networking, softwares etc. over
the Internet on a pay-as-you-use basis.
• Amazon, Microsoft, Google, Oracle, vmware,
IBM, Alibaba..
1.2 Functional Units
• The input unit accepts information from human
operators using devices such as keyboards, or from
other computers
• The information received is stored in the computer’s
memory, either for later use or to be processed
immediately by the arithmetic and logic unit.
• The processing steps are specified by a program that is
also stored in the memory.
• Finally, the results are sent back to the outside world
through the output unit.
• All of these actions are coordinated by the control unit.
• An interconnection network provides the means for the
functional units to exchange information and
coordinate their actions.
Input Unit
• The most common input device is the keyboard.
• Many other kinds of input devices are the touchpad,
mouse, joystick, and trackball.
• These are often used as graphic input devices in
conjunction with displays.
• Microphones can be used to capture audio input which
is then sampled and converted into digital codes for
storage and processing.
• Similarly, cameras can be used to capture video input.
• Internet, can also provide input to a computer from
other computers and database servers.
Memory Unit
• The function of the memory unit is to store
programs and data.
• There are two classes of storage,
- primary e.g:- RAM, cache
- secondary. e.g:- magnetic disks, optical disks
(DVD and CD), and flash memory devices
Primary Memory
• Primary memory, also called main memory, is a fast
memory that operates at electronic speeds.
• Programs must be stored in this memory while they
are being executed.
• Memory consists of a large number of
semiconductor storage cells,.
• Each capable of storing one bit of information.
• These cells are rarely read or written individually.
Primary Memory
• Instead, they are handled in groups of fixed
size called words.
• The number of bits in each word is referred to
as the word length of the computer, typically
16, 32, or 64 bits.
• A distinct address is associated with each
word location.
• A particular word is accessed by specifying its
address.
Primary Memory
• Instructions and data can be written into or read
from the memory.
• A memory in which any location can be accessed
in a short and fixed amount of time after
specifying its address is called a random-access
memory (RAM).
• The time required to access one word is called
the memory access time(MAT).
• It typically ranges from a few nanoseconds (ns) to
about 100 ns for current RAM units.
Cache Memory
• A cache, is used to hold sections of a program
that are currently being executed, along with
any associated data.
• The cache is tightly coupled with the
processor and is usually contained on the
same integrated-circuit chip.
• The purpose of the cache is to facilitate high
instruction execution rates.
• At the start of program execution, the cache is
empty.
• All program instructions and any required data
are stored in the main memory.
• As execution proceeds, instructions are fetched
into the processor chip, and a copy of each is
placed in the cache.
• Now, suppose a number of instructions are
executed repeatedly as happens in a program
loop.
• If these instructions are available in the cache,
they can be fetched quickly
Secondary Storage
• Although primary memory is essential, it tends to be
expensive and does not retain information when
power is turned off.
• Thus additional, less expensive, permanent
secondary storage is used when large amounts of
data and many programs have to be stored.
• Access times for secondary storage are longer than
for primary memory.
• A wide variety of secondary storage devices
available magnetic disks, optical disks (DVD and CD),
and flash memory devices.
Arithmetic and Logic Unit
• Most computer operations are executed in the
arithmetic and logic unit (ALU) of the processor.
• Any arithmetic or logic operation, such as addition,
subtraction, multiplication, division, or comparison of
numbers, are performed by the ALU.
• When operands are brought into the processor, they
are stored in high-speed storage elements called
registers.
• Each register can store one word of data.
• Access times to registers are even shorter than access
times to the cache unit on the processor chip.
Output Unit
• Its function is to send processed results to the
outside world.
• A familiar example of such a device is a printer.
• Most printers employ either photocopying
techniques, as in laser printers, or ink jet streams.
• Such printers may generate output at speeds of
20 or more pages per minute.
• However, printers are mechanical devices, and as
such are quite slow compared to the electronic
speed of a processor.
Contd..
• Some units, such as graphic displays, provide
both an output function, and an input
function,
• Showing text and graphics, through touch
screen capability.
• The dual role of such units is the reason for
using the single name input/output (I/O) unit
in many cases.
Control Unit
• The memory, ALU and I/O units store and
process information and perform input and
output operations.
• The operation of these units must be
coordinated in some way.
• This is the responsibility of the control unit.
• Data transfers between the processor and the
memory are also managed by the control unit
Control Unit
• We usually think that control unit is a well-
defined, physically separate unit that interacts
with other parts of the computer.
• Much of the control circuitry is physically
distributed throughout the computer.
Summary
• The computer accepts information in the form
of programs and data through an input unit
and stores it in the memory.
• Information stored in the memory is fetched
into an ALU, where it is processed.
• Processed information leaves the computer
through an output unit.
• All activities in the computer are directed by
the control unit.
Memory
MAR MDR
Control
PC R0
R1
Processor
IR
ALU
Rn - 1
n general purpose
registers
Single bus
• Only two units can actively use the bus at any
given time, since bus can be used for only one
transfer at a time.
• Advantages of using single bus are low cost and
flexibility in attaching peripheral devices.
• Multiple buses achieve more concurrency in
operations.
i.e. two or more transfers carried out at the
same time
• This leads to better performance but at an
increased cost.
Buffer registers
• Devices connected to a bus vary widely in their speed of
operation.
e.g: - Keyboards and printers slow, Magnetic or optical disks are
considerably fast and Memory & processor are fastest devices.
• All these devices must communicate with each other over
a bus, an efficient mechanism to smooth out the
differences in speed is necessary.
• A common approach is to include buffer registers with
devices to hold information during transfers.
e.g:- Transfer of encoded characters from processor to printer
• Buffer registers smooth out timing differences among
processors, memory and I/O devices.
Software
1. System Software: is a collection of programs needed
to perform basic functions for computer usage.
Basic functions
– Receiving and interpreting user commands.
– Managing the storage and retrieval of files in secondary
storage devices.
– Controlling I/O units to receive input data and produce
output results.
– Translating programs from source form by user into object
form of machine instructions.
– Linking and running user-written application programs
with existing standard library routines
2. Application Software: are end-user programs
which specifies a mathematical or data processing
operations etc.
• These are usually written in a HLL such as C,C++,
Java, Python, Visual Basic….
• A program translates the HLL into a machine
language program called Compiler.
• Another program is used for entering & editing
application program called Text editor.
• We also have Debuggers, Linkers, Interpreters..
• Integrated development environment(IDE) – a
single software application which consists of all
these.
Operating system
Definition:
It a large program or collection of programs
used to control
– the sharing of various computer resources
– interaction among various computer units
as they execute application programs.
OS (contd…)
The OS programs perform the various tasks to
assign computer resources to individual
application programs.
They are as follows
– Assigning memory & magnetic disk space to
program and data files.
– Moving data between memory and disk units
– Handling I/O operations
Basics of OS
• Example: - A system with one processor, one
disk, and one printer. The application program
has been compiled from HLL into a MLL and
stored on the disk.
First step is to transfer this file to memory.
When the transfer is complete, execution starts
Main Cache
memory memory Processor
Bus
N S
T
R
How to improve T?
Memory Locations, Addresses
n bits
b31 b30 b1 b0
•
•
•
Sign bit: b31= 0 for positive numbers
b31= 1 for negative numbers
Word
address Byte address Byte address
0 0 1 2 3 0 3 2 1 0
4 4 5 6 7 4 7 6 5 4
• •
• •
• •
k k k k k k k k k k
2 -4 2 -4 2 -3 2- 2 2 - 1 2 - 4 2- 1 2 - 2 2 -3 2 -4
General format:
Operation Source1, Source2,Destination
•
•
•
i + 4n - 4 Add NUMn,R0
i + 4n Move R0,SUM
•
•
•
SUM
NUM1
NUM2
•
•
•
NUMn
Conditional branch
•
•
•
SUM
N n
NUM1
NUM2
•
•
Figure 2.10. Using a loop to add n numbers. •
NUMn
Condition Codes
• The processor keeps track of information about results
of various operation in individual bits called Condition
code flags.
• Individual flag bits are set to 1 or cleared to 0,
depending on the outcome of the operation performed.
• These flags are on a special register called Condition
code register / status register
• N (negative) 1 if the result is –ve, 0 otherwise
• Z (zero) 1 if the result is zero, 0 otherwise
• V (overflow) 1 if there is overflow, 0 otherwise
• C (carry) 1 if there is carry out, 0 otherwise
Example
• Given A: 01110000
A: 0 1 1 1 0 0 0 0 + (B ): 00010100
B: 0 0 0 1 0 1 0 0 10011100
perform A + B
C=0 Z=0
S=1
V=0
FLOATING POINT NUMBERS
• Representation for non-integral numbers
- Including very small and very large numbers
• Like scientific notation
–2.34 × 1056 normalized
+0.002 × 10–4 not normalized
+987.02 × 109 not normalized
• In decimal
±X1. X2 X3 X4 X5 X6 X7 × 10 ± Y1Y2
• In binary
±1.xxxxxxx2 × 2yyyy
• Note: when the decimal point is placed to the right of 1st
significant digit(non-zero), the number is said to be normalized.
IEEE Standard for floating point
numbers
SINGLE-PRECISION RANGE
• Exponents 00000000 and 11111111 are reserved
• Smallest value
• Exponent: 00000001 actual exponent = 1 – 127 = –126
• Fraction: 000…00 significand = 1.0
±1.0 × 2–126 ≈ ±1.2 × 10–38
• Largest value
• Exponent: 11111110 actual exponent = 254 – 127 = +127
• Fraction: 111…11 significand ≈ 2.0
±2.0 × 2+127 ≈ ±3.4 × 10+38
DOUBLE-PRECISION RANGE
• Exponents 0000…00 and 1111…11 are reserved
• Smallest value
• Exponent: 00000000001 actual exponent = 1 – 1023
= –1022
• Fraction: 000…00 significand = 1.0
±1.0 × 2–1022 ≈ ±2.2 × 10–308
• Largest value
• Exponent: 11111111110 actual exponent = 2046 –
1023 = +1023
• Fraction: 111…11 significand ≈ 2.0
±2.0 × 2+1023 ≈ ±1.8 × 10+308
Arithmetic operations
• 3 major representations:
Sign and magnitude
One’s complement
Two’s complement
• Assumptions:
4-bit machine word
16 different values can be represented
Roughly half are positive, half are negative
Binary, Signed-Integer Representations
Page 28 B Values represented
Sign and
b 3 b 2 b1 b 0 magnitude 1's complement 2's complement
0 1 1 1 +7 +7 + 7
0 1 1 0 +6 +6 + 6
0 1 0 1 +5 +5 + 5
0 1 0 0 +4 +4 + 4
0 0 1 1 +3 +3 + 3
0 0 1 0 +2 +2 + 2
0 0 0 1 +1 +1 + 1
0 0 0 0 +0 +0 + 0
1 0 0 0 - 0 -7 - 8
1 0 0 1 - 1 -6 - 7
1 0 1 0 - 2 -5 - 6
1 0 1 1 - 3 -4 - 5
1 1 0 0 - 4 -3 - 4
1 1 0 1 - 5 -2 - 3
1 1 1 0 - 6 - 1 - 2
1 1 1 1 - 7 -0 - 1
-1 +0
-2 11 11 00 00 +1
11 10 00 01
-3 +2 +
like 1's comp 11 01 00 10
except shifted -4 11 00 00 11 +3 0 100 = + 4
one position
clockwise -5 10 11 01 00 +4 1 100 = - 4
10 10 01 01
-6 +5 -
10 01 01 10
-7 10 00 01 11 +6
-8 +7
4 0100 -4 1100
+3 0011 + (-3) 1101
If carry-in to the high
order bit = 7 0111 -7 11001
carry-out then ignore
carry