Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 129

Architecture of Computers

Dr. Nitish Kumar Ojha


Introduction
• Name of The Subject – Architecture of Computers
• Course Code - CII3SE003CI
• Day – Every Thursday
• Time – 8.00 AM-9.55 AM – Polish Time.
• Mode – Online
• ECTS credit allocation (and other scores) – 4
• Language - English
About me -
• Name – Dr. Nitish Kumar Ojha
• Emai ID – n.ojha@vistula.edu.pl
• Phone - +91-9473651545
Course Objective -
• To impart an understanding of the internal organization
and operations of a computer and to introduce the
concepts of processor logic design and control logic
design.

1 – Organization
2 – Operation
3 – Design
4 – Control
Computer Architecture
CO1: Identify the basic structure and functional units
of a digital computer.

CO2: Study the architecture of Bus and registers.

CO3: Study the design of arithmetic and logic unit and


implementation of fixed point and floating-point
arithmetic operations.
•CO4:Understand basic processing unit and organization
of simple processor including instruction sets, instruction
formats and various addressing modes.

•CO5:Study the two types of control unit techniques.

• CO6: Describe hierarchical memory systems including


cache memories and select appropriate interfacing
standards for I/O devices.
Course Description

• This course discusses the basic structure of a digital


computer and used for understanding the organization of
various units such as control unit, Arithmetic and Logical
unit and Memory unit and I/O unit in a digital computer.
Syllabus -
Books
• Text book –
• M. Morris Mano, Computer System Architecture, Pearson.

References –
1. C. Hamacher, Z. Vranesic and S. Zaky, "Computer Organization",
McGrawHill, 2002.
2. W. Stallings, "Computer Organization and Architecture - Designing
for Performance", Prentice Hall of India, 2002.
3. D. A. Patterson and J. L. Hennessy, "Computer Organization and
Design - The Hardware/Software Interface", Morgan Kaufmann,1998.
4. J.P. Hayes, "Computer Architecture and Organization", McGraw-Hill,
1998.
Computer Organization
and Architecture
Why Study Computer Architecture?
• Because you use it everyday,

• Because you will likely use it for the rest of your life,

• Because you are a CS major, studying computer science.

• Because computer architecture is perhaps the most


fundamental subject in computer science.

• Without computers, the field of computer science does not


exist.
• Whatever we do, be it surfing the web, sending email,
writing a document, is on top of computer arch8tiecture,
or computers.

• The subject explores how machines are designed, built,


and operate.

• Knowing what's inside and how it works will help you


design, develop, and implement applications better, faster,
cheaper, more efficient, and easier to use because you will
be able to make informed decisions instead of
guestimating and assuming.
• In this course, you will learn contemporary state of the art
in computer hardware, including the internal working of
nano-scale microprocessors to large-scale data center
infrastructures and how to program many-core machines
as well as a cluster of virtual/physical machines that
power data centers which in turn enable cloud computing.
• Specifically, the course contents are organized into three
categories: macro-scale motherboard, nano-scale
microprocessor, and large-scale cluster of many core
microprocessors.

• Macro-scale topics includes motherboard organization,


bus architecture, L1-L3 cache organization and their
policies, SDRAM DDR1-4 memory and DIMM cards,
storage and networking devices and interconnection
networks including switch architecture.
• Micro-scale topics explicate the internal working of
microprocessors including integer and floating point
arithmetic, pipelining concepts with dynamic instruction
scheduling, branch prediction with speculation, hardware
multithreading, exploiting instruction level parallelism,
data level parallelism and thread level parallelism.
• Large-scale topics involve many cores to many
virtual/physical machines and their programming
paradigms that power data centres with adaptive elastic
computing infrastructures or cloud computing.

• The technologies that power data centers include


