CSC211 Material
CSC211 Material
University, La pa i
Department of Mathematics/Computer Science
Course Title: Elementary Computer Organization and Architecture –Course Code: CSC 025
Lecturer: Adamu A
Computer organization defines the constituent parts of the system, how they are interconnected, and how
they interoperate in order to implement the architectural specification. It encompasses all physical
aspects of computer systems. E.g., circuit design, control signals, memory types. It deals with
how the computer works, how Components such as computer Central Processing Unit (CPU)
are organize, I/O devices [input (mouse, keyboard), output, (display, printer)], memory (disk
, memory, BUS method of connection, implementation using millions of transistors,
processor datapath and control, drives such as DRAM, SRAM, CD ROM are organized.
Logic gates are the basic building blocks of any digital system. It is an electronic circuit
having one or more than one input and only one output. The relationship between the input
and the output is based on certain logic. Based on this, logic gates are named as AND gate,
OR gate, NOT gate etc.
AND Gate
A circuit which performs an AND operation is shown in figure. It has n input (n >= 2) and
one output.
1
Logic diagram
Truth Table
OR Gate
A circuit which performs an OR operation is shown in figure. It has n input (n >= 2) and one
output.
Logic diagram
2
Truth Table
NOT Gate
NOT gate is also known as Inverter. It has one input A and one output Y.
Logic diagram
Truth Table
3
NAND Gate
A NOT-AND operation is known as NAND operation. It has n input (n >= 2) and one
output.
Logic diagram
Truth Table
NOR Gate
A NOT-OR operation is known as NOR operation. It has n input (n >= 2) and one output.
4
Logic diagram
Truth Table
XOR Gate
XOR or Ex-OR gate is a special type of gate. It can be used in the half adder, full adder and
subtractor. The exclusive-OR gate is abbreviated as EX-OR gate or sometime as X-OR gate.
It has n input (n >= 2) and one output.
5
Logic diagram
Truth Table
XNOR Gate
XNOR gate is a special type of gate. It can be used in the half adder, full adder and
subtractor. The exclusive-NOR gate is abbreviated as EX-NOR gate or sometime as X-NOR
gate. It has n input (n >= 2) and one output.
Logic diagram
6
Truth Table
A digital system can understand positional number system only where there are a few
symbols called digits and these symbols represent different values depending on the position
they occupy in the number.
The digit
The position of the digit in the number
The base of the number system (where base is defined as the total number of digits
available in the number system).
Say we have three numbers – 734, 971 and 207. The value of 7 in all three numbers is
different−
7
The weight age of each position can be represented as follows −
In digital systems, instructions are given through electric signals; variation is done by
varying the voltage of the signal. Having 10 different voltages to implement decimal number
system in digital equipment is difficult. So, many number systems that are easier to
implement digitally have been developed. Let’s look at them in detail.
Each position represents a specific power of the base (10). For example, the decimal number
1234 consists of the digit 4 in the units position, 3 in the tens position, 2 in the hundreds
position, and 1 in the thousands position, and its value can be written as
8
3 Hexa Decimal Number System
A method of representing numbers that has 2 as its base and uses only the digits 0 and
1.Each successive digit represents a power of 2.
Each binary digit is also called a bit. Binary number system is also positional value system,
where each digit has a value expressed in powers of 2, as displayed here.
In any binary number, the right most digit is called least significant bit (LSB) and leftmost
digit is called most significant bit (MSB).
And decimal equivalent of this number is sum of product of each digit with its positional
value.
Computer memory is measured in terms of how many bits it can store. Here is a chart for
memory capacity conversion.
9
1 Exabyte (EB) = 1024 PB
1 Zettabyte = 1024 EB
1 Yottabyte (YB) = 1024 ZB
Characteristics
Example 1
Binary Number: 101012
10
= 16 + 8 + 0 + 2 + 0
= 2610
Example 3
= 16+0+0+2+1
= 19
Example 4
= 128+64+32+16+8+4+2+1
=255
Example 5
= 8+4+0+1+0+0+0.25+0.125+0.0625
= 13.4375
11
Decimal equivalent of any octal number is sum of product of each digit with its positional
value.
Characteristics
Example
Octal Number − 125708
12
= 448 + 16 + 6
= 47010
Decimal equivalent of any hexadecimal number is sum of product of each digit with its
positional value.
Characteristics
Example −
Hexadecimal Number: 19FDE16
13
Step 19FDE16 ((1 × 164) + (9 × 163) + (F × 162) + (D × 161) +
1 (E × 160))10
Example 27FB16
= 1023410
0 0 0 0000
1 1 1 0001
2 2 2 0010
3 3 3 0011
14
4 4 4 0100
5 5 5 0101
6 6 6 0110
7 7 7 0111
8 8 10 1000
9 9 11 1001
A 10 12 1010
B 11 13 1011
C 12 14 1100
D 13 15 1101
E 14 16 1110
F 15 17 1111
15
to add the product of each digit with its positional value. Here we are going to learn other
conversion among these number systems.
Decimal to Binary
Decimal numbers can be converted to binary by repeated division of the number by 2 while
recording the remainder. Let’s take an example to see how this happens.
The remainders are to be read from bottom to top to obtain the binary equivalent.
4310 = 1010112
Decimal to Octal
Decimal numbers can be converted to octal by repeated division of the number by 8 while
recording the remainder. Let’s take an example to see how this happens.
47310 = 7318
Decimal to Hexadecimal
Decimal numbers can be converted to octal by repeated division of the number by 16 while
recording the remainder. Let’s take an example to see how this happens.
16
Reading the remainders from bottom to top we get,
42310 = 1A716
10 digits
7 punctuation marks
20 to 40 special characters
Now a computer understands only numeric values, whatever the number system used. So all
characters must have a numeric equivalent called the alphanumeric code. The most widely
used alphanumeric code is American Standard Code for Information Interchange (ASCII).
ASCII is a 7-bit code that has 128 (27) possible codes.
17
ISCII
ISCII stands for Indian Script Code for Information Interchange. ISCII was developed to
support Indian languages on computer. Language supported by ISCI include Devanagari,
Tamil, Bangla, Gujarati, Gurmukhi, Tamil, Telugu, etc. IISCI is mostly used by government
departments and before it could catch on, a new universal encoding standard
called Unicode was introduced.
18
Unicode
Unicode is an international coding system designed to be used with different language
scripts. Each character or symbol is assigned a unique numeric value, largely within the
framework of ASCII. Earlier, each script had its own encoding system, which could conflict
with each other.
In contrast, this is what Unicode officially aims to do − Unicode provides a unique number
for every character, no matter what the platform, no matter what the program, no matter
what the language.
Microprocessor Concepts
Microprocessor is the brain of computer, which does all the work. It is a computer
processor that incorporates all the functions of CPU (Central Processing Unit) on a single IC
(Integrated Circuit) or at the most a few ICs. Microprocessors were first introduced in early
1970s. 4004 was the first general purpose microprocessor used by Intel in building personal
computers. Arrival of low cost general purpose microprocessors has been instrumental in
development of modern society the way it has.
19
Microprocessor
Microprocessors Characteristics
Microprocessors are multipurpose devices that can be designed for generic or specialized
functions. The microprocessors of laptops and smartphones are general purpose whereas
ones designed for graphical processing or machine vision are specialized ones. There are
some characteristics that are common to all microprocessors.
Clock speed
Instruction set
Word size
20
Clock Speed
Every microprocessor has an internal clock that regulates the speed at which it executes
instructions and also synchronizes it with other components. The speed at which the
microprocessor executes instructions is called clock speed. Clock speeds are measured in
MHz or GHz where 1 MHz means 1 million cycles per second whereas 1 GHz equals to 1
billion cycles per second. Here cycle refers to single electric signal cycle.
Currently microprocessors have clock speed in the range of 3 GHz, which is maximum that
current technology can attain. Speeds more than this generate enough heat to damage the
chip itself. To overcome this, manufacturers are using multiple processors working in
parallel on a chip.
Word Size
Number of bits that can be processed by a processor in a single instruction is called its word
size. Word size determines the amount of RAM that can be accessed at one go and total
number of pins on the microprocessor. Total number of input and output pins in turn
determines the architecture of the microprocessor.
First commercial microprocessor Intel 4004 was a 4-bit processor. It had 4 input pins and 4
output pins. Number of output pins is always equal to the number of input pins. Currently
most microprocessors use 32-bit or 64-bit architecture.
Instruction Set
A command given to a digital machine to perform an operation on a piece of data is called
an instruction. Basic set of machine level instructions that a microprocessor is designed to
execute is called its instruction set. These instructions do carry out these types of operations
−
Data transfer
Arithmetic operations
Logical operations
Control flow
Input/output and machine control
21
Microprocessor Components
Compared to the first microprocessors, today’s processors are very small but still they have
these basic parts right from the first model −
CPU
Bus
Memory
CPU
CPU is fabricated as a very large scale integrated circuit (VLSI) and has these parts −
Bus
Connection lines used to connect the internal parts of the microprocessor chip is called bus.
There are three types of buses in a microprocessor −
Data Bus − Lines that carry data to and from memory are called data bus. It is a
bidirectional bus with width equal to word length of the microprocessor.
Address Bus − It is a unidirectional responsible for carrying address of a memory
location or I/O port from CPU to memory or I/O port.
Control Bus − Lines that carry control signals like clock signals, interrupt
signal or ready signal are called control bus. They are bidirectional. Signal that
denotes that a device is ready for processing is called ready signal. Signal that
indicates to a device to interrupt its process is called an interrupt signal.
Memory
Microprocessor has two types of memory
22
RAM − Random Access Memory is volatile memory that gets erased when power is
switched off. All data and instructions are stored in RAM.
ROM − Read Only Memory is non-volatile memory whose data remains intact even
after power is switched off. Microprocessor can read from it any time it wants but
cannot write to it. It is preprogrammed with most essential data like booting
sequence by the manufacturer.
Evaluation of Microprocessor
The first microprocessor introduced in 1971 was a 4-bit microprocessor with 4m5KB
memory and had a set of 45 instructions. In the past 5 decades microprocessor speed has
doubled every two years, as predicted by Gordon Moore, Intel co-founder. Current
microprocessors can access 64 GB memory. Depending on width of data microprocessors
can process, they are of these categories−
8-bit
16-bit
32-bit
64-bit
Size of instruction set is another important consideration while categorizing
microprocessors. Initially, microprocessors had very small instructions sets because complex
hardware was expensive as well as difficult to build.
As technology developed to overcome these issues, more and more complex instructions
were added to increase functionality of the microprocessor. However, soon it was realized
that having large instruction sets was counterproductive as many instructions that were
rarely used sat idle on precious memory space. So the old school of thought that supported
smaller instruction sets gained popularity.
Let us learn more about the two types of microprocessors based on their instruction set.
RISC
RISC stands for Reduced Instruction Set Computers. It has a small set of highly
optimized instructions. Complex instruction are also implemented using simpler
instructions, reducing the size of instruction set. The designing philosophy for RISC
incorporates these salient points −
23
Number of instructions should be minimum.
Examples of RISC processors are Intel P6, Pentium4, AMD K6 and K7, etc.
CISC
CISC stands for Complex Instruction Set Computers. It supports hundreds of instructions.
Computers supporting CISC can accomplish wide variety of tasks, making them ideal for
personal computers. These are some characteristics of CISC architecture −
Examples of CISC processors are Intel 386 & 486, Pentium, Pentium II and III, Motorola
68000, etc.
EPIC
EPIC stands for Explicitly Parallel Instruction Computing. It is a computer architecture
that is a cross between RISC and CISC, trying to provide the best of both. Its important
features include −
24
Machine-Level Representation of Data and Programs
The literal meaning of computer is a device that can calculate. However, modern computers
can do a lot more than calculate. Computer is an electronic device that receives input, stores
or processes the input as per user instructions and provides output in desired format.
Input-Process-Output Model
Computer input is called data and the output obtained after processing it, based on user’s
instructions is called information. Raw facts and figures which can be processed using
arithmetic and logical operations to obtain information are called data.
The corresponding figure for an actual computer looks something like this −
25
Input Unit − Devices like keyboard and mouse that are used to input data and
instructions to the computer are called input unit.
Output Unit − Devices like printer and visual display unit that are used to provide
information to the user in desired format are called output unit.
Control Unit − as the name suggests, this unit controls all the functions of the
computer. All devices or parts of computer interact through the control unit.
Arithmetic and Logic Unit − This is the brain of the computer where all arithmetic
and logical operations take place.
Memory − All input data, instructions and data interim to the processes are stored in
the memory. Memory is of two types – primary memory and secondary memory.
Primary memory resides within the CPU whereas secondary memory is external to it.
Control unit, arithmetic logic unit and memory are together called the central processing
unit or CPU. Computer devices like keyboard, mouse, printer, etc. that we can see and
touch are the hardware components of a computer. The set of instructions or programs that
make the computer function using these hardware parts are called software. We cannot see
or touch software. Both hardware and software are necessary for working of a computer.
Characteristics of Computer
To understand why computers are such an important part of our lives, let us look at some of
its characteristics −
Speed − Typically, a computer can carry out 3-4 million instructions per second.
Accuracy − Computers exhibit a very high degree of accuracy. Errors that may occur
are usually due to inaccurate data, wrong instructions or bug in chips – all human
errors.
Reliability − Computers can carry out same type of work repeatedly without
throwing up errors due to tiredness or boredom, which are very common among
humans.
Versatility − Computers can carry out a wide range of work from data entry and
ticket booking to complex mathematical calculations and continuous astronomical
observations. If you can input the necessary data with correct instructions, computer
will do the processing.
26
Storage Capacity − Computers can store a very large amount of data at a fraction of
cost of traditional storage of files. Also, data is safe from normal wear and tear
associated with paper.
Booting
Starting a computer or a computer-embedded device is called booting. Booting takes place
in two steps −
The first program or set of instructions that run when the computer is switched on is
called BIOS or Basic Input Output System. BIOS is a firmware, i.e. a piece of software
permanently programmed into the hardware.
27
Cold Booting − When the system is started by switching on the power supply it is
called cold booting. The next step in cold booting is loading of BIOS.
Warm Booting − When the system is already running and needs to be restarted or
rebooted, it is called warm booting. Warm booting is faster than cold booting
because BIOS is not reloaded.
All modern computers and computing devices use microprocessors whose speeds and
storage capacities are skyrocketing day by day. The developmental benchmark for
computers is now their size. Computers are now classified on the basis of their use or size −
Desktop
Laptop
Tablet
Server
Mainframe
Supercomputer
Let us look at all these types of computers in detail.
Desktop
Desktop computers are personal computers (PCs) designed for use by an individual at a
fixed location. IBM was the first computer to introduce and popularize use of desktops. A
desktop unit typically has a CPU (Central Processing Unit), monitor, keyboard and mouse.
Introduction of desktops popularized use of computers among common people as it was
compact and affordable.
28
Desktop Computer
Riding on the wave of desktop’s popularity many software and hardware devices were
developed specially for the home or office user. The foremost design consideration here was
user friendliness.
Laptop
Despite its huge popularity, desktops gave way to a more compact and portable personal
computer called laptop in 2000s. Laptops are also callednotebook computers or
simply notebooks. Laptops run using batteries and connect to networks using Wi-Fi
(Wireless Fidelity) chips. They also have chips for energy efficiency so that they can
conserve power whenever possible and have a longer life.
29
Laptop
Modern laptops have enough processing power and storage capacity to be used for all office
work, website designing, software development and even audio/video editing.
Tablet
After laptops computers were further miniaturized to develop machines that have processing
power of a desktop but are small enough to be held in one’s palm. Tablets have touch
sensitive screen of typically 5 to 10 inches where one finger is used to touch icons and
invoke applications.
30
Tablet
Keyboard is also displayed virtually whenever required and used with touch strokes.
Applications that run on tablets are called apps. They use operating systems by Microsoft
(Windows 8 and later versions) or Google (Android). Apple computers have developed their
own tablet called iPad which uses a proprietary OS called iOS.
Server
Servers are computers with high processing speeds that provide one or more services to
other systems on the network. They may or may not have screens attached to them. A group
of computers or digital devices connected together to share resources is called a network.
31
Server
Servers have high processing powers and can handle multiple requests simultaneously. Most
commonly found servers on networks include −
Game server
Application server
Database server
Mail server
Print server
32
Mainframe
Mainframes are computers used by organizations like banks, airlines and railways to handle
millions and trillions of online transactions per second. Important features of mainframes are
−
Big in size
Hundreds times Faster than servers, typically hundred megabytes per second
Very expensive
Supercomputer
Supercomputers are the fastest computers on Earth. They are used for carrying out
complex, fast and time intensive calculations for scientific and engineering applications.
Supercomputer speed or performance is measured in teraflops, i.e. 1012 floating point
operations per second.
Supercomputer
33
Chinese supercomputer Sunway TaihuLight is the world’s fastest supercomputer with a
rating of 93 petaflops per second, i.e. 93 quadrillion floating point operations per second.
Weather forecasting
Environmental research
34
RAM
RAM stands for Random Access Memory. The processor accesses all memory addresses
directly, irrespective of word length, making storage and retrieval fast. RAM is the fastest
memory available and hence most expensive. These two factors imply that RAM is available
in very small quantities of up to 1GB. RAM is volatile but my be of any of these two types
SRAM (SRAM)
Each cell in SRAM is made of a flip flop that stores one bit. It retains its bit till the power
supply is on and doesn’t need to be refreshed like DRAM. It also has shorter read-write
cycles as compared to DRAM. SRAM is used in specialized applications.
ROM
ROM stands for Read Only Memory. As the name suggests, ROM can only be read by the
processor. New data cannot be written into ROM. Data to be stored into ROM is written
during the manufacturing phase itself. They contain data that does not need to be altered,
like booting sequence of a computer or algorithmic tables for mathematical applications.
ROM is slower and hence cheaper than RAM. It retains its data even when power is
switched off, i.e. it is non-volatile. ROM cannot be altered the way RAM can be but
technologies are available to program these types of ROMs −
35
PROM (Programmable ROM)
PROM can be programmed using a special hardware device called PROM programmer or
PROM burner.
Cache Memory
Small piece of high speed volatile memory available to the processor for fast processing is
called cache memory. Cache may be a reserved portion of main memory, another chip on
CPU or an independent high speed storage device. Cache memory is made of fast speed
SRAMs. The process of keeping some data and instructions in cache memory for faster
access is called caching. Caching is done when a set of data or instructions is accesses again
and again.
Whenever the processor needs any piece of data or instructions, it checks the cache first. If it
is unavailable there, then the main memory and finally secondary memory is accessed. As
cache has very high speed, time spent in accessing it every time is negligible as compared to
time saved if data indeed is in the cache. Finding data or instruction in cache is called cache
hit.
36
Let us look at some of the secondary memory devices available.
37
Standard diameter of these disks is 14 inches and they rotate with speeds varying from 4200
rpm (rotations per minute) for personal computers to 15000 rpm for servers. Data is stored
by magnetizing or demagnetizing the magnetic coating. A magnetic reader arm is used to
read data from and write data to the disks. A typical modern HDD has capacity in terabytes
(TB).
CD Drive
CD stands for Compact Disk. CDs are circular disks that use optical rays, usually lasers, to
read and write data. They are very cheap as you can get 700 MB of storage space for less
than a dollar. CDs are inserted in CD drives built into CPU cabinet. They are portable as you
can eject the drive, remove the CD and carry it with you. There are three types of CDs −
CD-ROM (Compact Disk – Read Only Memory) − The data on these CDs are
recorded by the manufacturer. Proprietary Software, audio or video are released on
CD-ROMs.
CD-R (Compact Disk – Recordable) − Data can be written by the user once on the
CD-R. It cannot be deleted or modified later.
CD-RW (Compact Disk – Rewritable) − Data can be written and deleted on these
optical disks again and again.
DVD Drive
DVD stands for Digital Video Display. DVD are optical devices that can store 15 times the
data held by CDs. They are usually used to store rich multimedia files that need high storage
capacity. DVDs also come in three varieties – read only, recordable and rewritable.
Pen Drive
Pen drive is a portable memory device that uses solid state memory rather than magnetic
fields or lasers to record data. It uses a technology similar to RAM, except that it is
nonvolatile. It is also called USB drive, key drive or flash memory.
38
Blu Ray Disk
Blu Ray Disk (BD) is an optical storage media used to store high definition (HD) video and
other multimedia filed. BD uses shorter wavelength laser as compared to CD/DVD. This
enables writing arm to focus more tightly on the disk and hence pack in more data. BDs can
store up to 128 GB data.
39
Let us look at some of the most commonly used ports.
Serial Port
Serial ports transmit data sequentially one bit at a time. So they need only one wire to
transmit 8 bits. However it also makes them slower. Serial ports are usually 9-pin or 25-pin
male connectors. They are also known as COM (communication) ports or RS323C ports.
40
Parallel Port
Parallel ports can send or receive 8 bits or 1 byte at a time. Parallel ports come in form of
25-pin female pins and are used to connect printer, scanner, external hard disk drive, etc.
USB Port
USB stands for Universal Serial Bus. It is the industry standard for short distance digital
data connection. USB port is a standardized port to connect a variety of devices like printer,
camera, keyboard, speaker, etc.
41
PS-2 Port
PS/2 stands for Personal System/2. It is a female 6-pin port standard that connects to the
male mini-DIN cable. PS/2 was introduced by IBM to connect mouse and keyboard to
personal computers. This port is now mostly obsolete, though some systems compatible with
IBM may have this port.
Infrared Port
Infrared port is a port that enables wireless exchange of data within a radius of 10m. Two
devices that have infrared ports are placed facing each other so that beams of infrared lights
can be used to share data.
Bluetooth Port
Bluetooth is a telecommunication specification that facilitates wireless connection between
phones, computers and other digital devices over short range wireless connection. Bluetooth
port enables synchronization between Bluetooth-enabled devices. There are two types of
Bluetooth ports −
Incoming − It is used to receive connection from Bluetooth devices.
Outgoing − It is used to request connection to other Bluetooth devices.
FireWire Port
FireWire is Apple Computer’s interface standard for enabling high speed communication
using serial bus. It is also called IEEE 1394 and used mostly for audio and video devices
like digital camcorders
Digital Computers use Binary number system to represent all types of information inside the
computers. Alphanumeric characters are represented using binary bits (i.e., 0 and 1). Digital
representations are easier to design, storage is easy, accuracy and precision are greater.
42
There are various types of number representation techniques for digital number
representation, for example: Binary number system, octal number system, decimal number
system, and hexadecimal number system etc. But Binary number system is most relevant and
popular for representing numbers in digital computer system.
There are two major approaches to store real numbers (i.e., numbers with fractional
component) in modern computing. These are (i) Fixed Point Notation and (ii) Floating Point
Notation. In fixed point notation, there are a fixed number of digits after the decimal point,
whereas floating point number allows for a varying number of digits after the decimal point.
Fixed-Point Representation:
This representation has fixed number of bits for integer part and for fractional part. For
example, if given fixed-point representation is IIII.FFFF, then you can store minimum value
is 0000.0001 and maximum value is 9999.9999. There are three parts of a fixed-point number
representation: the sign field, integer field, and fractional field.
43
Signed representation: range from -(2(k-1)-1) to (2(k-1)-1), for k bits.
1’s complement representation: range from -(2(k-1)-1) to (2(k-1)-1), for k bits.
2’s complementation representation: range from -(2(k-1)) to (2(k-1)-1), for k bits.
Example: Assume number is using 32-bit format which reserve 1 bit for the sign, 15 bits for
the integer part and 16 bits for the fractional part.
These are above smallest positive number and largest positive number which can be store in
32-bit representation as given above format. Therefore, the smallest positive number is 2-16 ≈
0.000015 approximate and the largest positive number is (215-1)+(1-2-16)=215(1-2-16) =32768,
and gap between these numbers is 2-16.
We can move the radix point either left or right with the help of only integer field is 1.
Floating-Point Representation:
44
This representation does not reserve a specific number of bits for the integer part or the
fractional part. Instead it reserves a certain number of bits for the number (called the mantissa
or significand) and a certain number of bits to say where within that number the decimal
place sits (called the exponent).
The floating number representation of a number has two part: the first part represents a
signed fixed point number called mantissa. The second part of designates the position of the
decimal (or binary) point and is called the exponent. The fixed point mantissa may be fraction
or an integer. Floating -point is always interpreted to represent a number in the following
form: Mxre.
Only the mantissa m and the exponent e are physically represented in the register (including
their sign). A floating-point binary number is represented in a similar manner except that is
uses base 2 for the exponent. A floating-point number is said to be normalized if the most
significant digit of the mantissa is 1.
So, actual number is (-1)s(1+m)x2(e-Bias), where s is the sign bit, m is the mantissa, e is the
exponent value, andBias is the bias number.
Note that signed integers and exponent are represented by either sign representation, or one’s
complement representation, or two’s complement representation.
The floating point representation is more flexible. Any non-zero number can be represented
in the normalized form of ±(1.b1b2b3 ...)2x2n This is normalized form of a number x.
Example: Suppose number is using 32-bit format: the 1 bit sign bit, 8 bits for signed
exponent, and 23 bits for the fractional part. The leading bit 1 is not stored (as it is always 1
for a normalized number) and is referred to as a“hidden bit”.
45
Where 00000101 is the 8-bit binary value of exponent value +5.
Note that 8-bit exponent field is used to store integer exponents -126 ≤ n ≤ 127.
The precision of a floating-point format is the number of positions reserved for binary digits
plus one (for the hidden bit). In the examples considered here the precision is 23+1=24.
The gap between 1 and the next normalized floating-point number is known as machine
epsilon. the gap is (1+2-23)-1=2-23for above example, but this is same as the smallest positive
floating-point number because of non-uniform spacing unlike in the fixed-point scenario.
Note that non-terminating binary numbers can be represented in floating point representation,
e.g., 1/3 = (0.010101 ...)2 cannot be a floating-point number as its binary representation is
non-terminating.
So, actual number is (-1)s(1+m)x2(e-Bias), where s is the sign bit, m is the mantissa, e is the
exponent value, andBias is the bias number. The sign bit is 0 for positive number and 1 for
negative number. Exponents are represented by or two’s complement representation.
46
According to IEEE 754 standard, the floating-point number is represented in following ways:
Half Precision (16 bit): 1 sign bit, 5 bit exponent, and 10 bit mantissa
Single Precision (32 bit): 1 sign bit, 8 bit exponent, and 23 bit mantissa
Double Precision (64 bit): 1 sign bit, 11 bit exponent, and 52 bit mantissa
Quadruple Precision (128 bit): 1 sign bit, 15 bit exponent, and 112 bit mantissa
There are some special values depended upon different values of the exponent and mantissa
in the IEEE 754 standard.
All the exponent bits 0 with all mantissa bits 0 represents 0. If sign bit is 0, then +0, else -
0.
All the exponent bits 1 with all mantissa bits 0 represents infinity. If sign bit is 0, then +∞,
else -∞.
All the exponent bits 0 and mantissa bits non-zero represents denormalized number.
All the exponent bits 1 and mantissa bits non-zero represents error.
47