You are on page 1of 9

Digital Logic & Processors

Session 4
Design concepts of ALU – Logic Unit
Bit-wise operations

 Most computers also support logical operations like


AND, OR and NOT, but extended to multi-bit words
instead of just single bits.
 To apply a logical operation to two words X and Y,
apply the operation on each pair of bits Xi and Yi:

1 0 1 1 1 0 1 1 1 0 1 1
AND 1 1 1 0 OR 1 1 1 0 XOR 1 1 1 0
1 0 1 0 1 1 1 1 0 1 0 1

07/21/2021 3
Logic unit of ALU
 A logic unit supports different logical
functions on two multi-bit inputs X and Y,
producing an output G.
S1 S0 Output M
0 0 G i = X iY i U
X
0 1 Gi = Xi + Yi
1 0 Gi = Xi  Yi
1 1 G i = X i’
 This abbreviated table shows four
possible functions and assigns a
selection code S to each.
 Again, we need one multiplexer for each
bit of X and Y.
07/21/2021 4
ALU Design

07/21/2021 5
Design of Magnitude comparator
 Data comparison is needed in
digital systems while
performing arithmetic or logical
operations.
 This comparison determines
whether one number is greater
than, equal, or less than the
other number.
 A magnitude digital comparator
is a combinational circuit that
compares two digital or binary
numbers (consider A and B)
and determines their relative
magnitudes in order to find out
whether one number is equal,
less than or greater than the
other digital number.
07/21/2021 Source: 6
1-Bit Comparator
 A comparator used to compare two bits, i.e., two numbers each of
single bit is called a single bit comparator. It consists of two inputs for
allowing two single bit numbers and three outputs to generate less
than, equal and greater than comparison outputs.
Truth Table
Input Output
Y Y Y
A B (A=B) (A>B) (A<B)

0 0 1 0 0

0 1 0 0 1

1 0 0 1 0

1 1 1 0 0
07/21/2021 7
1-Bit Comparator Logic Diagram

Logic Equations for Comparator outputs

A  B  AB
A  B  AB  AB  ( AB  AB )
A  B  AB

Logic Diagram

8
2-Bit Comparator
TRUTH TABLE

BLOCK DIAGRAM

07/21/2021 9

You might also like