Module-1
Chapter 1:Basic Structure Of Computers
1 Friday, January 25, 2019
Computer:
It is fast electronic device that accepts digitized
input information, processes it according to a list of
internally stored instructions and produces the
resulting output information.
Computer program:
The list of instructions that performs the task is called
a computer program.
2 Friday, January 25, 2019
Types of Computers
Computers are classified based on size, cost and
computational power.
• Microcomputers
• Mainframes
• Minicomputers
• Servers
• Super computers
3 Friday, January 25, 2019
Microcomputer
The most common computer is
microcomputer.
e.g. Desktop computer.
Microcomputers are designed to be
used by individuals, whether in the
form of PCs, workstations, or
notebook computers.
A Microcomputer contains a CPU on
a microchip (the microprocessor).
Desktop computers have processing
and storage units, display and audio
output units, and keyboard that can
all be located easily on a desk.
The storage media includes hard-
4
disks, CD-ROMs. Friday, January 25, 2019
Laptop Computer
Portable notebook computers are a
compact version of the personal
computer..
All components (keyboard, mouse,
etc.) are in one compact unit.
Usually more expensive than a
comparable desktop.
Sometimes called a Notebook.
5 Friday, January 25, 2019
Workstation
Powerful desktop computer designed for specialized tasks.
It has more computational power than personal computers.
Workstations are often used in engineering applications.
Workstations generally come with a large high-resolution graphics
screen.
Most workstations also have mass storage devices such as disk drive,
but a special type of workstation, called diskless workstation, comes
without a disk drive.
Like personal computers, most workstations are single-user
computers.
6 Friday, January 25, 2019
Mainframe
A very large and expensive computer
capable of supporting hundreds or
even thousands of users
simultaneously.
Mainframes are mainly Used to store,
manage, and process large amounts of
data.
Mainframes are used in medium to
large corporations that require more
computing power and storage capacity
than workstations can provide.
7 Friday, January 25, 2019
Server
Purpose is to “serve.”
A computer that has the
purpose of supplying its users
with data; usually through the
use of a LAN (local area
network).
8 Friday, January 25, 2019
Supercomputer
A Super computers is typically used for scientific and engineering
applications that must handle very large databases or do a great
amount of computation.
It is used for large- Scale numerical calculations required in
applications such as weather forecasting and aircraft design.
super computers are fastest, costliest and most powerful computers.
It can execute million instructions per second.
Most super computers are really multiple computers that perform
parallel processing.
9 Friday, January 25, 2019
Functional Units Of Computer
A computer consists of five functionally independent
main parts.
• Input unit
• Output unit
• Memory unit
• Arithmetic and logic unit
• Control unit
10 Friday, January 25, 2019
11 Friday, January 25, 2019
Input Devices
The input unit accepts coded information from users
The information received is either stored in the computer’s
memory or immediately executed by the ALU.
The most well-known input device is the key-board.
Whenever key is pressed, the corresponding letter or digit
is automatically translated into its corresponding binary
code and transmitted over a cable to either the memory or
the processor.
12 Friday, January 25, 2019
Keyboard
An arrangement of letters, numbers, and special
function keys that act as the primary input device
to the computer.
13 Friday, January 25, 2019
Mouse
An input device that allows the user to manipulate
objects on the screen by moving the device along
the surface of a desk.
14 Friday, January 25, 2019
Output Devices
the output unit is the counterpart of the input
unit.
Its function is to send processed results to
the outside world.
15 Friday, January 25, 2019
Speakers
Output devices that receive signals from the
computer’s sound card to play music, narration, or
sound effects.
16 Friday, January 25, 2019
Printer
Output device that produces text or graphical
images on paper.
17 Friday, January 25, 2019
Storage Devices
Used to keep data when the power to the computer is turned
off.
Different forms
Hard disk
Floppy or zip disks
CD-Writer
18 Friday, January 25, 2019
Memory Unit
The function of memory unit is to store the programs
and data.
There are two classes of storage
1) Primary Storage
2) Secondary storage
Primary Storage:
It is a fast memory that operates at electronic speeds.
Programs must be stored in the memory while they are
being executed.
19 Friday, January 25, 2019
The memory contains a large number of semiconductor
cells, each capable of storing in one bit of information.
Because a single bit represents a very small amount of
information, bits are not handled individually.
The memory is organized so that the contents of one
word, containing ‘n’ bits can be stored or retrieved in
one basic operation.
To provide easy access to any word in the memory, a
distinct address is associated in with each word.
A word address can be used to access the word.
20 Friday, January 25, 2019
Word Length:
The number of bits in each word is called as the word
length of the computer.
Typical word lengths range from 16-64 bits.
Memory Access Time:
The time required to access one word is called the
memory access time.
This time is fixed, independent of the location of the
word being accessed.
It typically ranges from a few nanoseconds (ns) to
about 100 ns.
The primary memory is also called as main memory.
21 Friday, January 25, 2019
Primary memories are small in capacities and expensive.
Thus additional, cheaper secondary storage is used
when large amounts of data and many programs have to
be stored.
Secondary storage devices:
Magnetic disks
Magnetic tapes
CD-ROMs
22 Friday, January 25, 2019
Arithmetic And Logic Unit
It performs the arithmetic operations such as addition,
subtraction, multiplication, division and logic operations
such as AND, OR, Not.
Suppose two numbers located in the memory are to be
added, they are brought into the processor, and
addition is carried out by the ALU .
The SUM may then be stored in the memory.
When the operands are brought into the processor,
they are stored in high-speed storage elements called
registers.
Each register can store one word of data.
23 Friday, January 25, 2019
Control Unit
The memory unit, arithmetic and logic and input and
output units store and process information and perform
input and output operations.
The operation of these units must be coordinated in
some way.
Control unit coordinates and controls the activities
among the functional units.
It sends the control signals to other units and senses
their states.
24 Friday, January 25, 2019
The operation of a computer can be summarized as
follows:
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, under
program control, into an arithmetic and logic unit,
where it is processed.
Processed information leaves the computer through
an output unit.
All activities inside the machine are directed by
control unit.
25 Friday, January 25, 2019
Basic Operational Concepts
To perform a given task, an appropriate program
consisting of a list of instructions is stored in the
memory.
Individual instructions are brought from the memory into
the processor, which execute the specified operation.
e.g. Consider the addition of two operands
Add LOCA, R0
this instruction adds the operand at memory location
LOCA to the operand in a register in the processor,R0
and places the sum into register R0.
26 Friday, January 25, 2019
This instruction requires the performance of several
steps:
1) the instruction is fetched from the memory into the
processor.
2) the operand at LOCA is fetched and added to the
contents of R0.
3) Finally, the sum is placed in register R0.
the same task can be performed using two instructions
Load LOCA, R1
Add R1, R0
the first instruction transfers the contents of memory
location LOCA into the register R1.
Second instruction adds the contents of registers R1 and R0
27 and places the Sum into R0. Friday, January 25, 2019
Figure shows how the memory and the processor can be
connected.
Processor contains number of registers used for
several purposes.
Instruction Register:
It holds the instruction that is currently being
executed.
Program Counter:
It is another specialized register, which holds the
address of next instruction to be fetched and
executed.(it points to the next instruction).
General Purpose Registers:
These registers can be used for temporary storage of
data. Processor has ‘n’ general purpose registers.
28 Friday, January 25, 2019
MAR & MDR:
These two registers provide communication with the
memory.
Memory address Register: (MAR)
It holds the address of the location to be accessed.
Memory Data Register:
It contains the data to be written into or read out of
the addressed location.
29 Friday, January 25, 2019
30 Friday, January 25, 2019
Operating steps:
Execution of program starts when the PC is set to
point to the first instruction of the program.
The contents of the PC are transferred to the MAR
and a read control signal is sent to the memory.
After some time, the addressed word is read out of
the memory and loaded into the MDR.
Next, the contents of the MDR are transferred to the
IR.
At this point, the instruction is ready to be executed.
31 Friday, January 25, 2019
If the instruction involves an operation to be performed
by the ALU, it is necessary to obtain the required
operands.
If operand resides in the memory it has to be fetched by
sending its address to the MAR and initiates read cycle.
When the operand has been read from the memory into
the MDR, it is transferred from the MDR to the ALU.
Then the ALU can perform the desired operation.
If the result of this operation is to be stored in the
memory, then the result is sent to the MDR.
The address of the location where the result is to be
stored is sent to the MAR, and write cycle is initiated.
At some point during the execution of the current
instruction , the contents of the PC are incremented so
that PC points to the next instruction to be executed.
32 Friday, January 25, 2019
Bus Structures
So far we have discussed the functions of
individual parts of a computer.
To form an operational system. These parts must
be connected in some organized way.
A group of lines that serves as a connecting path
for several devices is called a BUS.
Bus contains three sets of lines
Data lines
Address lines
control lines.
33 Friday, January 25, 2019
The simplest way to interconnect functional units is
to use a single bus as shown in the figure 1.3
All units are connected to this bus.
Because bus can be used for only one transfer at a
time, only two units can actively use the bus at any
given time.
The advantage of the single bus-structure is its low
cost and its flexibility for attaching peripheral
devices.
multiple buses can be used to interconnect large
number of devices.
The devices connected to bus vary widely in their
speed of operation, some devices such as keyboards
and printers are relatively slow.
34 Friday, January 25, 2019
Memory and processor operate at high speeds.
To synchronize the speeds of these devices.
A common approach is to include buffer registers
with the devices to hold the information during
transfers.
35 Friday, January 25, 2019
36 Friday, January 25, 2019
Performance of a computer
The most important measure of a computer is how quickly it
can execute the programs.
The speed with which a computer executes the program is
affected by the design of its hardware and its machine
language instructions.
Performance of a computer is also affected by the compiler.
For the best performance, it is necessary to design the
compiler, the machine instruction set, and the hardware in a
coordinated way.
37 Friday, January 25, 2019
The processor time depends on the hardware involved in
the execution of individual machine instructions.
This hardware comprises the processor and the memory,
which are usually connected by bus.
Let us discuss the flow of program instructions and data
between the memory and processor.
At start of execution, all program instructions and
required data are stored in main memory.
As execution proceeds, instructions are fetched one by
one over the into the processor, and copy is placed in the
cache.
When execution of an instruction calls for data located in
the main memory., the data are fetched and a copy is
placed in the cache.
If the same instruction or data item is needed a second
time, it is read directly from the cache.
38 Friday, January 25, 2019
39 Friday, January 25, 2019
A program will be executed faster if the movement of
instructions and data between the main memory is
minimized.
For example, suppose a number of instructions are
executed repeatedly over short period of time, as
happens in the program loop.
If these instructions are available in the cache memory,
they can be fetched quickly during the period of
repeated use.
40 Friday, January 25, 2019
Processor clock
Processor circuits are controlled by a timing signal called
clock.
The clock defines regular time intervals, called clock cycles.
To execute a machine instruction, the processor divides
the action to be performed into sequence of basic steps,
such as each step to be completed in one clock cycle.
The length ‘p’ of one clock cycle is an important parameter
that affects the processor performance.
41 Friday, January 25, 2019
42 Friday, January 25, 2019
Clock rate:
The number of clock cycles per second is called
clock rate.
It is denoted by ‘R’.
R=1/p
It is measured in cycles per second.
Cycles per second is called hertz (Hz).
43 Friday, January 25, 2019
Basic Performance Equation
T = (N*S)/R
T processor time required to execute the
program.
N the actual number of instruction executions,
and is not necessarily equal to the number of
machine language instructions in the object
program.
Because some instructions may be executed more
than once, which is the case for instructions inside
a program loop.
S number of steps needed to execute one
machine instruction.
R clock rate
44 Friday, January 25, 2019
• To achieve high performance, the computer designer
must seek ways to reduce the value of ‘T’, which means
reducing ‘N’ and ‘S’, and increasing ‘R’.
• The value of ‘N’ is reduced if the source program is
compiled into fewer machine instructions.
• The value of ‘S’ is reduced if instructions have a
smaller number of basic steps to perform.
• Using higher- frequency clock increases the value of ‘R’.
which means that the time required to complete a basic
execution step is reduced.
45 Friday, January 25, 2019
Generations of computers
First Generation (1945-1955):
• The key concept of a stored program was introduced
by John von Neumann.
• Programs and their data were located in the same
memory , as they are today.
• Assembly language was used to prepare programs and
was translated into machine language for execution.
• Basic arithmetic operations were performed in a few
milliseconds using vacuum tube technology.
• Magnetic core memories and magnetic tape storage
devices were also developed.
46 Friday, January 25, 2019
47 Friday, January 25, 2019
Second generation(1955 – 1965):
• The invention of Transistors marked the start of
the second generation.
• Magnetic core memories and magnetic drum storage
devices were more widely used in the second generation.
• High level languages, such as Fortran were developed,
making preparation of programs much easier.
• System programs called compilers were developed to
translate these high level language programs into
corresponding assembly language program.
• Separate I/O processors were developed that could
operate in parallel with the central processor.
• IBM became a major computer manufacturer during
this time.
48 Friday, January 25, 2019
49 Friday, January 25, 2019
Third generation(1965-1975):
Third Generation Computers were based on integrated
circuit (IC) technology.
Integrated circuit technology:
The ability to fabricate many transistors on a single
silicon chip.
Integrated –circuit memories began to replace
magnetic core memories.
Other developments included the introduction of
microprogramming, parallelism, and pipelining.
Cache and virtual memories were developed.
50 Friday, January 25, 2019
• Fourth generation(1975 to the present):
• Fourth generation computers are based on VLSI
technology.
• Fabricating tens of thousands of transistor on a single
silicon chip is called VLSI.
• VLSI technology allowed a complete processor to be
fabricated on a single chip. This became known as a
microprocessor.
• Portable notebook computers , desktop computers
and workstations, interconnected by local area
networks.
51 Friday, January 25, 2019
52 Friday, January 25, 2019
Chapter 2: Machine Instructions
and programs:
53 Friday, January 25, 2019
Number Representation
Computers are built using logic circuits that
operate on information represented by two
valued electrical signals. We label the two
values as 0 and 1.
The most natural way to represent a number in
a computer system is by string of bits, called
binary number.
A text character can also be represented by a
string of bits called character code.
54 Friday, January 25, 2019
• We obviously need to represent both positive and
negative numbers.
• Three systems are used for representing such
numbers.
1. Sign- and –magnitude.
2. 1’ s Complement.
3. 2’s Complement.
• In all three systems, the left most bit is 0 for positive
numbers and 1 for negative numbers.
• Positive values have identical representations in all
three systems, but negative values have different
representations.
55 Friday, January 25, 2019
Sign- and - magnitude:
• In sign and magnitude system, negative values are
represented by changing the most significant bit from
0 to 1 in the b vector of the corresponding positive
value.
For example +5 is represented by 0101, and -5 is
represented by 1101.
1’s complement:
• In 1’s complement representation, negative values are
obtained by complementing each bit of the
corresponding positive value.
Thus, the representation for -3 is obtained by
complementing each bit in the vector 0011 to get 1100.
56 Friday, January 25, 2019
2’ s complement :
In 2’s complement, negative values are obtained by
adding 1 to the 1’s complement of that number.
2’s complement is the most efficient way to carry out
addition and subtraction operations.
It is one most often used in computers.
57 Friday, January 25, 2019
58 Friday, January 25, 2019
Addition and subtraction of signed numbers
Addition:
To add two signed numbers , add their n- bit
representations , ignoring the carry-out signal
from the most significant bit (MSB) position.
The sum will be algebraically correct value in the
2’s complement representation as long as the
answer is in the range -2n-1 through +2n-1 -1.
59 Friday, January 25, 2019
Subtraction of signed numbers:
To subtract two numbers X and Y, that is to perform
X-Y, form the 2’s complement of Y and then add it to
X, the result will be the algebraically correct value in
the 2’s complement representation system if the
answer is in the range
-2n-1 through +2n-1-1.
60 Friday, January 25, 2019
61 Friday, January 25, 2019
Overflow in integer arithmetic
In the 2’s complement number representation system,
n bits can represent values in the range -2n-1 through
+2n-1-1. for example, using four bits, the range of
numbers that can represented is -8 through +7.
When the result of an arithmetic operation is outside
regrettable range, an overflow has occurred.
For example, when using 4- bit signed numbers, if we try
to add the numbers +7 and +4, the output sum vector ,
S, is 1011. which is code for -5, an incorrect result.
Similarly, if we try to ad -4 and -6, we get S= 0110= +6,
another incorrect result
Thus , overflow may occur if both summands have the
same sign.
62 Friday, January 25, 2019
A simple way to detect overflow is to examine the
signs of the two summands X and Y and the sign of the
result. When both operands X and Y have the same
sign, an overflow occurs when the sign of S is not the
same as the signs of X and Y.
Characters :
In addition to numbers computers must be able to
handle nonnumeric text information consisting of
characters. Characters can be letters of the alphabet,
punctuation marks, and so on.
They are represented by codes that usually eight bits
long.
One of the most widely used codes is the American
Standards Committee on Information Interchange
(ASCII).
63 Friday, January 25, 2019