virtualization of physical resources, virtual machine
monitors, load balancing of virtual/physical machines with
autonomous as well as scheduled virtual machine
migration.
• Computer Organization and Architecture lets you know
how exactly each instruction is executed at the micro
level. The data flow, timing analysis, memory
hierarchy, trade offs between execution cycles,
hardware requirements/costs, software-hardware
trade-offs can be known.
• If you plan to study embedded systems/ processor design, these
concepts are very important, as they form the basis of design
strategy.

• It is also a well known fact that assembly coding is closest to the


computer, and it is always most optimum, if written properly.

• This is very important for real-time or time critical systems


coding, as each millisecond is very important. Knowing the
architecture completely helps you write assembly codes.

• If you are writing assembly codes, you know exactly how many
instructions-cycle it will take to execute it, which is generally not
possible in higher languages like C/Java etc.
• The memory hierarchy model lets you optimize the Page
file/cache/RAM, etc. to get the code execute in least time.

• Also, it lets you know how your own personal computer


will perform, and what limits it can reach. It can let you
decide what specifications your PC should have to
perform well!

• Also, it is useful for a coder, or compiler-designer, as


computer organization teaches us how 'hazards' and
'stalls' can be avoided by changing the coding order, and
algorithms, and to make use of the 'pipeline' as best as
possible. And these are just some important advantages of
Computer Architecture.
Functional Units Of Digital System
And Their Interconnections
• Computer: A computer is a combination of hardware and
software resources which integrate together and provides
various functionalities to the user.

• Hardware are the physical components of a computer like


the processor, memory devices, monitor, keyboard etc.
while software is the set of programs or instructions that
are required by the hardware resources to function
properly.
• There are a few basic components that aids the working-
cycle of a computer i.e. the Input- Process- Output Cycle
and these are called as the functional components of a
computer. It needs certain input, processes that input and
produces the desired output.

• The input unit takes the input, the central processing unit
does the processing of data and the output unit produces
the output. The memory unit holds the data and
instructions during the processing.
• Digital Computer: A digital computer can be defined as a
programmable machine which reads the binary data passed as
instructions, processes this binary data, and displays a
calculated digital output. Therefore, Digital computers are
those that work on the digital data.
• A computer organization describes the functions and
design of the various units of a digital system.

• A general-purpose computer system is the best-known


example of a digital system. Other examples include
telephone switching exchanges, digital voltmeters, digital
counters, electronic calculators and digital displays.

• Computer architecture deals with the specification of


the instruction set and the hardware units that implement
the instructions.
• Computer hardware consists of electronic circuits, displays,
magnetic and optic storage media and also the communication
facilities.

• Functional units are a part of a CPU that performs the


operations and calculations called for by the computer
program.

• Functional units of a computer system are parts of the CPU


(Central Processing Unit) that performs the operations and
calculations called for by the computer program.

• A computer consists of five main components namely, Input


unit, Central Processing Unit, Memory unit Arithmetic &
logical unit, Control unit and an Output unit.
Input unit

• Input units are used by the computer to read the data.


The most commonly used input devices are keyboards,
mouse, joysticks, trackballs, microphones, etc.

• However, the most well-known input device is a


keyboard. Whenever a 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.
Central Processing Unit -
• Central processing unit commonly known as CPU can be
referred as an electronic circuitry within a computer that
carries out the instructions given by a computer program
by performing the basic arithmetic, logical, control and
input/output (I/O) operations specified by the instructions.
Memory Unit -
• The Memory unit can be referred to as the storage area in which
programs are kept which are running, and that contains data
needed by the running programs.

• The Memory unit can be categorized in two ways namely, primary


memory and secondary memory.

• It enables a processor to access running execution applications and


services that are temporarily stored in a specific memory location.

• Primary storage is the fastest memory that operates at electronic


speeds. Primary memory contains a large number of
semiconductor storage cells, capable of storing a bit of
information. The word length of a computer is between 16-64 bits.
Memory Unit -
• It is also known as the volatile form of memory, means when the computer is shut down,
anything contained in RAM is lost.

• Cache memory is also a kind of memory which is used to fetch the data very soon. They are
highly coupled with the processor.

