0% found this document useful (0 votes)
5 views

Unit 3

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Unit 3

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 50

Computer Organization and Architecture

UNIT - III
List of Topics
Data Representation: Data types, Complements, Fixed Point
Representation, Floating Point Representation.

Computer Arithmetic: Addition and subtraction, multiplication


Algorithms, Division Algorithms, Floating– point Arithmetic
operations. Decimal Arithmetic unit, Decimal Arithmetic operations.

G.SWARNALATHA,Asst.Professor, GNITC
III Data Representation

CONTENTS
• The digital computer is a digital system that performs various computational tasks.

• The word digital implies that the information in the computer is represented
by variables that take a limited number of discrete values.
• Digital computers use the binary number system, which has two digits: 0
and 1.
• A binary digit is called a bit. Information is represented in digital computers
in groups of bits. Represent binary numbers, discrete symbols - decimal
digits or letters of the alphabet.

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Data Representation

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Data Representation

NUMBER SYSTEM

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Data Representation

Representation of Decimal Systems

• The memory of a computer contains storage for instructions and data.


It is called a random-access memory (RAM)

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Data Representation

Complements
• The input and output devices connected to the computer include
keyboards, printers, terminals, magnetic disk drives, and other
communication devices.

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Data Representation

• Computer organization is concerned with the way the hardware


components operate and the way they are connected together to
form the computer system.

• The various components are assumed to be in place and the task is to


investigate the organizational structure to verify that the computer
parts operate as intended.

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Data Representation

Floating Point Representation

• Computer design is concerned with the determination of what


hardware should be used and how the parts should be connected.

• This aspect of computer hardware is sometimes referred to as


computer implementation.

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Data Representation

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Data Representation
EXAMPLE
• Register Transfer

• Bus and Memory Transfers

• Arithmetic Microoperations

• Logic Microoperations

• Shift Microoperations

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Data Representation

Fixed-point Representation

Positive integers, including zero, can be represented as unsigned numbers.


However, to represent negative integers, we need a notation for negative
values. In ordinary arithmetic, a negative number is indicated by a minus
sign and a positive number by a plus sign. Because of hardware limitations,
computers must represent everything with l’s and 0’s, including the sign of
a number. As a consequence, it is customary to represent the sign with a bit
placed in the leftmost position of the number. The convention is to make
the sign bit equal to 0 for positive and to 1 for negative.
G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Data Representation

Integer Representation
When an integer binary number is positive, the sign is represented by 0 and the magnitude by a positive
binary number. When the number is negative, the sign is represented by 1 but the rest of the number may be
represented in one of three possible ways:

1.Signed-magnitude representation
2.Signed-1’s complement representation
3.Signed 2’s complement representation

As an example, consider the signed number 14 stored in an 8-bit register. +14 is represented by a sign
bit of 0 in the leftmost position followed by the binary equivalent of 14:00001110.

In signed-magnitude representation 1 0001110


In signed-1’s complement representation 1 1110001
In signed-2’s complement representation 1 1110010

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Data Representation

Arithmetic Addition
- Set of registers and their functions

- Microoperations set

Set of allowable microoperations provided by the organization of the computer

- Control signals that initiate the sequence of microoperations (to perform the functions)

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Data Representation

Arithmetic Subtraction

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

Topic 2 : Contents

Addition and subtraction


multiplication Algorithms
Division Algorithms
Floating– point Arithmetic operations
Decimal Arithmetic unit
Decimal Arithmetic operations

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

Computer Arithmetic Introduction

Arithmetic instructions in digital computers manipulate data to produce


results necessary for the solution of computational problems. These
instructions perform arithmetic calculations and are responsible for the
bulk of activity involved in processing data in a computer. The four basic
arithmetic operations are addition, subtraction, multiplication, and
division. From these four basic operations, it is possible to formulate
other arithmetic functions and solve scientific problems by means of
numerical analysis methods.

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

There exists various arithmetic algorithms and we consider addition,


subtraction, multiplication, and division for the following types of
data:

1.Fixed-point binary data in signed-magnitude representation


2.Fixed-point binary data in signed-2’s complement
representation
3.Floating-point binary data
4.Binary-coded decimal (BCD) data

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

Addition and Subtraction

We concentrate on the addition and subtraction


algorithms for data represented in
1.Signed-magnitude.
2.Signed-2’s complement.

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

•Table. Addition and Subtraction of Signed-Magnitude Numbers

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

Figure. Hardware for signed-magnitude addition and subtraction

• This is similar to an “if” statement in a programming language


• In digital systems, this is often done via a control signal, called a control
function
– If the signal is 1, the action takes place
• This is represented as:
P: R2  R1
Which means “if P = 1, then load the contents of register R1 into register R2”, i.e., if

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

