Unit-3.2 Coa
Unit-3.2 Coa
Unit-3.2 Coa
A message of 3 bits and 2 possible parity bits is shown in the below Table.
The P(odd) bit is chosen to make the sum of 1's (in all four bits) odd .
The P(even) bit is chosen to make the sum of all 1's even. In either case, the sum is taken
over the message and the P bit.
Disadvantage (even-parity): It is having a bit combination of all 0's, while in the odd
parity there is always one bit (of the four bits that constitute the message and P) that is 1.
During transfer of information from one location to another, the parity bit is handled as follows.
Parity Generator:
At the sending end, the message (in our case 3-bits) is applied to a parity generator, where
the required parity bit is generated. The message, including the parity bit, is transmitted to
its destination.
Parity Checker:
At the receiving end, all the incoming bits (in our case, 4-bits) are applied to a parity
checker that checks the proper parity adopted (odd or even). An error is detected if the
checked parity does not conform to the adopted parity.
Parity generator and checker networks are logic circuits constructed with exclusive-OR functions.
EX: consider a 3-bit message to be transmitted with an odd parity bit. At the sending end, the
odd parity bit is generated by a parity generator circuit.
The message and the odd-parity bit are transmitted to their destination where they are
applied to a parity checker. An error has occurred during transmission if the parity of the
four bits received is even, since the binary information transmitted was originally odd.
Computer Aritnmetic:
Introduction:
The two algorithms are similar except for the sign comparison. The procedure to be followed for
identical signs in the addition algorithm is the same as for different signs in the subtraction
algorithm, and vice versa.
The below figure shows a block diagram of the hardware for implementing the addition and
subtraction operations. It consists of registers A and B and sign flip-flops AS and BS.
o Subtraction is done by adding A to the 2' s complement of B. The output carry is
transferred to flip-flop E, where it can be checked to determine the relative magnitudes of
the two numbers.
o The add-overflow flip-flop AVF holds the overflow bit when A and B are added.
Figure (i): Hardware for addition and subtraction with Signed-Magnitude Data
The complementer provides an output of B or the complement of B depending on the state of the
mode control M.
When M = 0, the output of B is transferred to the adder, the input carry is 0, and the output
of the adder is equal to the sum A + B.
When M= 1, the l's complement of B is applied to the adder, the input carry is 1, and output
This is equal to A plus the 2's complement of B, which is
equivalent to the subtraction A - B.
Multiplication Algorithms:
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.
Hardware Algorithm:
Initially, the multiplicand is in B and the multiplier in Q. Their corresponding signs are in Bs
and Qs, respectively. The signs are compared, and both A and Q are set to correspond to the sign
of the product since a double-length product will be stored in registers A and Q. Registers A and E
are cleared and the sequence counter SC is set to a number equal to the number of bits of the
multiplier.
After the initialization, the low-order bit of the multiplier in Qn is tested.
i. If it is 1, the multiplicand in B is added to the present partial product in A .
ii. If it is 0 , nothing is done. Register EAQ is then shifted once to the right to form the
new partial product.
The sequence counter is decremented by 1 and its new value checked. If it is not equal to zero,
the process is repeated and a new partial product is formed. The process stops when SC = 0.
The final product is available in both A and Q, with A holding the most significant bits and Q
holding the least significant bits.
A flowchart of the hardware multiply algorithm is shown in the below figure (l).
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 division process is illustrated by a numerical example in the below figure (q).
The divisor B consists of five bits and the dividend A consists of ten bits. The five most
significant bits of the dividend are compared with the divisor. Since the 5-bit number is
smaller than B, we try again by taking the sixth most significant bits of A and compare this
number with B. The 6-bit number is greater than B, so we place a 1 for the quotient bit. The
divisor is then shifted once to the right and subtracted from the dividend.
The difference is called a partial remainder because the division could have stopped here
to obtain a quotient of 1 and a remainder equal to the partial remainder. The process is
continued by comparing a partial remainder with the divisor.
• If the partial remainder is greater than or equal to the divisor, the quotient bit is equal to 1.
The divisor is then shifted right and subtracted from the partial remainder.
• If the partial remainder is smaller than the divisor, the quotient bit is 0 and no subtraction is
needed. The divisor is shifted once to the right in any case. Note that the result gives both a
quotient and a remainder.
The sign of the quotient is determined from the signs of the dividend and the divisor. If the two
signs are alike, the sign o f the quotient is plus. If they are unalike, the sign is minus. The sign of
the remainder is the same as the sign of the dividend.
Divide Overflow
The division operation may result in a quotient with an overflow. This is not a problem
when working with paper and pencil but is critical when the operation is implemented with
hardware. This is because the length of registers is finite and will not hold a number that
exceeds the standard length.
To see this, consider a system that has 5-bit registers. We use one register to hold the
divisor and two registers to hold the dividend. From the example shown in the above, we
note that the quotient will consist of six bits if the five most significant bits of the dividend
constitute a number greater than the divisor. The quotient is to be stored in a standard 5-bit
register, so the overflow bit will require one more flip-flop for storing the sixth bit.
This divide-overflow condition must be avoided in normal computer operations because
the entire quotient will be too long for transfer into a memory unit that has words of
standard length, that is, the same as the length of registers.
This condition detection must be included in either the hardware or the software of the
computer, or in a combination of the two.
1. The dividend is in A and Q and the divisor in B . The sign of the result is
transferred into Qs to be part of the quotient. A constant is set into the sequence counter SC to
specify the number of bits in the quotient.
3. The division of the magnitudes starts by shifting the dividend in AQ to the left with
the high-order bit shifted into E. If the bit shifted into E is 1, we know that EA > B because EA
consists of a 1 followed by n-1 bits while B consists of only n -1 bits. In this case, B must be
subtracted from EA and 1 inserted into Qn for the quotient bit.
4. If the shift-left operation inserts a 0 into E, the divisor is subtracted by adding its 2's
complement value and the carry is transferred into E . If E = 1, it signifies that A ≥ B;
therefore, Qn is set to 1 . If E = 0, it signifies that A < B and the original number is restored by
adding B to A . In the latter case we leave a 0 in Qn.
This process is repeated again with registers EAQ. After n times, the quotient is
formed in register Q and the remainder is found in register A