• The most common examples of primary memory are RAM and ROM.

• Secondary memory is used when a large amount of data and programs have to be stored
for a long-term basis.

• It is also known as the Non-volatile memory form of memory, means the data is stored
permanently irrespective of shut down.

• The most common examples of secondary memory are magnetic disks, magnetic tapes, and
optical disks.
Arithmetic & Logical Unit -
• Most of all the arithmetic and logical operations of a
computer are executed in the ALU (Arithmetic and
Logical Unit) of the processor. It performs arithmetic
operations like addition, subtraction, multiplication,
division and also the logical operations like AND, OR,
NOT operations.
Control Unit -
• The control unit is a component of a computer's central
processing unit that coordinates the operation of the
processor. It tells the computer's memory, arithmetic/logic
unit and input and output devices how to respond to a
program's instructions.
• The control unit is also known as the nerve center of a
computer system.
Output Unit -

• The primary function of the output unit is to send the


processed results to the user. Output devices display
information in a way that the user can understand.

• Output devices are pieces of equipment that are used to


generate information or any other response processed by the
computer. These devices display information that has been
held or generated within a computer.

• The most common example of an output device is a


monitor.
Interconnections -
Register Transfer Language
• A digital computer system exhibits an interconnection of
digital modules such as registers, decoders, arithmetic
elements, and Control logic.

• These digital modules are interconnected with some


common data and control paths to form a complete
digital system.

• Moreover, digital modules are best defined by the


registers and the operations that are performed on the
data stored in them.
The term “Register Transfer” can perform micro-operations and
transfer the result of operation to the same or other register.

• Micro-operations : The operation executed on the data store


in registers are called micro-operations. They are detailed low-
level instructions used in some designs to implement complex
machine instructions.

• Register Transfer : The information transformed from one


register to another register is represented in symbolic form by
replacement operator is called Register Transfer.

• Replacement Operator : In the statement, R2 <- R1, <- acts


as a replacement operator. This statement defines the transfer
of content of register R1 into register R2.
• There are various methods of RTL –
1. General way of representing a register is by the name
of the register enclosed in a rectangular box as
shown –

2. Register is numbered in a sequence of 0 to (n-1) as


shown -
3. The numbering of bits in a register can be marked
on the top of the box as shown –

4. A 16-bit register PC is divided into 2 parts- Bits (0


to 7) are assigned with lower byte of 16-bit address
and bits (8 to 15) are assigned with higher bytes of
16-bit address as shown -
Basic symbols of RTL :
Register Transfer Operations:
• The operation performed on the data stored in the
registers are referred to as register transfer operations.

• There are different types of register transfer operations: -

1. Simple Transfer – R2 <- R1 –


The content of R1 are copied into R2 without affecting
the content of R1. It is an unconditional type of transfer
operation.
2. Conditional Transfer – It indicates that if P=1,
then the content of R1 is transferred to R2. It is a
unidirectional operation.
3. Simultaneous Operations – If 2 or more operations are to
occur simultaneously then they are separated with comma (,).

If the control function P=1, then load the content of R1 into


R2 and at the same clock load the content of R2 into R1.
• The Register Transfer Language is the symbolic
representation of notations used to specify the sequence
of micro-operations.

• In a computer system, data transfer takes place between


processor registers and memory and between processor
registers and input-output systems
Logic Micro Operations -
• Logic microoperations specify binary operations for strings of bits
stored in registers.

• These operations consider each bit of the register separately and treat
them as binary variables.

• For example, the exclusive-OR microoperation with the contents of


two registers R 1 and R2 is symbolized by the statement P: R1 ← R1
⊕ R2

• It specifies a logic microoperation to be executed on the individual bits


of the registers provided that the control variable P = 1. As a numerical
example, assume that each register has four bits. Let the content of R1
be 1010 and the content of R2 be 1100.
• Special symbols will be adopted for the logic microoperations
OR, AND, and complement, to distinguish them from the
corresponding symbols used to express Boolean functions.