Multiplication Algorithms

We concentrate on the multiplication algorithms for data represented in


1. Signed-magnitude.
2. Signed-2’s complement.

Multiplication with Signed-Magnitude Data

Multiplication of two fixed-point binary numbers in signed-magnitude


representation is done with paper and pencil by a process of successive shift and adds
operations. This process is best illustrated with a numerical example.

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

Figure: Hardware for multiply operation

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

Multiplication with Signed-2’s Complement Data

Figure : Hardware for Booth algorithm

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

Division Algorithms
Division of two fixed-point binary numbers in signed-magnitude representation is
done with paper and pencil by a process of successive compare, shift, and subtract
operations. The same is represented in the figure below.

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

Figure: Hardware for division operation

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

EXAMPLE:

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

Floating-point Arithmetic Operations

• A floating-point number in computer registers consists of two parts:


1. A mantissa represented as m
2. An exponent represented as e
• The two parts represent a number obtained from multiplying m times a radix r raised to
the value of e,
can be written as m x re

G.SWARNALATHA,Asst.Professor, GNITC
III Computer Arithmetic
Addition and Subtraction operations

During addition or subtraction, the two floating-point operands are in AC


and BR. The sum or difference is formed in the AC. The algorithm can be
divided into four consecutive parts:
1.Check for zeros.
2.Align the mantissas.
3.Add or subtract the mantissas.
4.Normalize the result.

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

Figure: Addition and subtraction of floating-point numbers

R1  M[MAR]

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

Multiplication operation

The multiplication algorithm can be subdivided into four parts:


1.Check for zeros.
2.Add the exponents.
3.Multiply the mantissas.
4.Normalize the product.

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

Division operation
The division algorithm can be subdivided into five parts:
1.Check for zeros.
2.Initialize registers and evaluate the sign.
3.Align the dividend.
4.Subtract the exponents.
5.Divide the mantissas.

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III MICROOPERATIONS

Decimal Arithmetic Unit


Computers capable of performing decimal
arithmetic must store the decimal data in binary-
coded form. The decimal numbers are then
applied to a decimal arithmetic unit capable of
executing decimal arithmetic microoperations.

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III ARITHMETIC MICROOPERATIONS

Table : Derivation of BCD Adder

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III ARITHMETIC MICROOPERATIONS

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

BCD Subtraction
A straight subtraction of two decimal numbers is by taking
the 9’s or 10’s complement of the subtrahend and adding it to
the minuend. Since the BCD is not a self-complementing code,
the 9’s complement cannot be obtained by complementing
each bit in the code. It must be formed by a circuit that
subtracts each BCD digit from 9.

G.SWARNALATHA,Asst.Professor, GNITC
UNIT-I
III Computer Arithmetic

x1 = B I 1
x2 = B 2
x4 =(B4 XOR B2)
x8 = B I 8 B I 4 B I 2

G.SWARNALATHA,Asst.Professor, GNITC
III Computer Arithmetic

Figure: One stage of a decimal arithmetic unit

G.SWARNALATHA,Asst.Professor, GNITC
III Computer Arithmetic

Decimal Arithmetic Operations


The algorithms for arithmetic operations with decimal data are similar to the
algorithms for the corresponding operations with binary data. In fact, except for a
slight modification in the multiplication and division algorithms, the same flowcharts
can be used for both types of data provided that we interpret the micro-operation
symbols properly. Decimal numbers in BCD are stored in computer registers in groups
of four bits. Each 4-bit group represents a decimal digit and must be taken as a unit
when performing decimal micro-operations.

G.SWARNALATHA,Asst.Professor, GNITC
III Computer Arithmetic
Decimal arithmetic microoperation symbols

G.SWARNALATHA,Asst.Professor, GNITC
III Computer Arithmetic

Three ways of adding Decimal Number

G.SWARNALATHA,Asst.Professor, GNITC
III Computer Arithmetic

MULTIPLICATION
Registers for arithmetic multiplication and division

G.SWARNALATHA,Asst.Professor, GNITC
III Computer Arithmetic

Flow chart for Decimal Multiplication

G.SWARNALATHA,Asst.Professor, GNITC
III Computer Arithmetic

Division
Floe chart for Decimal Division

G.SWARNALATHA,Asst.Professor, GNITC
III Computer Arithmetic

The partial remainder and the quotient bits are


shifted once to the left and the process is repeated k
times to form k quotient digits.

The remainder is then found in register A and the


quotient is in register Q. The value of E is neglected.

G.SWARNALATHA,Asst.Professor, GNITC

You might also like