Computer Arithmetic-1
Computer Arithmetic-1
Introduction
Addition and Subtraction
Multiplication Algorithms
Division Algorithms
Floating-point Arithmetic operations
Decimal Arithmetic Unit
Decimal Arithmetic operations
Introduction
• Arithmetic instructions in digital computers manipulate data to produce results
necessary for the solutions 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 problems by means of numerical analysis methods.
• An arithmetic processor is the pat of a processor unit that executes arithmetic
operations.
• An arithmetic instruction may specify binary or decimal data, and in each case
the data may be in fixed-point or floating point form.
• Negative numbers may be in signed magnitude or signed compliment
representation.
• Fixed point numbers may represents integers or fractions.
What is algorithm?
The solution to any problem that is stated by a finite number of well-
defined procedural steps is called an Algorithm.
In this class we develop the various arithmetic algorithms and show the
procedure for implementing them with digital hardware
we consider addition,subtraction,multiplication,and division for the
following types of data:
Fixed point binary data in signed-magnitude representation
Fixed point binary data in signed-2’s compliment representation
Floating point binary data
Binary-coded decimal(BCD) data
Addition and Subtraction
The addition and subtraction algorithm for data represented in signed
magnitude and again data represented in signed-2’s complement.
It is important to realize that the adopted representation for negative
numbers refers to the representation of numbers in the register before
and after the execution of the arithmetic operations.
For A 0 indicates that A<B, for this case it is necessary to take the 2’s
compliment of the value in A .this operation can be done with one micro
operation AĀ+1.
Register configuration
The register configuration for floating point operation is
quite similar to the layout for fixed point operation. As a general rule, the same
register and adder used for fixed point arithmetic are used for processing the
mantissas. The difference lies in the way the exponents are handled.
Register organization
from these equations we see that x=B when M=0. when M=1,the x output
produce the 9’s compliment of B
Decimal Arithmetic operation
The algorithms for arithmetic operations with decimal data are similar to the algorithms
for the corresponding operations with binary data.
Decimal arithmetic micro operation symbols
Addition and Subtraction
References
1. Blaauw, G., digital systems implementation. Englewood cliffs, NJ: prentice
hall, 1996.
2. Cavanagh, J.J.F., Digital computer arithmetic. New York:McGraw-Hill, 1984.