Unit1 - DIgital Logic Circuits
Unit1 - DIgital Logic Circuits
Hardware Memory
ALU
• The hardware of the computer consists of all the electronic components and
electromechanical devices that comprise the physical entity of the device.
• Computer software consists of the instructions and data that the computer manipulates
to perform various data-processing tasks.
• A sequence of instructions for the computer is called a program.
• The data that are manipulated by the program constitute the data base.
COMPUTER SOFTWARE
• System Software: The system software of a computer consists of a collection of programs
whose purpose is to make more effective use of the computer. Ex. OS.
• Application programs: Programs written by the user for the purpose of solving particular
problems. For example, a high level language program written by a user to solve particular
data-processing needs is an application program, but the compiler that translates the high-
level language program to machine language is a system program.
• Hardware: The hardware of the computer is usually divided into three major parts CPU,
Memory and Control unit.
• The central processing unit (CPU) contains an arithmetic and logic unit for manipulating
data, a number of registers for storing data, and control circuits for fetching and executing
instructions.
• The memory of a computer contains storage for instructions and data. It is called a random-
access memory (RAM) because the CPU can access any location in memory at random and
retrieve the binary information within a fixed interval of time.
• The input and output processor (IOP) contains electronic circuits for communicating and
controlling the transfer of information between the computer and the outside world. The
input and output devices connected to the computer include keyboards, printers, terminals,
magnetic disk drives, and other communication devices.
RAM (Random Access Memory)
Four more logic gates are obtained if the output of above-mentioned gates is
negated .
• NAND Gate( )- The NAND gate (negated AND) gives an output of 0 if both inputs are 1,
it gives 1 otherwise. For n-input gate if all inputs are 1 then it gives 0 otherwise 1.
• NOR Gate( )- The NOR gate (negated OR) gives an output of 1 only if both inputs are 0,
it gives 0 otherwise. For n-input gate if all inputs are 0 then it gives 1 otherwise 0.
• XNOR Gate( )- The XNOR gate (negated XOR) gives an output of 1 if both inputs are
same and 0 if they are different. For n-input gate if the number of input 1 are even then
it gives 1 otherwise odd.
• BUFFER Gate( )- The BUFFER gate is the opposite of the NOT gate, as its output is 1 if
its input is 1 and vice-versa.
• Every Logic gate has a graphical representation or symbol associated with it. Below is an
image which shows the graphical symbols and truth tables
Universal Logic Gates – Out of the eight logic gates discussed above, NAND and NOR are also known
as universal gates since they can be used to implement any digital circuit without using any other gate.
This means that every gate can be created by NAND or NOR gates only. Implementation of three basic gates
using NAND and NOR gates is shown below
BOOLEAN ALGEBRA
• Boolean algebra is a switching algebra that deals with binary variables and
logic operations. The variables are designated by letters such as A, B, x, and
y. The three basic logic operations are AND, OR, and complement.
• A Boolean function can be expressed algebraically with binary variables,
the logic operation symbols, parentheses, and equal sign.
• For a given value of the variables, the Boolean function can be either 1 or
0.
• For example, Boolean function F = x + y’z.
• The function F is equal to 1➔ if x is 1 or if both y’ and z are equal to 1, F is
equal to 0 otherwise.
• But saying that y = 1 is equivalent to saying that y’= 0 since y is the
complement of y’. Therefore, we may say that F is equal to 1 if x =1 or if yz
=01.
• The relationship between a function and its binary variables can be
represented in a truth table.
TRUTH TABLE
• To represent a function in a truth table we need a list of the 2^n
combinations of the n binary variables.
• It means if we have three variables(n=3) x, y and z ,there are eight (2^3=8)
possible distinct combinations for assigning bits to these three variables.
X
• The function F is equal to 1 for those combinations where x =1 or yz= 01;
it is equal to 0 for all other combinations. X Y Z F
0 0 0 0
0 0 1 1
X
0 1 0 0
F 0 1 1 0
Y
1 0 0 1
1 0 1
Z
1
1 1 0 1
1 1 1 1
• The purpose of Boolean algebra is to facilitate the analysis and design of digital circuits.
• It provides a convenient tool to:
A Boolean function specified by a truth table can be expressed algebraically in many different ways.
• Two ways of forming Boolean expressions are canonical and non-canonical forms.
• Canonical forms express all binary variables in every product (AND) [SOP] or sum (OR)[POS] term of the Boolean
function.
• To determine the canonical sum-of-products [SOP] form for a Boolean function F (A, B, C) A’B +C’ +ABC, which is in non-
canonical form(Since every term doesn’t contain all variables) the following steps are used:
F = A’B + C’ + ABC
= A’B(1) + (1)(1)C’ + ABC
Since x + x’ = 1 is a basic identity of Boolean algebra, replacing 1 with the missing terms in x + x’ form
F = A’B(C + C’) + (A + A’)(B + B’)C’ + ABC,
F = A’BC + A’BC’ + ABC’ + AB’C’ + A’BC’ + A’B’C’ + ABC
= A’BC + A’BC’ +ABC’ + AB’C + A’B’C’ + ABC
➢ Thus by manipulating a Boolean expression according to Boolean algebra rules, one may obtain a simpler expression that
will require fewer gates.
➢ To do so we need to know about the basic identities of Boolean algebra
IDENTITIES OF BOOLEAN ALGEBRA
1 𝒙+𝟎=𝒙 2 𝒙. 𝟎=0
3 𝑥+1=1 4 𝑥 .1 = 1
5 𝑥+𝑥 =𝑥 6 𝑥. 𝑥=𝑥
7 𝑥 + 𝑥′ = 1 8 𝑥 + 𝑥′ = 0
9 𝑥+𝑦 =𝑦+𝑥 10 𝑥𝑦 = 𝑦𝑥
11 𝑥+ 𝑦+𝑧 = 𝑥+𝑦 +𝑧 12 𝑥 𝑦 𝑧 = 𝑥𝑦 𝑧
13 𝑥 𝑦 + 𝑧 = 𝑥𝑦 + 𝑦𝑧 14 𝑥 + 𝑦𝑧 = (𝑥 + 𝑦)(𝑥 + 𝑧)
′
15 𝑥+𝑦 = 𝑥 ′ 𝑦′ 16 𝑥𝑦 ′
= 𝑥 ′ + 𝑦′
17 𝑥′ ′
=𝑥
Consider the expression AB’ + CD + AB’ + CD, since we know that x + x = x we can replace AB’ + AB’ by simply
AB’ and whole expression can be reduced to AB’ + CD consisting of two terms only instead of initial four.
Identities 15 and 16 are called DeMorgan’s theorems. DeMorgan’s theorem is very important in dealing with
NOR and NAND gates. It states that a NOR gate that performs the F (x + y)’ function is equivalent to the
function x’y’. Similarly, a NAND function can be expressed by either (xy)’ or (x’ + y’).
Universal Gates: NOR and NAND
• NOR and NAND gates have two distinct graphic symbols, as shown
• Instead of representing a NOR gate with an OR graphic symbol followed by a
circle, we can represent it by an AND graphic symbol preceded by circles in all
inputs.
• This invert-AND symbol for the NOR gate follows from DeMorgan’s theorem
and from the convention that small circles denote complementation.
• Similarly, the NAND gate has two distinct symbols, as shown.
• NAND and NOR gates can be used to implement any Boolean function,
including basic logic gates such as AND, OR, and NOT.
• Hence, NAND and NOR gates are called as Universal gates
X X (xyz)’ X (xyz)’
X (x+y+z)’ x’y’z’=(x+y+z)’ Y
Y
Y Y
z z
z z
OR-INVERT INVERT-AND AND- INVERT INVERT-OR
A AND-OR ,
B
CANONICAL [SOP] NAND-NAND
C
IMPLEMENTATION
F A
B F1
F
F= ABC+ABC’+A’C
=AB(C+C’)+A’C
= AB + A’C
C F2
A
B
F = AB + A’C F1= (AB)’=A’+B’, F2= (A’C)’=A+C’
A’ F= F1’+F2’
C
= (A’+B’)’ + (A+C’)’
= AB + A’C
COMPLEMENT OF A FUNCTION
• The complement of a function F when expressed in a truth table is obtained by
interchanging 1’s and 0’s in the values of F in the truth table.
• When the function is expressed in algebraic form, the complement of the
function can be derived by means of DeMorgan’s theorem.
• The general form of DeMorgan’s theorem can be
• (x1 + x2 + x3 + ... xn )’ = x1’ x2’ x3’ ...xn’
• (x1 x2 x3 ...xn )’ = x1’ + x2’ + x3’+ ... +xn’
• From the general DeMorgans theorem we can derive a simple procedure for
obtaining the complement of an algebraic expression.
• This is done by changing all OR operations to AND operations and all AND
operations to OR operations and then complementing each individual letter
variable.
• Example F = AB + C’D’ + B’D
• F (A + B)(C + D)(B + D’)
MAP SIMPLIFICATION
• Two methods of simplifying Boolean algebraic expressions are the map method and
the tabular method.
• The map method is used for functions upto six variables. The map method is also
known as the Karnaugh map or K-map.
• To manipulate functions of a large number of variables, the tabular method also
known as the Quine-McCluskey method, is used.
• If a function to be minimized is not in a canonical form, it must first be converted
into canonical form before applying Quine-McCluskey method.
• Minterms: Each combination of the variables in a truth table is called a minterm.
➢ When expressed in a truth table a function of n variables will have 2^n minterms, equivalent to
the 2^n binary numbers obtained from n bits.
➢A Boolean function is equal to 1 for some minterms and to 0 for others.
➢The information contained in a truth table may be expressed in compact form by listing the
decimal equivalent of those minterms that produce a 1 for the function.
EXAMPLE:
Consider the given truth table, which can be X Y Z F Minterms
• The minterms missing from the list are the ones 1 1 1 1 XYZ
that produce 0 for the function.
K-MAP
• The map is a diagram made up of squares, with each square representing one
minterm.
• The squares corresponding to minterms that produce 1 for the function are marked by
a 1 and the others are marked by a 0 or are left empty.
• By recognizing various patterns and combining squares marked by 1’s in the map, it is
possible to derive alternative algebraic expressions for the function, from which the
most convenient may be selected.
• The maps for functions of two, three, and four variables are shown below
• The number of squares in a map of n variables is 2^n .
• The 2^n minterms are listed by an equivalent decimal number for easy reference.
• B TRUTH TABLE
B 0 1 m A B
A
0 0 0
0 0 1 A B B’ B
1 0 1
A’ A’B’ A’B
1 2 3 2 1 0
A
A AB’ AB 3 1 1
3 VARIABLE K-MAP
4 VARIABLE K-MAP
Solving an Expression Using K-Map
1. Select a K-map according to the total number of variables.
2. Identify maxterms or minterms as given in the problem.
3. For SOP, put the 1’s in the blocks of the K-map with respect to
the minterms (elsewhere 0’s).
4. For POS, putting 0’s in the blocks of the K-map with respect to
the maxterms (elsewhere 1’s).
5. Making rectangular groups that contain the total terms in the
power of two, such as 2,4,8 ..(except 1) and trying to cover as
many numbers of elements as we can in a single group.
6. From the groups that have been created in step 5, find the
product terms and then sum them up for the SOP form.
GROUPING OF MINTERMS
• Groups must contain 1, 2, 4, 8, or in general 2n cells.
• That is if n = 1, a group will contain two 1's since 21 = 2.
• If n = 2, a group will contain four 1's since 22 = 4.
• FOR n=2 (2 Variable K-MAP)
• There is only one Possible grouping of 4 adjacent min terms.
• The possible combinations of grouping 2 adjacent min terms are {(m0,
m1), (m2, m3), (m0, m2) and (m1, m3)}.
• The number of cells in 3 variable K-map is eight, since the number of variables is
three. The following figure shows 3 variable K-Map.
• There is only one possibility of grouping 8 adjacent min terms.
• The possible combinations of grouping 4 adjacent min terms are {(m0, m1, m3, m2),
(m4, m5, m7, m6), (m0, m1, m4, m5), (m1, m3, m5, m7), (m3, m2, m7, m6) and (m2, m0,
m6, m4)}.
• The possible combinations of grouping 2 adjacent min terms are {(m0, m1), (m1, m3),
(m3, m2), (m2, m0), (m4, m5), (m5, m7), (m7, m6), (m6, m4), (m0, m4), (m1, m5), (m3, m7)
and (m2, m6)}.
•If x=0, then 3 variable K-map becomes 2 variable K-map.
The number of cells in 4 variable K-map is sixteen, since the number of variables is four.
The following figure shows 4 variable K-Map.
•There is only one possibility of grouping 16 adjacent min terms.
•Let R1, R2, R3 and R4 represents the min terms of first row, second row, third row and
fourth row respectively. Similarly, C1, C2, C3 and C4 represents the min terms of first
column, second column, third column and fourth column respectively. The possible
combinations of grouping 8 adjacent min terms are {(R1, R2), (R2, R3), (R3, R4), (R4, R1), (C1,
C2), (C2, C3), (C3, C4), (C4, C1)}.
•If w=0, then 4 variable K-map becomes 3 variable K-map.
GROUPING ALLOWED/NOT ALLOWED
•Each group should be as large as possible.
1 1 1 AB [3]
A 2 3
A/B B’ B
Yellow group gives A’(B+B’) = A’
A’ 1 1
Blue group gives B(A’+A) = B
Adding all terms give POS = A’+B
A 0 1
Simplify Functions using K-MAP
1. F = WX’Y’ + WY + W’YZ’ .
YZ Y’Z’ Y’Z YZ YZ’
No. of variables = 4 , K-MAP = 4 variable
A’ 1 x x 1
A 0 x 0 1
1. BD+C’D+B’D’
2. F(A, B, C, D) = B’C’ + D
3. F(A, B, C, D) = AD + B’D + B’C’ + A’D’
4. F(A, B, C) = AB + A’B’
5. F(A, B, C) = A + B’ + C’
6. F(A, B, C) = A + B’
7. F(A, B, C, D) = ACD’ + B’D’
8. F(A, B, C, D) = A’BC’ + A’CD + AC’D + ABC
9. F(W, X, Y, Z) = X ⊕ Z
1 C’D’ C’D CD CD’ 2 C’D’ C’D CD CD’ 3 C’D’ C’D CD CD’ 4 B’C’ B’C BC BC’
A’B’ 1 A’B’ 1 1
A’B 1 1 1 A’B 1 1
AB 1 1 1 AB 1 1
AB’ 1 AB’ 1 1
POS (PRODUCT OF SUM) SIMPLIFICSTION
• The procedure for obtaining a product-of-sums expression follows from
the basic properties of Boolean algebra.
• The 1’s in the map represent the minterms that produce 1 for the
function.
• The squares not marked by 1 represent the minterms that produce 0
for the function.
• If we mark the empty squares with 0’s and combine them into groups
of adjacent squares, we obtain the complement of the function, F.
• Taking the complement of F produces an expression for F in product-
of-sums form.
EXAMPLE: F(A, B, C, D) (0, 1, 2, 5, 8, 9, 10).
POS C’D’ C’D CD CD’ SOP C’D’ C’D CD CD’
A’B’ 1 1 0 1 A’B’ 0
A’B 0 1 0 0 A’B 0 0
AB 0 0 0 0 AB 0 0 0 0
AB’ 1 1 0 1 AB’ 0
A combinational circuit can be described by a truth table showing the binary relationship between the n input
variables and the m output variables.
The truth table lists the corresponding output binary values for each of the 2n input combinations.
A combinational circuit can also be specified with m Boolean functions, one for each output variable. Each
output function is expressed in terms of the n input variables.
The analysis of a combinational circuit starts with a given logic circuit diagram and culminates with a set of
Boolean functions or a truth table.
The design of combinational circuits starts from the verbal outline of the problem and ends in a logic circuit
diagram. The procedure involves the following stepsThe following are the basic steps to design a combinational
circuits
1. Define the problem.
2. Determine the number of input and output variables.
3. Fix a letter symbols to the input and the outputs. (eg. A,B,C ,w, x, Y,F, etc)
4. Get the relationship between input and output from the truth table.
5. By using K-map obtain the simplified Boolean expression for the outputs.
6. Draw the logic diagram using gates.
HALF ADDER
• The most basic digital arithmetic circuit is the addition of two binary digits.
• A combinational circuit that performs the arithmetic addition of two bits is
called a halfadder.
• One that performs the addition of three bits (two significant bits and a
previous carry) is called a full-adder. The name of the former stems from the
fact that two half-adders are needed to implement a full-adder.
• The input variables of a half-adder are called the augend and addend bits.
• The output variables the sum and carry. It is necessary to specify two output
variables because the sum of 1 1 is binary 10, which has two digits.
• We assign symbols x and y to the two input variables, and S (for sum) and C (for
carry) to the two output variables.
• The truth table for the half-adder is shown in Fig. The C output is 0 unless both
inputs are 1. The S output represents the least significant bit of the sum. The
Boolean functions for the two outputs can be obtained directly from the truth
table:
TRUTH TABLE OF HALF ADDER
INPUTS OUTPUTS
Boolean Functions Corresponding To
Output Carry And Sum
X Y S C S = X’Y + XY’ = X ꚚY
C = XY
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
LOGIC DIAGRAM
FULL ADDER
• Full adder is developed to overcome the drawback of Half Adder
circuit. It can add two one-bit numbers A and B, and carry c.
• The full adder is a three input and two output combinational circuit.
• The three inputs of the full adders are augend , addend and the carry
input from the previous addition, the outputs are sum and carry.
TRUTH TABLE:
The eight rows under the input variables designate all possible combinations that the binary variables may
have.
The value of the output variables are determined from the arithmetic sum of the input bits.
When all input bits are 0, the output is 0.
The S output is equal to 1 when only one input is equal to 1 or when all three inputs are equal to 1.
The C output has a carry of 1 if two or three inputs are equal to 1.
INPUTS SUM CARRY
A B C S C
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
BOOLEAN FUNCTION FOR SUM AND CARRY FROM TT
S= A’B’C + A’BC’ + AB’C’+ABC
C= A’BC+AB’C+ABC’ +ABC = (A’B+AB’)C +AB(C+C’) = (A Ꚛ B) C + AB
SIMPLIFYING USING K-MAP
SUM{S} = A’B’C+A’BC’+AB’C’+ABC
= (A’B’ + AB)C + (A’B + AB’)C’
= (A’B+AB’)’C + (A’B+AB’)C’ [(A’B+AB’)’ = (A+B’)(A’+B)= AA’ + AB + B’A’+BB’ = AB+A’B’]
= (AꚚ B)’C + (A Ꚛ B)C’
= AꚚBꚚC
CARRY{C} = BC + AB + AC
FULL ADDER
(Design 1)
FULL ADDER (Design 2 : using Half Adder)
ASSIGNMENT DESIGN A SUBTRACTOR CIRCUIT
(Half Subtractor and Full Subtractor)
Subtractor is the logic circuit which is used to subtract two binary number (digit) and
provides Difference and Borrow as a output. There are two types of subtractor, Half
Subtractor and Full Subtractor. Half subtractor is used to subtract two digits whereas Full
Subtractor is used to subtract three digits.
A clock signal is considered as the square wave. Sometimes, the signal stays at logic, either
high 5V or low 0V, to an equal amount of time. It repeats with a certain time period, which
will be equal to twice the 'ON time' or 'OFF time’.
TYPES OF TRIGGERING
LEVEL EDGE
TRIGGERING TRIGGERING
• Here Q(t +1) = D means that the Q output of the flip-flop receives its value from the D input
every time that the clock signal goes through a transition from 0 to 1
J K FLIP-FLOP
• A JK flip-flop is a refinement of the SR flip-flop. The J input is equivalent to the S (set) input
of the SR flip-flop, and the K input is equivalent to the R (clear) input.
• Inputs J and K behave like inputs S and R to set and clear the flip-flop, respectively.
• The indeterminate condition of the SR type is defined in the JK type means when inputs J
and K are both equal to 1, a clock transition switches the outputs of the flip-flop to their
complement state.
• The graphic symbol and characteristic table of the JK flip-flop are shown in Fig.
J Q J K Q(t+1)
0 0 Q(t)
C
0 0 0
K
1 0 1
1 1 Q(t)’
T FLIP FLOP
• Another type of flip-flop is the T (toggle) flip-flop.
• This flip-flop is obtained from a JK type when inputs J and K are connected to provide a
single input designated by T.
• The T flip-flop therefore has only two conditions.
• When T = 0 ( J = K = 0) a clock transition does not change the state of the flip-flop.
• When T = 1 ( J = K =1) a clock transition complements the state of the flip-flop.
• These conditions can be expressed by a characteristic equation Q(t+1)=Q(t)ꚚT
T Q T Q(t+1)
0 Q(t) No Change
1 Q(t+1)’ Complement
C
MASTER SLAVE FLIP FLOPS
• Another type of flip-flop used in some systems is the master-slave flip-flop.
• This type of circuit consists of two flip-flops.
• The first is the master, which responds to the positive level of the clock, and
the second is the slave, which responds to the negative level of the clock.
• The result is that the output changes during the 1-to-0 transition of the clock
signal.
• The trend is away from the use of master-slave flip-flops and toward edge-
triggered flip-flops.
• Flip-flops available in integrated circuit packages will sometimes provide
special input terminals for setting or clearing the flip-flop asynchronously.
These inputs are usually called “preset” and “clear.”
• They affect the flip-flop on a negative level of the input signal without the
need of a clock pulse.
• These inputs are useful for bringing the flip-flops to an initial state prior to its
clocked operation.