• The symbol V will be used to denote an OR microoperation and


the symbol ∧ to denote an AND microoperation. The complement
microoperation is the same as the 1's complement and uses a bar
on top of the symbol that denotes the register name.

• By using different symbols, it will be possible to differentiate


between a logic microoperation and a control (or Boolean)
function.

• Another reason for adopting two sets of symbols is to be able to


distinguish the symbol + , when used to symbolize an arithmetic
plus, from a logic OR operation.
• List of Logic Microoperations –

• There are 16 different logic operations that can be


performed with two binary variables.

• They can be determined from all possible truth tables


obtained with two binary variables as shown in Table
---
• The 16 logic microoperations are derived from these
functions by replacing variable x by the binary content of
register A and variable y by the binary content of register B.

• It is important to realize that the Boolean functions listed in


the first column of Table below represent a relationship
between two binary variables x and y.
Hardware Implementation -
• The hardware implementation of logic microoperations
requires that logic gates be inserted for each bit or pair of
bits in the registers to perform the required logic
function.

• Although there are 16 logic microoperations, most


computers use only four-AND, OR, XOR (exclusive-
OR), and complement from which all others can be
derived.

• The next Figure shows one stage of a circuit that


generates the four basic logic microoperations .
• It consists of four gates and a multiplexer. Each of the four logic operations is
generated through a gate that performs the required logic.

• The outputs of the gates are applied to the data inputs of the multiplexer.
• The two selection inputs S1 and S0 choose one of the data inputs of the
multiplexer and direct its value to the output.
Some Applications
• Logic microoperations are very useful for manipulating
individual bits or a portion of a word stored in a register.

• They can be used to change bit values, delete a group of


bits, or insert new bit values into a register.
Shift Microoperations -

• Shift microoperations are used for serial transfer of data.


They are also used in conjunction with arithmetic, logic,
and other data-processing operations.

• The contents of a register can be shifted to the left or the


right. At the same time that the bits are shifted, the first
flip-flop receives its binary information from the serial
input.
• During a shift-left operation the serial input transfers a
bit into the rightmost position.

• During a shift-right operation the serial input transfers


a bit into the leftmost position.

• The information transferred through the serial input


determines the type of shift.
• There are three types of shifts: logical, circular, and
arithmetic.

• A logical shift is one that transfers 0 through the serial


input. We will adopt the symbols shl and shr for logical
shift-left and shift-right microoperations.
• For example:

• Two microoperations that specify a 1-bit shift to the left of


the content of register R 1 and a 1-bit shift to the right of
the content of register R2. The register symbol must be the
same on both sides of the arrow.
Done

Done

Today
Adder - Subtractor - Incrementor

• In Digital Circuits, A Binary Adder-Subtractor is one


which is capable of both addition and subtraction of
binary numbers in one circuit itself.

• The operation being performed depends upon the binary


value the control signal holds. It is one of the components
of the ALU (Arithmetic Logic Unit).
4 -bit Adder-Subtractor
logical circuit
• The circuit combines both addition and subtraction
operations.

• The circuit differs from the 4-bit binary adder shown in


figure by including an exclusive-OR gate which receives
input M and one of the inputs (B) with each full-adder.

• The mode input M controls the operation of the circuit as


follows:
• The mode input M controls the operation of the circuit as follows:

1. For M = 0
The circuit is an adder, since we have .
The full-adders receive the value of B, the input carry C0 is 0, and
the circuit performs the addition of A to B (i.e. A+B).

2. For M = 1
The circuit becomes a Subtractor, since we have
The full-adders receive the value of B, the input carry C0 is 1.
The B inputs are all complemented and a 1 is added through the input
carry. The circuit performs the addition of A to 2’s complement of B.
Note
Incrementing
• Data A can be incremented if logic 1 is applied to the control
inputs of MUX 1 and MUX 3.

• This will add B to A, with data B made zero by applying


