CH 7updated Unit 6 Computer Arithmetic
CH 7updated Unit 6 Computer Arithmetic
CH 7updated Unit 6 Computer Arithmetic
COMPUTER ARITHMETIC
Magnitude Comparator:
A magnitude digital Comparator is a combinational circuit that compares
two digital or binary numbers in order to find out whether one binary
number is equal, less than, or greater than the other binary number.
The circuit is logically design for which we will have two inputs one for A
and the other for B and have three output terminals, one for A > B
condition, one for A = B condition, and one for A < B condition.
The circuit works by comparing the bits of the two numbers starting from
the most significant bit (MSB) and moving toward the least significant bit
(LSB).
At each bit position, the two corresponding bits of the numbers are
compared.
If the bit in the first number is greater than the corresponding bit in the
second number, the A>B output is set to 1, and the circuit immediately
determines that the first number is greater than the second.
Similarly, if the bit in the second number is greater than the
corresponding bit in the first number, the A<B output is set to 1, and the
circuit immediately determines that the first number is less than the
second.
If the two corresponding bits are equal, the circuit moves to the next bit
position and compares the next pair of bits. This process continues until
all the bits have been compared.
If at any point in the comparison, the circuit determines that the first
number is greater or less than the second number, the comparison is
terminated, and the appropriate output is generated.
If all the bits are equal, the circuit generates an A=B output, indicating
that the two numbers are equal.
A>B: AB'
A<B: A'B
A=B: A'B' + AB
Arithmetic operations:
The four basic arithmetic operations are addition, subtraction,
multiplication and division.
Arithmetic processor is the part of processor to perform arithmetic
operation.
a) When the sign of A and B are identical then add the two magnitudes
and attach the sign of A to the result.
b) When the sign of A and B are different then, compare the
magnitudes and subtract smaller number from larger number.
i) if A> B, Choose sign of A to be sign of result
ii) if A< B, complement the sign of A.
iii) if A=B, subtract B from A and make sign of result positive.
Example1 : perform the addition. (+5 ) + (-3)
Let A = +5
B = -3
Then EA = A+ B’ +1
= 101+ 100 + 1
= 1010
Here , E =1
Since A not equal to 0, Result is in A = 010 and As =0 so, +2
2) Addition and subtraction of two signed 2’s complement numbers.
Example:
Let A =10
B = -5
1) Perform subtraction (A – B)
5 = 0101 in 4 bit
2) Perform A + B
A + B = 1010 + 1011
= 1 0101
V = 1 and Result = 0101
Multiplication Algorithms
Division algorithm
Divide Overflow:
A divide overflow occurs when the result of a division operation exceeds
the representable range for the data type being used. In computer
systems, data types have a finite number of bits to represent values, and
if the result of a division operation cannot be accommodated within
those bits, a divide overflow occurs.
A) Data Type Limits: Each data type in a computer system has a specific
range of representable values. For example, an 8-bit unsigned integer
can represent values from 0 to 255. A 32-bit signed integer has a range
from -2,147,483,648 to 2,147,483,647.
B) Division Operation: When you perform a division operation, the result
may include a quotient and a remainder. The quotient is what you get
when you divide one number by another.