Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Basic Comparator Operation

1
Procedure How to compare two 4-bit numbers
A = A3A2A1A0 and B=B3B2B1B0
1. Compare the most significant bits A3 and B3 of the numbers. If
A3 is a 1 and B3 is a 0, then A is greater than B regardless of
how the remaining bits compare. Similarly, if A3 is a 0 and B3 is
a 1, then B is greater than A. If and only if, A3 and B3 coincide,
then go to step 2.
2. Compare the next significant bits, A2 and B2 of the numbers. If
A2 is a l and B2 is a 0, then A is greater than B regardless of how
the remaining bits compare. Similarly, if A2 is a 0 and B2 is a 1,
then B is greater than A. If and only if, A2 and B2 coincide, then
go to step 3.
3. If A1 is a 1 and B1 is a 0, then A is greater than B regardless of
how the remaining bits compare. If A1 is a 0 and B1 is a 1, then
B is greater than A. If and only if, A1 and B1 coincide, then go to
step 4.
4. If A0 is a 1 and B0 is a 0, then A is greater than B. If A0 is a 0
and B0 is a l, then B is greater than A. If A0 and B0 are equal,
then the numbers A and B are equal
2
Condition for EQUALITY i.e. A=B
™Two binary numbers are equal, if and only if
all their corresponding bits coincide
A3 = B3 ,
A2 = B2,
A1 = B1 and
A=B
A0 = B0

( )( )( )(
Equalty = A 3 ⊕ B3 A 2 ⊕ B2 A1 ⊕ B1 A 0 ⊕ B0 )
3
Logic diagram of an equality Comparator

(A 3
)( )( )(
⊕ B 3 A 2 ⊕ B 2 A 1 ⊕ B1 A 0 ⊕ B 0 )

4
Condition For A>B
1. If A3 = 1 and B3 = 0, A 3
B 3
then A > B. or
2. If A3 and B3 coincide,
and if A2 = 1 and B2 = (A 3
)
⊕ B3 A 2 B2
0, then A > B. or
3. If A3 and B3 coincide,
and if A2 and B2 (A 3
)(
⊕ B3 A 2 ⊕ B2 A1 B1 )
coincide, and if A1 = 1
and B1=0, then A>B. or
4. If A3 and B3 coincide,
and if A2 and B2
coincide, and if A1 and (A 3
)(
⊕ B3 A 2 ⊕ B2 A1 ⊕ B1 A 0 B0)( )
B1 coincide, and if A0=1
and B0= 0, then A > B.
( ) ( )( ) ( )(
A > B = A3B3 + A3 ⊕B3 A2B2 + A3 ⊕B3 A2 ⊕B2 A1B1 + A3 ⊕B3 A2 ⊕B2 A1 ⊕B1 A0B0 )( ) 5
Similarly, the expression for B > A can be written as

( ) ( )( ) ( )( )( )
B > A = A3B3 + A3 ⊕ B3 A2 B2 + A3 ⊕ B3 A2 ⊕ B2 A1B1 + A3 ⊕ B3 A2 ⊕ B2 A1 ⊕ B1 A0 B0

6
B3

B 2

B 1

B 0

A≥B

A3
B 3

B A2
2

A1
B 1

B A0
0
7
Pin Diagram of the 7485 4-bit comparator

8
Cascading two 7485 4-bit comparator to create an
8-bit comparator

9
PARITY BIT GENERATORS/CHECKERS

‰ Binary data, when transmitted and processed, is


susceptible to noise that can alter its 1s to 0s and 0s
to 1s.
‰ To detect such errors, an additional bit called the
parity bit is added to data bits and the word
containing data bits and the Parity bit is transmitted.
‰ At the receiving end the number of 1s in the word
received are counted and the error, if any, is
detected
‰ This parity check, however, detects only single bit
errors.
10
€ A Parity bit of a 0 or a 1 is attached to the data bits
asuch that the total number of 1s in the word is
even for even parity and
aodd for odd parity
€ A given System operates with either even or odd
parity but not both
€ So, a word always contains either an even or an odd
number of 1s.
€ “The modulo sum” of
aan even number of 1s is always a 0 and
aan odd number of 1s is always a 1.

11
Error Detection
9 At the receiving end, if the word received has an
even number of 1s in the odd parity system or an
odd number of 1s in the even Parity system, it
implies that an error has occurred

12
Even Parity generator
•To generate an even parity bit, the four data bits are
added using three X-OR gates

13
Odd Parity generator
•To generate an odd parity bit, the four data bits are
added using three X-OR gates and the sum bit is
inverted

14
Even Parity checker

0
1
0
0
1 1
0
0
1
0
0
1

15
Odd Parity checker

0 0
0 0
1
0
1
1
0 1
0
1

16

You might also like