logic 0 to the control input of MUX 2.

• The 1 that must be added to data A is supplied by making the


control input of the CARRY SELECT block logic 1, causing
the carry input to the adder to be logic 1.

• The result at the adder output is therefore A + 1, again the


flags are set by the result.
Arithmetic and Logic Units
• Arithmetic and Logic Units (or ALUs) are found at the core of
microprocessors, where they implement the arithmetic and logic functions
offered by the processor (e.g., addition, subtraction, AND'ing two values,
etc.).

• An ALU is a combinational circuit that combines many common logic


circuits in one block.

• ALUs can be designed to perform a variety of different arithmetic and logic


functions.

• Possible arithmetic functions include addition, subtraction, multiplication,


comparison, increment, decrement, shift, and rotate; possible logic
functions include AND, OR, XOR, XNOR, INV, CLR (for clear), and
PASS (for passing a value unchanged).
• An ALU could be designed to include all of these
functions, or a subset could be chosen to meet the specific
needs of a given application.
• Either way, the design process is similar (but simpler for
an ALU with fewer functions).
• All of these functions find use in computing systems,
although a complete description of their use is beyond
the scope of this document.
Unit – 2 - Part – A

Topic 1 - Representation of numbers in 1’s and


2’s complement
Number Systems
• An unsigned integer number A can be represented using n
digits in base b:

Where value is defined as -

• This representation of numbers are known as – Positional


Representation Systems.
Number System -
Positional Representation Systems
• 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.

• A value of each digit in a number can be determined using –


• 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)
Decimal Number System
• The number system that we use in our day-to-day life is the
decimal number system.
• Decimal number system has base 10 as it uses 10 digits from 0 to
9.
• In decimal number system, the successive positions to the left of
the decimal point represents units, tens, hundreds, thousands and
so on.
• Each position represents a specific power of the base (10).
For example, the decimal number 1234
• 4 in the units position,
• 3 in the tens position,
• 2 in the hundreds position,
• and 1 in the thousands position
• As a computer programmer or an IT professional, you
should understand the following number systems which
are frequently used in computers.
Binary Number System
Characteristics

• Uses two digits, 0 and 1.

• Also called base 2 number system

• Each position in a binary number represents a 0 power of the


base (2). Example: 20

• Last position in a binary number represents an x power of the


base (2).
Example: 2x where x represents the last position - 1.
• Binary Number: 10101
Calculating Decimal Equivalent −
Octal Number System
Characteristics

• Uses eight digits, 0,1,2,3,4,5,6,7.

• Also called base 8 number system

• Each position in an octal number represents a 0 power of the base (8).


Example: 80

• Last position in an octal number represents an x power of the base (8).


Example: 8x where x represents the last position - 1.
• Octal Number − 12570
Calculating Decimal Equivalent −
Conversion -
• There are many methods or techniques which can be used
to convert numbers from one base to another.

• Decimal to Other Base System


• Binary to Octal
• Octal to Binary
• Binary to Hexadecimal
• Hexadecimal to Binary
Decimal to Other Base System
Step 1 − Divide the decimal number to be converted by the
value of the new base.

Step 2 − Get the remainder from Step 1 as the rightmost


digit (least significant digit) of new base number.

Step 3 − Divide the quotient of the previous divide by the


new base.

Step 4 − Record the remainder from Step 3 as the next digit


(to the left) of the new base number.
• Decimal Number: 29
• Calculating Binary Equivalent −

As mentioned in Steps 2 and 4, the remainders have to be arranged in the reverse order so that
the first remainder becomes the Least Significant Digit (LSD) and the last remainder becomes
the Most Significant Digit (MSD).

Decimal Number − 29 = Binary Number − 11101


Other Base System to Decimal System
Step 1 − Determine the column (positional) value of each
digit (this depends on the position of the digit and the
base of the number system).

Step 2 − Multiply the obtained column values (in Step 1) by


the digits in the corresponding columns.

