Digital Logic& Design Book
Digital Logic& Design Book
Prepared by
Prof. Safwat Ahmed Aly
2023
Chapter (1)
Logic Gates
Introduction
Gates
A gate is represented by an electronic circuit which operates
on one or more input signals to perform the logic operation
and produce an output signal. Some types of gates like OR,
AND, NOT, NOR, NAND gates. All gates have a block diagram
symbol.
The lines connected to each symbol are the inputs on the left
and the output on the right of it.
Truth table
A truth table is a two-dimensional array where there is
one column for each input and one column for each output (a
circuit may have more than one output). Since we are
dealing with binary values, each input can be either 0 or
1.The number of truth table possibilities are 2n where n is
the number of input variable. For example, if n=2 the
number of possibilities are 22=4.
The values in the output column are determined from
applying the corresponding input values to the functional
operator. For example, in the following truth table:
2
X Y F=(X.Y)
0 0 0
0 1 0
1 0 0
1 1 1
Logic gates have one or more inputs and only one output. The
output is active only for certain input combinations. Logic gates are the
building blocks of any digital circuit. Logic gates are also called switches.
With the advent of integrated circuits, switches have been replaced by
TTL (Transistor Transistor Logic) circuits.
Gates Types
AND OR
NOT NAND
NOR BUF
XOR XNOR
AND Gate
The AND gate performs logical multiplication, commonly known as
AND function. The AND gate has two or more inputs and single output.
The output of AND gate is HIGH only when all its inputs are HIGH (i.e.
even if one input is LOW, Output will be LOW). The AND-gate is a
device whose output is logic (1) if both of the inputs are logic (1). It
performs logical multiplication. It composed of two or more inputs
3
and single output. The logical AND function of two variables is
represented either by writing dot between the two variables or by
writing the adjacent letters without dot. For example, X . Y = Z or XY =
Z is read "X AND Y is equal to Z". This AND gate symbol and its
truth table are shown in figure below respectively, with two inputs
marked A and B and one output marked X.
4
Truth Table
X Y Z F=X.Y.Z
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
OR Gate
The OR gate performs logical addition, commonly known as OR
function. The OR gate has two or more inputs and single output. The
output of OR gate is HIGH only when any one of its inputs are HIGH
(i.e. even if one input is HIGH, Output will be HIGH).
If A and B are two inputs, then output X can be represented
mathematically asX = A+B. Here plus sign (+) denotes the OR operation.
Truth table and symbol of the OR gate is shown in the figure below.
5
symbol.
Truth Table
X Y Z F=X+Y+Z
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
NOT Gate
The NOT gate performs the basic logical function called inversion or
complementation. NOT gate is also called inverter. The purpose of this
gate is to convert one logic level into the opposite logic level. It has one
input and one output. When a HIGH level is applied to an inverter, a
LOW level appears on its output and vice versa.
If A is the input, then output X can be represented mathematically
as X= Ā, (-) denotes the NOT (inversion) operation. Truth table and
NOT gate symbol is shown in the figure below.
Symbol
6
NAND Gate
NAND gate is a cascade of AND gate and NOT gate, as shown in the
figure below. It has two or more inputs and only one output. The output
of NAND gate is HIGH when any one of its input is LOW (i.e. even if
one input is LOW, Output will be HIGH).
Truth Table
A B F=(A.B)'
0 0 1
0 1 1
1 0 1
1 1 0
7
NOR Gate (inverter)
The NOR gate (NOT–OR) is equivalent of an inverted OR function and
will yield a low output (0) if either or both inputs are high (1).
Symbolically the NOR gate is represented by the OR gate symbol
followed by a bubble to represent the complemented output signal.
The NOR gate is a universal building block of a digital logic
because it may be used to implement any logic function. The truth table
and NOR gate can be represented by the symbol shown in fig below.
From the three basic logic gates (AND, OR, and NOT gates), the most
powerful computer circuit can be made. Furthermore, these basic
gates are built using transistors, the fundamental building blocks for
all digital logic circuits. Transistors are just electronic binary
switches that can be turned on or off. The on and off states of
transistors are used to represent the two binary values 1 and 0.
8
exclusively, and LOW when both are 1 or 0 simultaneously. In general,
an XOR gate gives an output value of 1 when there are an odd number of
1's on the inputs to the gate.
If X and Y are two inputs, then output F can be represented
mathematically as F = X Y, Here denotes the XOR operation. X Y
and is equivalent to X.Y' + X'.Y. Truth table and symbol of the XOR gate
is shown in the figure below.
XOR From Simple gates
Symbol
Truth Table
X Y F=(X Y)
0 0 0
0 1 1
1 0 1
1 1 0
9
Example
Draw the truth table for a three –input XOR gate with input A , B, and C.
For a 3-input XOR gate with inputs , and the truth table is given
by
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
01
Symbol
Truth Table
X Y F=(X Y)'
0 0 1
0 1 0
1 0 0
1 1 1
Example
Draw the truth table for a three –input XOR gate with input A, B, and C?
For a 3-input XNOR gate with inputs , and the truth table is
given by
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 0
00
Example: Prove that
Solution
Example :
02
Question
What would the output pulse train at the output, Y, look like if the input
at C is always 1?
Answer
The gate in the circuit is a NAND gate and so gives 0 at the output when
all the inputs are 1 and gives 1 at the output otherwise. Therefore the
output will be:
a=0;b=1;c=1;d=0;e=1;f=0;g=1
Precedence of operations
Thus in the expression AB+A‟B‟, the variables in the second term are
complemented before being ANDed together. That term is then ORed
with the ANDed combination of A and B (the AB term)
03
– f(a,b,c)=a‟b+c
Problem
Draw the logical diagrams for the following Boolean expressions:
(a) Y=A‟B‟+B(A+C).
(b) Y=BC+AC‟.
04
(c) Y=A+CD.
(d) Y=(A+B)(C‟+D).
Universal Gates
Universal gates are the ones which can be used for implementing any gate
like AND, OR and NOT, or any combination of these basic gates; NAND
and NOR gates are universal gates. But there are some rules that need to
be followed when implementing NAND or NOR based gates.
To facilitate the conversion to NAND and NOR logic, we have two new
graphic symbols for these gates.
NAND Gate
NOR Gate
05
Realization of logic function using NAND gates
Any logic function can be implemented using NAND gates. To achieve
this, first the logic function has to be written in Sum of Product (SOP)
form. Once logic function is converted to SOP, then is very easy to
implement using NAND gate. In other words any logic circuit with AND
gates in first level and OR gates in second level can be converted into a
NAND-NAND gate circuit.
Consider the following SOP expression
F = W.X.Y + X.Y.Z + Y.Z.W
The above expression can be implemented with three AND gates in first
stage and one OR gate in second stage as shown in figure.
If bubbles are introduced at AND gates output and OR gates inputs (the
same for NOR gates), the above circuit becomes as shown in figure.
06
Now replace OR gate with input bubble with the NAND gate. Now we
have circuit which is fully implemented with just NAND gates.
07
Implementing an Inverter Using only NAND Gate
The figure shows two ways in which a NAND gate can be used as an
inverter (NOT gate).
1. All NAND input pins connect to the input signal A gives an output A'.
2. One NAND input pin is connected to the input signal A while all other
input pins are connected to logic 1. The output will be A'.
08
If bubble are introduced at the output of the OR gates and the inputs of
AND gate, the above circuit becomes as shown in figure.
Now replace AND gate with input bubble with the NOR gate. Now we
have circuit which is fully implemented with just NOR gates.
09
Implementing an Inverter Using only NOR Gate
The figure shows two ways in which a NOR gate can be used as an
inverter (NOT gate).
2. One NOR input pin is connected to the input signal A while all other
input pins are connected to logic 0. The output will be A'.
Equivalent Gates:
The shown figure summarizes important cases of gate equivalence. Note
that bubbles indicate a complement operation (inverter).
21
3- NOR gate is equivalent to an inverted-input AND gate.
5- Two NOT gates in series are same as a buffer because they cancel each
other as A‟‟ = A.
We will show that SOP forms can be implemented using only NAND
gates, while POS forms can be implemented using only NOR gates. This
is best explained through examples.
Example 1
Implement the following SOP function using NAND gates only
F = XZ + Y’Z + X’YZ
Solution
20
By associating one of the inverters with the output of the first level AND
gate and the other with the input of the OR gate, it is clear that this
implementation is reducible to 2-level implementation where both levels
are NAND gates as shown in the figure.
22
Example 2
Implement the following POS function using NOR gates only
F = (X+Z) (Y’+Z) (X’+Y+Z)
Solution
By associating one of the inverters with the output of the first level
OR gates and the other with the input of the AND gate, it is clear that this
implementation is reducible to 2-level implementation where both levels
are NOR gates as shown in Figure.
23
Problems
1. Derive the truth table and draw the logic circuits which correspond to
the following expressions:
a) F= A'BC' + A'BC + AB'
b) F= XY'Z + X'Y'Z + XYZ
C) F= (A.B)' + (A'.B)
d) F= (A.B)'.(A'+B)
e) F= (A+B').(A+B)'
f) F= (A.B)'.(A'+B)+B'
g) F= AB + A'B' + A'B
h) F= A'BC+ A'BC' +AB'
k) F= XY'(Z+Y') + X'Z
l) F= [A(B+C') + A'B]C
(b)
24
(c )
(d)
(e)
25
Chapter (2)
Boolean Algebra
The most obvious way to simplify Boolean expressions is to
manipulate them in the same way as normal algebraic expressions are
manipulated. With regards to logic relations in digital forms, a set of rules
for symbolic manipulation is needed in order to solve for the unknowns.
A set of rules formulated by the English mathematician George
Boole describe certain propositions whose outcome would be either true
or false. With regard to digital logic, these rules are used to describe
circuits whose state can be either, 1 (true) or 0 (false). In order to fully
understand this, the relation between the AND gate, OR gate and NOT
gate operations should be appreciated. Boolean algebra: based on a set of
rules derived from a small number of basic assumptions i.e. Boolean
Postulates (axioms).
Boolean Postulates:
P1: X = 0 or X = 1
P2: 0.0=0
P3: 1+1=1
P4: 0+0=0
P5: 1.1=1
P6: 1.0=0.1=0
P7: 1+0=0+1=1
Laws of Boolean Algebra
• 1a 0·0=0
• 1b 1+1=1
• 2a 1·1=1
26
• 2b 0+0=0
• 3a 0·1=1·0=0
• 3b 1+0=0+1=1
• 4a If x=0 then x' =1
• 4b If x=1 then x'=0
Single-Variable theorems
• From the axioms are derived some rules for dealing with single
variables
• 5a x·0=0
• 5b x+1=1
• 6a x·1=x
• 6b x+0=x
• 7a x·x=x
• 7b x+x=x
• 8a x·x'=0
• 8b x+x'=1
• 9 x''=x
• Single-variable theorems can be proven by perfect induction. Substitute
the values x=0 and x=1 into the expressions and verify using the basic
axioms
Two & three variable properties
• 10a. x·y=y·x Commutative
• 10b. x+y=y+x
• 11a. x·(y·z)=(x·y)·z Associative
• 11b. x+(y+z)=(x+y)+z
• 12a. x·(y+z)=x·y+x·z Distributive
• 12b. x+y·z=(x+y)·(x+z)
27
• 13a. x+x·y=x Absorption
• 13b. x·(x+y)=x edundance Law
• 14a. x·y+x·y‟=x Combining
• 14b. (x+y)·(x+y')=x
• 15a. (x·y)‟=x‟+y' DeMorgan‟s
• 15b. (x+y)'=x‟·y' Theorem
• 16a. x+x'‟·y=x+y
• 16b. x·(x'+y)=x·y
Consensus theorem
Note that every law has two expressions, (a) and (b). This is known as
duality. These are obtained by changing every AND(.) to OR(+), every
OR(+) to AND(.) and all 1's to 0's and vice-versa.
Prove (xy)'=x'+y' (DeMorgan’s Theorem)
X y xy (xy)' X' Y' X'+y'
0 0 0 1 1 1 1
0 1 0 1 1 0 1
1 0 0 1 0 1 1
1 1 1 0 0 0 0
28
Then x+x'·y equivalent x+y
Algebraically:
x+x'·y = x.1 + x'·y ( using 6a )
= x( 1+y) + x'·y ( using 5b )
=x +xy + x'·y
= x + y(x + x' ) ( using 8b )
= x+y
Proof (algebraic manipulation)
• Prove
– (X+A)(X‟+A)(A+C)(A+D)X = AX
– (X+A)(X‟+A)(A+C)(A+D)X
– (X+A)(X‟+A)(A+CD)X (using 12b)
– (X+A)(X‟+A)(A+CD)X
– (A)(A+CD)X (using 14b)
– (A)(A+CD)X
– AX (using 13b)
Duality
• Axioms and single-variable theorems are expressed in pairs – Reflects
the importance of duality
• Given any logic expression, its dual is formed by replacing all + with ·,
and vice versa and replacing all 0s with 1s and vice versa
– f(a,b)=a+b dual of f(a,b)=a·b
– f(x)=x+0 dual of f(x)=x·1
• The dual of any true statement is also true
Duality principle:
• States that a Boolean equation remains valid if we take the dual of the
expressions on both sides of the equals sign.
• The dual can be found by interchanging the AND and OR operators
29
along with also interchanging the 0‟s and 1‟s.
• This is evident with the duals in the basic identities.
• For instance: DeMorgan‟s Law can be expressed in two forms
Inversion of a function
• If a function is defined as
– f(x1, x2)= x1+ x2
• Then the complement of f is
– f(x1, x2)= x1+ x2 = (x1+ x2)‟
• Similarily, if
– f(x1, x2)= x1 · x2
• Then the complement of f is
- f(x1, x2)= x1 · x2= (x1 · x2)‟
31
Problem:
Reduce the following Boolean expressions to the less number of literals:
(a) A‟C‟ + ABC + AC‟
(b) (x‟y‟+z)‟ + z + xy + wz
(c) A‟B(D‟+C‟D) + B(A+A‟CD)
(d) (A‟+C)(A‟+C‟)(A+B+C‟D)
30
Solution:
(a) A‟C‟ + ABC + AC‟=
= A‟C‟ + AC‟ + ABC
= C‟(A‟+ A) + ABC
= C‟∙1 + ABC
= C‟ + ABC
= (C‟+ AB)(C‟+C) [distributive]
= AB + C‟
(b) (x‟y‟+z)‟ + z + xy + wz
= (x‟y‟+z)‟ + z + wz + xy
= (x‟y‟+z)‟ + z(1+ w) + xy
= (x‟y‟+z)‟ + z + xy
= (x + y)z‟ + z + xy [DeMorgan]
= (z + (x + y)) ∙ (z + z‟) + xy [distributive]
= (z + (x + y)) ∙ 1 + xy
= x + y + z + xy
=x+y+z [absorption]
32
(d) (A‟+C)(A‟+C‟)(A+B+C‟D)
= (A‟+C)(A‟+C‟)(A+B+C‟D)
= (A‟ + CC‟)(A + B + C‟D)
= A‟(A + B + C‟D)
= A‟A + A‟B + A‟C‟D
= A‟B + A‟C‟D = A‟(B + C‟D)
Canonical Forms
The functionality of any logic circuit can be expressed in one of
two alternative and equivalent canonical forms. These canonical
forms consist of a Boolean algebraic expression. They are
generally developed from a truth table.
33
The maxterm form
Known as the second canonical form, this a pure AND
combination of maxterms (M) where a maxterm is an OR
function that includes each variable once in its normal or
complemented form. The second canonical form is also known
as the product of sums (POS). The Product of Sums form
represents an expression as a product of maxterms.
F(X, Y, .......) = π M( )
To derive the Product of Sums form from a truth table, AND
together all of the maxterms which give a value of 0.
The construction of these forms is best illustrated by the examples below.
X Y Z F minterm Designation
0 0 0 1 X'.Y'.Z' mo
0 0 1 0 X'.Y'.Z m1
0 1 0 0 X'.Y.Z' m2
0 1 1 1 X'.Y.Z m3
1 0 0 0 X.Y'.Z' m4
1 0 1 0 X.Y'.Z m5
1 1 0 0 X.Y.Z' m6
1 1 1 0 X.Y.Z m7
34
The first canonical form is developed from the output 1's in the truth
table. As can be seen, F is only 1 for the 1st and 4th rows of the truth
table. Therefore the minterm (AND function) expressions for these two
rows are formed and OR-ed together to give the minterm form for the
circuit as
35
X Y Z F Maxterm Designation
0 0 0 0 X+Y+Z Mo
0 0 1 1 X+Y+Z' M1
0 1 0 1 X+Y'+Z M2
0 1 1 0 X+Y'+Z' M3
1 0 0 1 X'+Y+Z M4
1 0 1 1 X'+Y+Z' M5
1 1 0 1 X'+Y'+Z M6
1 1 1 1 X'+Y'+Z' M7
The second canonical form is developed from the output 0's in the
truth table. As can be seen, F is only 0 for the 1st and 4th rows of the
truth table. Developing the maxterm expression here is slightly more
complicated and there are two approaches.
In the first approach we first develop the minterm expression for
the output 0's (not 1's) in the truth table. For the truth table above this will
be given by
F' = (X.Y.Z) +(X.Y'.Z')
Then it is necessary to apply the rules of Boolean algebra for converting
minterm expressions to maxterm expressions as is described in the
Boolean Algebra. This leads to the final maxterm form for this truth table
of
F =( X+Y+Z) . (X+Y'+Z')
F= M1 .M4 = π ( 0,3 )
The second approach allows the maxterm form to be derived directly
from the output 0's in the truth table using the following rules.
Take each line in the truth table where the output is 0 and
Invert the variables (e.g. if X is 1 then write X' etc.)
OR these variables together to form the maxterm
36
build the second canonical form from the AND of these maxterms
In the case of the truth table above it is possible to go directly to the final
maxterm form using this approach.
Summary to minters and maxterms
Use the ones of the function to determine minters and zeros of the
function to determine maxterms form.
Minters and maxterms
X Y F(X,Y)
0 0 0
0 1 1
1 0 1
1 1 0
SOP
F(X,Y) = X'.Y'+ X.Y'
= Σ m (1,2).
POS
(i) F'(X,Y) = X'.Y' + X.Y
(ii) F(X,Y) = (X'.Y' + X.Y)'
= (X+Y) . (X'+Y')
= π M (0,3 ) = M0 +M3
= π ( 0,3 )
Problem
Convert the following to the other canonical form:
(a) F (x, y , z) = ∑ (1,3,7)
(b) F(A,B,C,D)= ∏ (0,1,2,3,4,6,12)
Solution:
(a) F (x, y, z) = ∑ (1,3,7) = ∏ (0,2,4,5,6)
F (x, y, z) =
37
( x y z) ( x y z) ( x y z) ( x y z) ( x y z)
+ +
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
38
This table can be simplified by writing
+ +
0 0 0 0
1 x x 1
x 1 x 1
x x 1 1
Karnaugh Maps
Karnaugh maps provide a systematic method to obtain simplified
sum-of-products (SOPs) Boolean expressions. This is a compact way of
representing a truth table and is a technique that is used to simplify logic
expressions. It is ideally suited for four or less variables, becoming
cumbersome for five or more variables. Each square represents either a
minterm or maxterm. A K-map of n variables will have 2 squares. For a
Boolean expression, product terms are denoted by 1's, while sum terms
are denoted by 0's - but 0's are often left blank.
A K-map consists of a grid of squares, each square representing
one canonical minterm combination of the variables or their inverse. The
map is arranged so that squares representing minterms which differ by
only one variable are adjacent both vertically and horizontally. Therefore
39
XY'Z' would be adjacent to X'Y'Z' and would also adjacent to XY'Z and
XYZ'.
Rule-1:
We can either group 0‟s with 0‟s or 1‟s with 1‟s but we can not
group 0‟s and 1‟s together.
X representing don‟t care can be grouped with 0‟s as well as 1‟s
Rule-2:
Rule-3:
41
Example-
Rule-4:
Rule-5:
40
Example-
Rule-6:
Example-
Rule-7:
42
Minimization Technique
Based on the Unifying Theorem: X + X' = 1
The expression to be minimized should generally be in sum-of-
product form (If necessary, the conversion process is applied to
create the sum-of-product form).
The function is mapped onto the K-map by marking a 1 in those
squares corresponding to the terms in the expression to be
simplified (The other squares may be filled with 0's).
Pairs of 1's on the map which are adjacent are combined using the
theorem Y(X+X') = Y where Y is any Boolean expression (If two
pairs are also adjacent, then these can also be combined using the
same theorem).
The minimization procedure consists of recognizing those pairs
and multiple pairs.
->These are circled indicating reduced terms.
o Groups which can be circled are those which have two (2 1)
1's, four (22) 1's, eight (23) 1's, and so on.
->Note that because squares on one edge of the map are considered
adjacent to those on the opposite edge, group can be formed with
these squares.
->Groups are allowed to overlap.
The objective is to cover all the 1's on the map in the fewest
number of groups and to create the largest groups to do this.
Once all possible groups have been formed, the corresponding
terms are identified.
->A group of two 1's eliminates one variable from the original
minterm.
->A group of four 1's eliminates two variables from the original
minterm.
43
->A group of eight 1's eliminates three variables from the original
minterm, and so on.
The variables eliminated are those which are different in the
original minterms of the group.
2-Variable K-Map
In any K-Map, each square represents a minterm. Adjacent squares
always differ by just one literal (So that the unifying theorem may apply:
X + X' = 1). For the 2-variable case (e.g.: variables X, Y), the map can be
drawn as below. Two variable map is the one which has got only two
variables as input.
Equivalent labeling
K-map needs not follow the ordering as shown in the figure above. What
this means is that we can change the position of m0, m1, m2, m3 of the
above figure as shown in the two figures below.
Position assignment is the same as the default k-maps positions.
This is the one which we will be using throughout this tutorial.
44
This figure is with changed position of m0, m1, m2, m3.
45
Example- Carry and Sum of a half adder
In this example we have the truth table as input, and we have two output
functions. Generally we may have n output functions for m input
variables. Since we have two output functions, we need to draw two k-
maps (i.e. one for each function). Truth table of 1 bit adder is shown
below. Draw the k-map for Carry and Sum as shown below.
x y Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Grouping/Circling K-maps
The power of K-maps is in minimizing the terms, K-maps can be
minimized with the help of grouping the terms to form single terms.
When forming groups of squares, observe/consider the following:
Every square containing 1 must be considered at least once.
46
A square containing 1 can be included in as many groups as
desired.
A group must be as large as possible.
If a square containing 1 cannot be placed in a group, then leave it
out to include in final expression.
The number of squares in a group must be equal to 2, , i.e. 2,4,8,.
The map is considered to be folded or spherical, therefore squares
at the end of a row or column are treated as adjacent squares.
The simplified logic expression obtained from a K-map is not
always unique. Groupings can be made in different ways.
Before drawing a K-map the logic expression must be in canonical
form.
47
In the next few pages we will see some examples on grouping.
Example of invalid groups
Example - X'Y+XY
In this example we have the equation as input, and we have one output
function. Draw the k-map for function F with marking 1 for X'Y and
XY position. Now combine two 1's as shown in figure to form the
single term. As you can see X and X' get canceled and only Y
remains.
F=Y
Example - X'Y+XY+XY'
In this example we have the equation as input, and we have one output
function. Draw the k-map for function F with marking 1 for X'Y, XY
and XY position. Now combine two 1's as shown in figure to form the
two single terms.
F=X+Y
48
3-Variable K-Map
There are 8 minterms for 3 variables (X, Y, Z). Therefore, there are 8
cells in a 3-variable K-map. One important thing to note is that K-
maps follow the gray code sequence, not the binary one.
49
There is wrap-around in the K-map
X'Y'Z' (m0) is adjacent to X'YZ' (m2)
XY'Z' (m4) is adjacent to XYZ' (m6)
51
Examples of three–variable
50
Example
F = XYZ'+XYZ+X'YZ
F = XY + YZ
Example
F(X,Y,Z) = (1,3,4,5,6,7)
52
F=X+Z
4-Variable K-Map
There are 16 cells in a 4-variable (W, X, Y, Z); K-map as shown in the
figure below.
There are 2 wrap-around: horizontal and vertical. Every cell thus has 4
neighbours. For example, the cell corresponding to minterm m0 has
neighbors m1, m2, m4 and m8.
53
Example
F(W,X,Y,Z) = (1,5,12,13)
F = WY'Z + W'Y'Z
Example
F(W,X,Y,Z) = (4, 5, 10, 11, 14, 15)
54
F = W'XY' + WY
Examples of four–variable
1-Minimize the following boolean function-
F(A, B, C, D) = Σm(0, 1, 2, 5, 7, 8, 9, 10, 13, 15)
Solution-
Then, we have-
55
F(A, B, C, D) =BD + C‟D + B‟D‟
2-Minimize the following boolean function-
Solution-
x 4 K Map.
We fill the cells of K Map in accordance with the given boolean
function.
Then, we form the groups in accordance with the above rules.
56
F(A, B, C, D) = D + B‟C‟
3-
57
4-Simplify the following Boolean Functions, using three variable maps:
(a) F(x,y,z)=Σ(0,2,6,7)
F= XY + X‟Z‟
(b) F(A,B,C)=Σ(0,2,3,4,6)
F= A‟B + C‟
(c) F(a,b,c)=Σ(0,1,2,3,7)
58
F=A‟+BC
F= XY + XZ+ YZ
Problems:
Simplify the following Boolean Functions.
F=Y
59
F=BCD+A‟BD‟
F=CD+ABD+ABC
F= WX + W‟X‟Y
61
Problems:
Solution:
a) AC BD ACD ABCD
C C
0 1 1 0 0 1 1 0
0 0 1 0 0 0 1 0
B B
1 1 1 0 1 1 1 0
A A
1 1 1 0 1 1 1 0
D D
F‟=CD‟+A‟D‟+A‟BC‟
SOP= AC CD BD POS= C D A D A B'C
C
C
1 1 0 1
1 1 0 1
1 1 0 0
B 1 1 0 0
1 0 0 1 B
A 1 0 0 1
1 0 0 1 A
1 0 0 1
D
D
60
F‟= AD+ CD + A‟BC
SOP= A' C' B' D AD' POS= A DC D A B C
Problems:
1. Simplify the following Boolean functions to a minimum number of
literals:
(1) A +AB
(2) AB+AB'
(3) A'BC + AC
(4) A'B+ ABC' +ABC
(5) AB + A(CD + CD')
(6) (BC'+A'D).(AB'+CD')
(7) (X+Y)(X+Y')
(8) X+X'Y
(9) XY+ X'Z + YZ
(10) A'C' + AC'+ ABC
(11) AC + A'BC
(12) X(X'+Y)
(13) XY+XY'
(14) XYZ+X'Y+XYZ'
(15) ABC+A'B+ABC'
(16) XZ + X'YZ
(17) A+A'B+ A'B'
2. Simplify the following expression using Boolean algebra
F= XY'Z + X'Y'Z + XYZ
List the truth table and draw the logic diagram of the simple expression.
63
Programmable Read Only Memory
Programmable Array Logic
Programmable Logic Array
PROM is a programmable logic device that has fixed AND array &
Programmable OR array. The block diagram of PROM is shown in the
following figure.
Here, the inputs of AND gates are not of programmable type. So, we
have to generate 2n product terms by using 2n AND gates having n inputs
each. We can implement these product terms by using nx2 n decoder. So,
this decoder generates „n‟ min terms.
64
Here, the inputs of OR gates are programmable. That means, we can
program any number of required product terms, since all the outputs of
AND gates are applied as inputs to each OR gate. Therefore, the outputs
of PROM will be in the form of sum of min terms.
Example
A(X,Y,Z)=∑m(5,6,7)A(X,Y,Z)=∑m(5,6,7)
B(X,Y,Z)=∑m(3,5,6,7)
The given two functions are in sum of min terms form and each function
is having three variables X, Y & Z. So, we require a 3 to 8 decoder and
two programmable OR gates for producing these two functions. The
corresponding PROM is shown in the following figure.
65
Programmable Array Logic PAL
Here, the inputs of AND gates are programmable. That means each
AND gate has both normal and complemented inputs of variables. So,
based on the requirement, we can program any of those inputs. So, we
can generate only the required product terms by using these AND
gates.
Here, the inputs of OR gates are not of programmable type. So, the
number of inputs to each OR gate will be of fixed type. Hence, apply
those required product terms to each OR gate as inputs. Therefore, the
outputs of PAL will be in the form of sum of products form.
Example
A=XY+XZ′A=XY+XZ′
A=XY′+YZ′
The given two functions are in sum of products form. There are two
product terms present in each Boolean function. So, we require four
66
programmable AND gates & two fixed OR gates for producing those two
functions. The corresponding PAL is shown in the following figure.
The programmable AND gates have the access of both normal and
complemented inputs of variables. In the above figure, the inputs
X, X′X′, Y, Y′Y′, Z & Z′Z′, are available at the inputs of each AND gate.
So, program only the required literals in order to generate one product
term by each AND gate. The symbol „X‟ is used for programmable
connections.
Here, the inputs of OR gates are of fixed type. So, the necessary product
terms are connected to inputs of each OR gate. So that the OR gates
produce the respective Boolean functions. The symbol „.‟ is used for
fixed connections.
67
Here, the inputs of AND gates are programmable. That means each
AND gate has both normal and complemented inputs of variables. So,
based on the requirement, we can program any of those inputs. So, we
can generate only the required product terms by using these AND
gates.
Here, the inputs of OR gates are also programmable. So, we can program
any number of required product terms, since all the outputs of AND
gates are applied as inputs to each OR gate. Therefore, the outputs of
PAL will be in the form of sum of products form.
Example
A=XY+XZ′A=XY+XZ′
B=XY′+YZ+XZ′B=XY′+YZ+XZ′
The given two functions are in sum of products form. The number of
product terms present in the given Boolean functions A & B are two and
three respectively. One product term, Z′XZ′X is common in each
function.
68
The programmable AND gates have the access of both normal and
complemented inputs of variables. In the above figure, the inputs
X, X′X′, Y, Y′Y′, Z & Z′Z′, are available at the inputs of each AND gate.
So, program only the required literals in order to generate one product
term by each AND gate.
69
Symbol
Truth Table
X Y SUM (S) CARRY ( C )
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
S (X,Y) = (1,2), C= (1,2) = XY
S = X'Y + XY' , C=XY (1)
S = X Y, C=XY (2)
71
bits to be added, the third input represents the carry form the
previous position.
Truth Table
X Y CIN SUM (S) CARRY (Cout)
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
SUM (X,Y,Z) = S = (1,2,4,7)
CARRY (X,Y,Z) = Cout = (3,5,6,7)
70
Subtractors
The subtraction of two binary numbers can be accomplished by taking the
complement of the subrahend and adding to the minuend.
That is, X – Y = X + 2's Complement of Y.
By this method, the subtraction operation becomes an addition operation.
72
Half Subtractor
The half-subtractor is a combinational circuit which is used to perform
subtraction of two bits. Cleary this circuit is performing binary
subtraction of Y from X (X-Y, recalling that in binary 0-1 = 1 borrow 1).
It has two inputs, X (minuend) and Y (subtrahend) and two outputs D
(difference) and B (borrow). Consider the circuit below:
X Y D (DIFF) B (BORROW)
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
73
three inputs and two outputs. The three inputs A, B and Bin,
denote the minuend, subtrahend, and previous borrow, respectively. The
two outputs, D and Bout represent the difference and output borrows,
respectively. Generally, the full subtractor is one of the most used and
essential combinational logic circuits. It is a basic electronic device,
used to perform subtraction of two binary numbers. Likewise, the full-
subtractor uses binary digits like 0, 1 for the subtraction
74
Binary addition
75
Block diagram
Binary Subtractor
To perform the subtraction, we can use the 2's complements, so the
subtraction can be converted to addition. 2's complement can be obtained
by talking the 1‟s complement and adding 1 to the LSD bit.
1) 1‟s complement can be implemented with inverters.
2) 1 can be added to the sum through the input carry.
The circuit for subtracting A-B consists of an adder with inverters
placed between each data input B and the corresponding input of
the full adder. The input carry C0 must be equal to 1
4 Bit Subtractor circuit
76
performed. The operation thus performed becomes A, plus the 1‟s
complement of B, plus 1. This is equal to A plus the 2‟s complement of B
Decoders
A decoder is a device which does the reverse of an encoder. A decoder is
a multiple-input, multiple-output logic circuit that converts coded inputs
into coded outputs, where the input and output codes are different; e.g. n-
to-2n, BCD decoders. Enable inputs (E) must be on for the decoder to
function i.e. E=1 the decoder is on, E=0 the decoder is off. Decoding is
necessary in applications such as data multiplexing, 7 segment display
and memory address decoding.
77
Example : 2-to-4 Binary Decoder
A 2 to 4 decoder consists of two inputs and four outputs, truth table and
symbols of which is shown below.
Truth Table
X Y F0 F1 F2 F3
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1
It is clear that:
F0 = X' Y'
F1 = X' Y
F2 = X Y'
F3= X Y
Symbol
78
Example : 3-to-8 Binary Decoder
A 3 to 8 decoder consists of three inputs and eight outputs, truth table and
symbols of which is shown below.
Truth Table
X Y Z F0 F1 F2 F3 F4 F5 F6 F7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
Symbol
79
(c) Construct 4x16 decoder by using 2x4 decoders.
(d) Construct 5x32 decoder by using 3x8 and 2x4 decoders.
Seven-Segment Decoder
81
Decimal
Inputs Outputs
Number
DCBA a b c d e f g
0 0 0 0 0 1 1 1 1 1 1 0
1 0 0 0 1 0 1 1 0 0 0 0
2 0 0 1 0 1 1 0 1 1 0 1
3 0 0 1 1 1 1 1 1 0 0 1
4 0 1 0 0 0 1 1 0 0 1 1
5 0 1 0 1 1 0 1 1 0 1 1
6 0 1 1 0 1 0 1 1 1 1 1
7 0 1 1 1 1 1 1 0 0 0 0
8 1 0 0 0 1 1 1 1 1 1 1
9 1 0 0 1 1 1 1 1 0 1 1
The decoder output can be obtained as Boolean function of the inputs (A,
B, C and D).
For example, the K- map for the " a " output is shown.
a = A + C + BD + B'D'
80
For example prove:
g = A + B.C + C.D' + B'.C
Encoders
An encoder is a combinational circuit that performs the inverse operation
of a decoder. If a device output code has fewer bits than the input code
has, the device is usually called an encoder. e.g. 2n-to-n, priority
encoders.
The simplest encoder is a 2n-to-n binary encoder, where it has only
one of 2n inputs = 1 and the output is the n-bit binary number
corresponding to the active input.
D0 D1 D2 D3 X Y
1 0 0 0 0 0
0 1 0 0 0 1
82
0 0 1 0 1 0
0 0 0 1 1 1
X= D2 + D3 Y = D1 + D3
directional.
Mutliplexer:
Multiplexer means many into one. A multiplexer is a circuit used
to select and route any one of the several input signals to a signal
of electronic components.
83
Multiplexer handle two type of data that is analog and
and transistor switches. For digital application, they are built from
multiplexer.
The 4-to-1 multiplexer has 4 input bit, 2 control bits, and 1 output
bit. The four input bits are D0,D1,D2 and D3. only one of
84
this is transmitted to the output y. The output depends on
AND gate is enabled while all other AND gates are disabled.
85
Example : 2x1 MUX
A 2 to 1 line multiplexer is shown in figure, each 2 input lines I 0 to I1 is
applied to one input. The truth table for the 2:1 mux is given in the table
below.
Truth Table
S Y
0 I0
1 I1
86
Truth Table
S1 S0 Y
0 0 I0
0 1 I1
1 0 I2
1 1 I3
Circuit
Larger Multiplexers
Larger multiplexers can be constructed from smaller ones. An 8-to-1
multiplexer can be constructed from smaller multiplexers as shown
below.
87
Example - 8-to-1 multiplexer from Smaller MUX
Truth Table
S2 S1 S0 F
0 0 0 I0
0 0 1 I1
0 1 0 I2
0 1 1 I3
1 0 0 I4
1 0 1 I5
1 1 0 I6
1 1 1 I7
Circuit
88
An example of 4-to-1 multiplexer is IC 74153 in which the
output is same as the input.
Another example of 4-to-1 multiplexer is 45352 in which the
output is the compliment of the input.
Example of 16-to-1 line multiplexer is IC74150.
Applications of Multiplexer:
applications of multiplexers -
89
transmitting different type of data such as audio, video at the
Demultiplexer:
can steer any input to the output. Few types of demultiplexer are
91
1 to 4 Dempultiplexer Circuit Diagram
The input bit is labeled as Data D. This data bit is transmitted to
the data bit of the output lines. This depends on the value of AB,
depends upon the value of D. All other outputs are in low state.
disabled except the third AND gate from the top. Then, D is
90
1. Demultiplexer is used to connect a single source to multiple
to carry multiple data like audio, video and other form of data
92
4. Serial to parallel converter - A serial to parallel converter is
When all data signals have been stored, the output of the
93
Chapter 4
Synchronous sequential logic
94
Asynchronous sequential circuits
95
A clock signal is a periodic square wave that indefinitely switches from 0
to 1 and from 1 to 0 at fixed intervals. Clock cycle time or clock period:
the time interval between two consecutive rising or falling edges of the
clock.
Clock Frequency = 1 / clock cycle time (measured in cycles per second
or Hz)
96
3. Astable multivibrator has no stable state at all. It is used
primarily as an oscillator to generate periodic pulse
waveforms for timing purposes.
97
S R Q(t) Q' (t)
0 0 Q (no change) Q'
0 1 0 Reset state=Clear to 0 1
1 0 1 Set state 0
The waveform below shows the operation of NOR gates based RS flip
flop.
It is possible to construct the RS flip flop using NAND gates. The only
difference is that NAND is NOR gate dual form . So in this case the R =
0 and S = 0, both outputs go to 1and the case becomes the invalid case.
This condition should be avoided in normal operation. The circuit and
Truth table of RS flip flop using NAND is shown below.
98
S R Q(t) Q' (t)
0 0 1 1 (invalid)
0 1 1 0
1 0 0 1
1 1 Q Q' (no change)
Clocked SR Flip-Flop
The clocked SR flip-flop shown in shown blow consists of a basic NOR
flip-flop and two AND gates. The outputs of the two AND gates remain
at 0 as long as the clock pulse (or CP) is 0, regardless of the S and R input
values. When the clock pulse goes to 1, information from the S and R
inputs passes through to the basic flip-flop. With both S=1 and R=1, the
occurrence of a clock pulse causes both outputs to momentarily go to 0.
When the pulse is removed, the state of the flip-flop is indeterminate, ie.,
either state may result, depending on whether the set or reset input of the
flip-flop remains a 1 longer than the transition to 0 at the end of the pulse.
99
S R Q(t) Q(t+1)
0 0 0 0
0 1 0 0
1 0 0 1
1 1 0 indeterminate
0 0 1 1
0 1 1 0
1 0 1 1
1 1 1 indeterminate
where Q(t) = present state, Q(t+1) = next state.
D Flip-Flop
The D flip-flop is a modification of the clocked SR flip-flop. The clocked
SR flip-flop seen earlier contains ambiguous state; to eliminate this
condition we can ensure that S and R are never equal. This is done by
connecting S and R together with an inverter. Thus we have D flip flop
with the only one input which called D or Data input. Delay flip-flop or
delay latch is another name used. The D input is sampled during the
occurrence of a clock pulse. If it is 1, the flip-flop is switched to the set
state (unless it was already set). If it is 0, the flip-flop switches to the
clear state. Below is the truth table and circuit of D latch.
symbol
011
D Q(t) Q(t+1)
0 0 0
1 0 1
0 1 0
1 1 1
D Q(t+1
0 0 Clear to 0 = Reset
1 1 Set to 1
JK Flip-Flop
A JK flip-flop is a refinement of the SR flip-flop in that the indeterminate
state of the SR type is defined in the JK type. Inputs J and K behave like
inputs S and R to set and clear the flip-flop (note that in a JK flip-flop, the
letter J is for set and the letter K is for clear). When logic 1 inputs are
applied to both J and K simultaneously, the flip-flop switches to its
complement state, ie., if Q=1, it switches to Q=0 and vice versa. Instead
of the indeterminate condition, the JK flip flop has a complement
condition Q(t+1) = Q'(t).
A clocked JK flip-flop is shown blow. Output Q is ANDed with K
and CP inputs so that the flip-flop is cleared during a clock pulse only if
010
Q was previously 1. Similarly, ouput Q' is ANDed with J and CP inputs
so that the flip-flop is set with a clock pulse only if Q' was previously 1.
Note that because of the feedback connection in the JK flip-flop, a
CP signal which remains a 1 (while J=K=1) after the outputs have been
complemented once will cause repeated and continuous transitions of the
outputs. To avoid this, the clock pulses must have a time duration less
than the propagation delay through the flip-flop. The restriction on the
pulse width can be eliminated with a master-slave or edge-triggered
construction. The same reasoning also applies to the T flip-flop presented
next.
symbol
J K Q(t) Q(t+1)
0 0 0 0
0 1 0 0
1 0 0 1
1 1 0 1
0 0 1 1
0 1 1 0
1 0 1 1
1 1 1 0
012
Truth table in simple form
J K Q(t+1)
0 0 Q(t) no change
0 1 0 Clear to 0=Reset state
1 0 1 Set to 1
1 1 Q'(t) complement
Note: Complement= toggle= invert the previous output= change output to
complement state.
T Flip-Flop
The T flip-flop is a single input version of the JK flip-flop. As shown in
figurer, the T flip-flop is obtained from the JK type if both inputs are tied
together. The output of the T flip-flop "toggles" with each clock pulse i.e.
when input is held HIGH, output toggles .
T Q(t) Q(t+1)
0 0 0
1 0 1
0 1 1
1 1 0
013
Truth table in simple form
T Q(t+1)
0 Q(t) no change
1 Q'(t) complement
Triggering of Flip-flops
The state of a flip-flop is changed by a momentary change in the input
signal. This change is called a trigger and the transition it causes is said to
trigger the flip-flop. Clocked flip-flops are triggered by pulses.
The feedback path between the combinational circuit and memory
elements in sequential circuits can produce instability if the outputs of the
memory elements (flip-flops) are changing while the outputs of the
combinational circuit that go to the flip-flop inputs are being sampled by
the clock pulse. A way to solve the feedback timing problem is to make
the flip-flop sensitive to the pulse transition rather than the pulse duration.
The clock pulse goes through two signal transitions: from 0 to 1 and the
return from 1 to 0. As shown in figure the positive transition is defined as
the positive edge and the negative transition as the negative edge.
014
Master-Slave Flip-Flop
A master-slave flip-flop is constructed from two separate flip-flops. One
circuit serves as a master and the other as a slave i.e. master is positively
clocked and slave is negatively clocked. The logic diagram of an SR flip-
flop is shown below. The master flip-flop is enabled on the positive edge
of the clock pulse CP and the slave flip-flop is disabled by the inverter.
The information at the external R and S inputs is transmitted to the master
flip-flop. When the pulse returns to 0, the master flip-flop is disabled and
the slave flip-flop is enabled. The slave flip-flop then goes to the same
state as the master flip-flop.
The timing relationship is shown in figure 10 and is assumed that the flip-
flop is in the clear state prior to the occurrence of the clock pulse. The
output state of the master-slave flip-flop occurs on the negative transition
of the clock pulse. Some master-slave flip-flops change output state on
the positive transition of the clock pulse by having an additional inverter
between the CP terminal and the input of the master.
015
Summery :
016
Chapter 5
Counters and Registers
Counter is an instrument, the main purpose of which is to count the
number of pulses received in a given time interval.
Counters can be classified into two broad categories according to
the way they are clocked:
1. Synchronous counter: All flip-flops in a synchronous counter
receive the same clock pulse and so change state simultaneously.
2. Asynchronous (Ripple) Counters - the first flip-flop is clocked by
the external clock pulse. Flip-flops transitions ripple through from
one flip-flop to the next in sequence until all flip-flops reach a new
stable value (state).
Ripple Counters
A Ripple Counter consists of two flip flop is shown on the figure. The
external clock is connected to the clock input of the first flip-flop (FF0)
only. So, FF0 changes state at the falling edge of each clock pulse, but
FF1 changes only when triggered by the falling edge of the Q output of
FF0. Because of the inherent propagation delay through a flip-flop, the
transition of the input clock pulse and a transition of the Q output of FF0
can never occur at exactly the same time. Therefore, the flip-flops cannot
be triggered simultaneously, producing an asynchronous operation.
Usually, all the CLEAR inputs are connected together, so that a single
pulse can clear all the flip-flops before counting starts. The 2-bit ripple
counter circuit above has four different states, each one corresponding to
a count value. Similarly, a counter with n flip-flops can have 2 to the
017
power n states =2n. The number of states in a counter is known as its
mod (modulo) number. Thus a 2-bit counter is a mod-4 counter.
018
Shift registers
Shift registers are a type of sequential logic circuit, mainly for storage of
digital data. They are a group of flip-flops connected in a chain so that
the output from one flip-flop becomes the input of the next flip-
flop. Most of the registers possess no characteristic internal sequence of
states. All the flip-flops are driven by a common clock, and all are set or
reset simultaneously. The basic types of shift registers are :
019
FF0 FF1 FF2 FF3
0 0 0 0
1 0 0 0
0 1 0 0
0 0 1 0
1 0 0 1
Example
If a four bit number (1011) is applied to the input of the first flip-flop.
After four clock pulses this number will be at the output of the flip-flop.
In this manner, a four bit number can be stored in the register. After four
001
more clock pulses, this data will be shifted out of the
register.
000
Data is fed into the SERIAL IN/PARALLEL OUT shift register bit by bit,
in the same way as for the SISO shift register. However the four bits are all
shifted out simultaneously, in parallel, as one word.
D0, D1, D2 and D3 are the parallel inputs, where D0 is the most
significant bit and D3 is the least significant bit. To write data in, the
mode control line is taken to LOW and the data is clocked in. The data
can be shifted when the mode control line is HIGH as SHIFT is active
high. The register performs right shift operation on the application of a
clock pulse, as shown in the animation below.
002
With the PARALLEL IN/SERIAL OUT shift register, four bits
are shifted into the register simultaneously, in parallel. They are then
clocked out, one after the other, in serial form.
The D's are the parallel inputs and the Q's are the parallel outputs. Once
the register is clocked, all the data at the D inputs appear at the
corresponding Q outputs simultaneously.
003
The shift register is loaded with four bits simultaneously, in parallel. They
are also clocked out simultaneously, in parallel.
Ring Counters
A ring counter is basically shift register in which the output of the most
significant stage is fed back to the input of the least significant stage. The
following is a 4-bit ring counter constructed from D flip-flops. The
output of each stage is shifted into the next stage on the positive edge of a
clock pulse. If the CLEAR signal is high, all the flip-flops except the first
one FF0 are reset to 0. FF0 is preset to 1 instead.
004
Since the count sequence has 4 distinct states, the counter can be
considered as a mod-4 counter. Only 4 of the maximum 16 states are
used, making ring counters very inefficient in terms of state usage. But
the major advantage of a ring counter over a binary counter is that it is
self-decoding. No extra decoding circuit is needed to determine what
state the counter is in.
Memory unit
–a collection of cells capable of storing a large quantity of binary
information and to which binary information is transferred for
storage from which information is available when needed for
processing together with associated circuits needed to transfer
information in and out of the device
• write operation: storing new information into memory
• read operation: transferring the stored information out of the
memory
• Two major types
005
–RAM (Random-access memory): Read + Write
• accept new information for storage to be available later for use
–ROM (Read-only memory): perform only read operation
Programmable Logic Device
•Programmable logic device (PLD)
–an integrated circuit with internal logic gates
• hundreds to millions of gates interconnected through hundreds to
thousands of internal paths
–connected through electronic paths that behave similar to fuse
• In the original state, all the fuses are intact
–programming the device
• blowing those fuse along the paths that must be removed in
order to obtain particular configuration of the desired logic
function
•Types
–Read-only Memory (ROM)
–programmable logic array (PLA)
–programmable array logic (PAL)
–field-programmable gate array (FPGA)
006
Chapter (6)
Number Systems
Many number systems are in use in digital technology. The most common
are the decimal, binary, octal, and hexadecimal systems. The decimal
system is clearly the most familiar to us because it is a tool that we use
every day. Examining some of its characteristics will help us to better
understand the other systems. In the next few pages we shall introduce
four numerical representation systems that are used in the digital system.
There are other systems, which we will look at briefly.
Decimal
Binary
Octal
Hexadecimal
Decimal System
The decimal system is composed of 10 numerals or symbols. These 10
symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Using these symbols as digits of a
number, we can express any quantity. The decimal system is also called
the base-10 system because it has 10 digits.
103 102 101 100 10-1 10-2 10-3
=1000 =100 =10 =1 . =0.1 =0.01 =0.001
Most Least
Decimal
Significant Significant
point
Digit Digit
007
Even though the decimal system has only 10 symbols, any number of any
magnitude can be expressed by using our system of positional weighting.
Decimal Examples
3.1410
5210
102410
6400010
Binary System
In the binary system, there are only two symbols or possible digit values,
0 and 1. This base-2 system can be used to represent any quantity that can
be represented in decimal or other base system.
Binary Counting
The Binary counting sequence is shown in the table:
23 22 21 20 Decimal
0 0 0 0 0
0 0 0 1 1
008
0 0 1 0 2
0 0 1 1 3
0 1 0 0 4
0 1 0 1 5
0 1 1 0 6
0 1 1 1 7
1 0 0 0 8
1 0 0 1 9
1 0 1 0 10
1 0 1 1 11
1 1 0 0 12
1 1 0 1 13
1 1 1 0 14
1 1 1 1 15
Octal System
The octal number system has a base of eight, meaning that it has eight
possible digits: 0,1,2,3,4,5,6,7.
83 82 81 80 8-1 8-2 8-3
=512 =64 =8 =1 . =1/8 =1/64 =1/512
Least
Most Significant
Octal point Significant
Digit
Digit
009
Octal to Decimal Conversion
2378 = 2 x (82) + 3 x (81) + 7 x (80) = 15910
24.68 = 2 x (81) + 4 x (80) + 6 x (8-1) = 20.7510
11.18 = 1 x (81) + 1 x (80) + 1 x (8-1) = 9.12510
12.38 = 1 x (81) + 2 x (80) + 3 x (8-1) = 10.37510
Hexadecimal System
The hexadecimal system uses base 16. Thus, it has 16 possible digit
symbols. It uses the digits 0 through 9 plus the letters A, B, C, D, E, and
F as the 16 digit symbols.
Code Conversion
Converting from one code form to another code form is called code
conversion, like converting from binary to decimal or converting from
hexadecimal to decimal.
021
Binary-To-Decimal Conversion
Any binary number can be converted to its decimal equivalent simply by
summing together the weights of the various positions in the binary
number which contain a 1.
Binary Decimal
110112
24+23+01+21+20 =16+8+0+2+1
Result 2710
and
Binary Decimal
101101012
27+06+25+24+03+22+01+20 =128+0+32+16+0+4+0+1
Result 18110
You should have noticed that the method is to find the weights (i.e.,
powers of 2) for each bit position that contains a 1, and then to add them
up.
Example
110100 = 1x25 + 1x24 + 0x23 + 1x22 + 0x21 + 0x20
= 32 + 16 + 0 + 4 +0 +0 +52
The same approach applies to non-integral numbers.
Example
110.101 = 1x22 + 1x21+0x20+1x2-1+0x2-2 + 1x2-3
= 4 + 2 + 0 + 0.5 + 0 + 0.125 = 6.625
020
Decimal-To-Binary Conversion
There are 2 methods:
Reverse of Binary-To-Decimal Method
Repeat Division
022
Convert 57.4801dec to its binary equivalent to 14-bit accuracy.
Answer
As the decimal number has both an integer and a fractional part the
problem has to be done in two steps
First take the integer part i.e. 57 and repeatedly divide by 2 noting
the remainders of each division.
57 / 2 = 28 remainder 1 lsb
28 / 2 = 14 remainder 0
14 / 2 = 7 remainder 0
7 / 2 = 3 remainder 1
3 / 2 = 1 remainder 1
1 / 2 = 0 remainder 1 msb
.4801 x 2 = .9602 + 0
.9602 x 2 = .9204 + 1
.9204 x 2 = .8408 + 1
.8408 x 2 = .6816 + 1
.6816 x 2 = .3632 + 1
.3632 x 2 = .7264 + 0
.7264 x 2 = .4528 + 1
023
and so
57.4801dec = 111001.0111101
Octal Digit 0 1 2 3 4 5 6 7
Binary
000 001 010 011 100 101 110 111
Equivalent
Example:
100 111 0102 = (100) (111) (010)2 = 4 7 28
024
Hexadecimal to Decimal/Decimal to Hexadecimal Conversion
Example:
2AF16 = 2 x (162) + 10 x (161) + 15 x (160) = 68710
Binary-To-Hexadecimal Hexadecimal-To-BinaryConversion
Hexadecimal Digit 0 1 2 3 4 5 6 7
Binary Equivalent 0000 0001 0010 0011 0100 0101 0110 0111
Hexadecimal Digit 8 9 A B C D E F
Binary Equivalent 1000 1001 1010 1011 1100 1101 1110 1111
Each Hexadecimal digit is represented by four bits of binary digit.
Example:
1011 0010 11112 = (1011) (0010) (1111)2 = B 2 F16
Example:
Convert the binary number 1101101101101 to its hexadecimal
equivalent.
025
Answer:
The binary number 1101101101101 has 13 digits. First extend this to a
multiple of 4 (i.e. 16) by adding three leading 0s to the number, i.e.
11011011001101 becomes 0001101101101101
Next break the binary number up into nibbles (4-bit groups) and convert
each nibble to its hexadecimal equivalent.
Hexadecimal 1 B 6 D
hence
1101101101101 = 1B6Dhex
Example:
Convert 5A816 to Octal.
Hexadecimal Binary/Octal
5A816 = 0101 1010 1000 (Binary)
= 010 110 101 000 (Binary)
Result = 2 6 5 0 (Octal)
026
Binary Addition
Binary addition is completely straightforward and is done in the same
way as standard decimal addition remembering that, in binary terms "one
plus one equals zero carry one". This is also true for fractional binary
numbers as illustrated below.
Binary Decimal Binary Decimal Binary Decimal
Binary Subtraction
Binary subtraction usually takes place by complementing i.e. subtraction
is via the addition of negative numbers. This technique requires the use of
the so-called ones (1's) complement and twos (2's) complement of a
binary number.
The 1's complement of a binary number is formed simply by
complementing each digit in turn. The 2's complement of a binary
number is formed by adding 1 to the least significant bit of the 1's
complement (Note in the case of fractional binary numbers this is not the
same as adding 1 to the 1's complement number - see below).
Decimal Binary 1's Complement 2's Complement
027
Note that in order to correctly express the 1's complement and 2's
complement binary numbers a fixed length format must be chosen (8-bit
in the case above) and leading zeroes must be included when writing the
original pure binary format number.
Finally, in order to represent a negative binary number the MSB
becomes a sign bit i.e. if the MSB=1 then the number is negative, if the
MSB=0 then the number is positive, and so, e.g. 00010011 = +19 and
10010011 = -19. This is called true magnitude format.
028
Answer:
First we choose to use 8-bit true magnitude format. In this format:
+75 = 01001011 ; + 42 = 00101010
029
Binary Multiplication and Binary Division
Binary multiplication and binary division are both most easily done by
long multiplication and division methods as often taught for standard
decimal numbers.
In both cases all numbers must be in true magnitude format but
with sign bits removed. For multiplication each partial product is
calculated and then all partial products are summed using standard binary
addition. For division it proceeds like decimal division. Finally the sign
of the product or quotient is determined by summing all sign bits and
retaining the LSB only of the resultant sum.
References
M. Morris Mano, "Digital Design" Third Edition.
M. RAFIQUZZAMAN " Fundamentals of Digital Logic and
Microcomputer Design" Fifth Edition.
Mark Balch " COMPLETE DIGITAL DESIGN".
http://www.electronicshub.org/multiplexer-and dempltiplexer
https://www.tutorialspoint.com/digital_circuits/digital_circuits_pr
ogrammable_logic_devices.htm
https://www.philadelphia.edu.jo/academics/qhamarsheh/uploads/L
ecture%2012%20Binary%20Adder-Subtractor.pdf
https://faculty.ksu.edu.sa/sites/default/files/unit-5-
combinational_circuit-1.pdf
031