Step 3 − Sum the products calculated in Step 2. The total is


the equivalent value in decimal.
Example
• Binary Number − 11101
• Calculating Decimal Equivalent −

• Binary Number − 111012 = Decimal Number − 29


Octal to Binary
Steps

Step 1 − Convert each octal digit to a 3 digit binary number


(the octal digits may be treated as decimal for this
conversion).

Step 2 − Combine all the resulting binary groups (of 3


digits each) into a single binary number.
Example

• Octal Number − 258

• Calculating Binary Equivalent −


• Advantages of Binary Codes –

• Binary codes are suitable for the computer applications.


• Binary codes are suitable for the digital communications.
• Binary codes make the analysis and designing of digital circuits if we use
the binary codes.
• Since only 0 & 1 are being used, implementation becomes easy.

• Classification of binary codes

• Weighted Codes
• Non-Weighted Codes
• Binary Coded Decimal Code
• Alphanumeric Codes
• Error Detecting Codes
• Error Correcting Codes
Done

Today’s
Class
Complement
Arithmetic
Unit – 2, Part –A, Topic - 1
• Complements are used in the digital computers in order to
simplify the subtraction operation and for the logical
manipulations.

• For each radix-r system (radix r represents base of number


system) there are two types of complements.
Binary System Complements
• 1's complement

• The 1's complement of a number is found by changing


all 1's to 0's and all 0's to 1's. This is called as taking
complement or 1's complement. Example of 1's
Complement is as follows.
2's complement
• The 2's complement of binary number is obtained by adding 1 to the Least Significant Bit
(LSB) of 1's complement of the number.

• 2's complement = 1's complement + 1

• Example of 2's Complement is as follows -


Binary Addition
• It is a key for binary subtraction, multiplication, division. There
are four rules of binary addition.

• In fourth case, a binary addition is creating a sum of (1 + 1 =


10) i.e. 0 is written in the given column and a carry of 1 over to
the next column.
Binary Subtraction
• Subtraction and Borrow, these two words will be used
very frequently for the binary subtraction. There are four
rules of binary subtraction.
Binary Multiplication
• Binary multiplication is similar to decimal multiplication.
It is simpler than decimal multiplication because only 0s
and 1s are involved.
• There are four rules of binary multiplication.
Binary Division
• Binary division is similar to decimal division. It is called
as the long division procedure.
Use -
• Two's complement number representation is used for signed numbers on
most modern computers.

• This notation allows a computer to add and subtract numbers using the
same operations (thus we do not need to implement adders and subtractors).

• Using the 2’s complement (or 1’s though it’s less often used) means the
CPU is cheaper to build while being as fast (or usually faster) in all cases as
it would otherwise be.

• We can characterize two's complement notation as:

 A fixed number of bits are used to represent numbers


 The most significant bit is called the sign bit
 This same notation is used to represent both positive and negative numbers
Why we are studying 1s and 2s Complement -
• 0’s - false / low / off
• 1’s - true / high / on
• 1 bit may be either 0’s or 1’s. it depends upon the data stored in the memory
device.
• ASCII – Wikipedia – Read it from there.
• Hope you understand the basics

• At the beginning, PROGRAMMERS used a punch card to send instruction.


• After the invention of different I/O (input and output devices), programmers
used ASSEMBLY LANGUAGES to interact with computers.

• And now, Programmers use different programming languages and compilers


to interact with a computer
• PROGRAMMING LANGUAGE -> ASSEMBLY LANGUAGE ->
MACHINE CODE(0’s , 1’s).
Computer Is An Electronic Device
• Which means it is made up of the microprocessor and the
microprocessor is made up of transistors. The basic
operation of the transistor is switching (on and off). In
other words, it is 0’s and 1’s.
Complet
ed

Next Class
Done

Today
Booth's Algorithm
• Booth's algorithm is a multiplication algorithm that
multiplies two signed binary numbers in two's
complement notation.

• The algorithm was invented by Andrew Donald Booth in


1950 while doing research on crystallography at Birkbeck
College in Bloomsbury, London.
Booth's Algorithm
Booth's Algorithm
Booth Algorithm -
• Booth's algorithm can be implemented by repeatedly
adding (with ordinary unsigned binary addition) one of
two predetermined values A and S to a product P, then
performing a rightward arithmetic shift on P.

• Let m and r be the multiplicand and multiplier,


respectively; and let x and y represent the number of bits
in m and r.
1. Determine the values of A and S, and the initial value of P. All of these
numbers should have a length equal to (x + y + 1).
A: Fill the most significant (leftmost) bits with the value of m.
Fill the remaining (y + 1) bits with zeros.
S: Fill the most significant bits with the value of (−m) in two's complement
notation. Fill the remaining (y + 1) bits with zeros.
P: Fill the most significant x bits with zeros. To the right of this, append the
value of r. Fill the least significant (rightmost) bit with a zero.

2. Determine the two least significant (rightmost) bits of P.


If they are 01, find the value of P + A. Ignore any overflow.
If they are 10, find the value of P + S. Ignore any overflow.
If they are 00, do nothing. Use P directly in the next step.
If they are 11, do nothing. Use P directly in the next step.
3. Arithmetically shift the value obtained in the 2nd step by a single place to the
right. Let P
now equal this new value.
4. Repeat steps 2 and 3 until they have been done y times.
5. Drop the least significant (rightmost) bit from P. This is the product of m and r.
Example
• Booth's algorithm follows this old scheme by
performing an addition when it encounters the first digit
of a block of ones (0 1) and a subtraction when it
encounters the end of the block (1 0).

• This works for a negative multiplier as well. When the


ones in a multiplier are grouped into long blocks,
Booth's algorithm performs fewer additions and
subtractions than the normal multiplication algorithm.
Fixed Point and Floating Point Number
Representations
• 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.

• 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.
• There are three parts of a fixed-point number
representation: the sign field, integer field, and fractional
field.
Floating-Point Representation −
• 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.


• The floating point representation is more flexible. Any
non-zero number can be represented in the
normalized form of –

• This is normalized form of a number x .


Example

• Question – Normalize the floating pointing number


−53.5 into binary standards of IEEE.

• Solution. -53.5 =(-110101.1)2


=(-1.101011)x25

which is represented as following below

Where 00000101 is the 8-bit binary value of


exponent value +5.
Converting a Fractional Number into Binary -

• Convert -5.4 to 32 Bit Single Precision IEEE 754 Binary


Floating Point Standard, From a Base 10 Decimal Number .

• Solution –

1. We start with the positive version of the number:


|-5.4| = 5.4

2. First, convert to binary (base 2) the integer part: 5. Divide


the number repeatedly by 2, keeping track of each
remainder, until we get a quotient that is equal to zero:
• division = quotient + remainder;
5 ÷ 2 = 2 + 1;
2 ÷ 2 = 1 + 0;
1 ÷ 2 = 0 + 1;
3. Construct the base 2 representation of the integer part
of the number, by taking all the remainders starting from
the bottom of the list constructed above:
So 5 = 101
4. Convert to binary (base 2) the fractional part: 0.4.
Multiply it repeatedly by 2, keeping track of each integer
part of the results, until we get a fractional part that is equal
to zero:

• multiplying = integer + fractional part;


• 0.4(10) = 0.0110 0110 0110 0110 0110 0110

• 5.4(10) = 101.0110 0110 0110 0110 0110 0110(2)

• 101.0110 0110 0110 0110 0110 0110(2) × 20

• 1.0101 1001 1001 1001 1001 1001 10(2) × 22


• IEEE 754 Binary Floating Point Representation –
• Sign: 1 (a negative number)
• Exponent (unadjusted): 2
• Mantissa (not normalized): 1.0101 1001 1001 1001 1001 1001
10
Done
Next
Class
Thanks !

You might also like