II Semester Course Digital Logic Design: UNIT - I Number Systems
II Semester Course Digital Logic Design: UNIT - I Number Systems
II Semester Course
Digital Logic Design
UNIT – I Number Systems: Binary, octal, decimal, hexadecimal number systems,
conversion of numbers from one radix to another radix, r’s, (r-1)’s complements,
signed binary numbers, addition and subtraction of unsigned and signed
numbers, weighted and unweighted codes.
CONVERTING ONE NUMBER SYSTEM TO ANOTHER 2. Convert a Decimal Number to Binary, Octal, and Hexadecimal using the
example 45 10
1.Converting a Binary Number into Decimal, Octal, and Hexadecimal Using an
Example.
3. Convert an Octal Number to Binary, Decimal, and Hexadecimal using 4. Convert a Hexadecimal Number to Binary, Octal, and Decimal using
the example 57 8 the example 2F 16
(r-1)’s complements:
Signed and unsigned binary numbers refer to how binary numbers represent
values, specifically whether or not they include the ability to represent
negative values.
Example 1:
1101
+ 1010
--------------
10111 (23 in decimal)
• Addition: Overflow occurs if the result exceeds the maximum value Add +5 (0101) and +3 (0011) in a 4-bit system:
represent able by the given number of bits.
o Example: Adding 1111 (15 in decimal) and 0001 (1 in 0101 (+5)
decimal) in a 4-bit system results in 100001000010000, + 0011 (+3)
which exceeds the 4-bit range (0–15).
• Subtraction: Underflow occurs if you attempt to subtract a larger -----------------------------
number from a smaller number, which isn't valid in unsigned 1000 (+8, no overflow)
arithmetic.
Example 2: Negative + Negative
Example of Overflow: Add −5 (101110111011) and −3 (1101) in a 4-bit system:
For a 4-bit system: 1011 (-5)
1111 (15)
+ 0001 (1) + 1101 (-3)
---------------------------------- --------------------------
10000 (Overflow: result exceeds 4 bits)
11000 (Ignore the carry, result is 1000 = -8)
Example 2: Negative - Positive • Definition: Each position in the binary representation has a fixed
weight assigned to it.
Subtract +3 (0011) from −5 (1011): • The value of the code is determined by summing the products of the
digit values and their respective weights.
• Take the 2's complement of +3:
Characteristics: 3. Includes codes like Gray Code, Excess-3 Code (can also be
weighted), and ASCII.
1. Fixed positional weights are assigned (e.g., 1, 2, 4, 8 in binary).
2. Useful for arithmetic operations like addition and subtraction. Examples of Unweighted Codes:
3. Includes well-known codes like Binary, Decimal, and BCD (Binary-
Coded Decimal). 1. Gray Code:
o Adjacent numbers differ by only one bit.
o Example: Decimal 0 to 7 in Gray Code:
0 → 000
1 → 001
2 → 011
3 → 010
4 → 110
5 → 111
6 → 101
7→ 100
2. ASCII (American Standard Code for Information Interchange):
o Represents characters as binary codes.
o Example: Letter 'A' = 100000110000011000001 in ASCII.
3. Hamming Code:
o Used for error detection and correction.
o Does not assign weights but introduces parity bits to ensure
data integrity.
• Definition: No fixed weights are assigned to the digits in the code. 1. Weighted Codes:
• The code does not depend on positional weights but follows specific o Arithmetic calculations in computers.
rules or patterns. o Representing numerical data (e.g., BCD in digital clocks and
calculators).
Characteristics: 2. Unweighted Codes:
o Gray Code: Encoder and sensor data to avoid errors during
1. Do not have positional weight for digits. transitions.
2. Often used for error detection, error correction, or specific o ASCII: Character representation in text processing.
applications. o Hamming Code: Error correction in communication systems.
UNIT – II
Logic Gates and Boolean Algebra: NOT, AND, OR, universal gates,
X-OR and X-NOR gates, Boolean laws and theorems, complement AND Gate
and dual of a logic function, canonical and standard forms, two In the AND gate, the output of an AND gate attains state 1 if and only if all
level realization of logic functions using universal gates, the inputs are in state 1.
minimizations of logic functions (POS and SOP) using Boolean
theorems, K-map (up to four variables), don’t care conditions. Basic The Boolean expression of AND
Logic Gates gate is Y = A.B
****************************************************************** The truth table of a two-input AND
Logic gates: Logic gates are used to carry out logical operations on basic gate is given as
single or multiple binary inputs and give one binary output. In simple
terms, logic gates are the electronic circuits in a digital system
Types of Basic Logic Gates A B Y
There are several basic logic gates used in performing operations in digital
systems. The common ones are
0 0 0
• OR Gate
• AND Gate
• NOT Gate
0 1 0
OR Gate
In an OR gate, the output of an OR gate attains state 1 if one or more 1 0 0
inputs attain state 1.
1 1 1
The Boolean expression of the
OR gate is Y = A + B, read as Y
equals A ‘OR’ B.
NOT Gate
The truth table of a two-input In a NOT gate, the output of a NOT gate attains state 1 if and only if the
OR basic gate is given as input does not attain state 1.
1 0 1 0 1
1 1 1
1 0
When connected in various combinations, the three gates (OR, AND and A B Y
NOT) give us basic logic gates, such as NAND and NOR gates, which are
the universal building blocks of digital circuits.
0 0 1
NAND Gate
0 1 0
This basic logic gate is the combination of AND and NOT gates.
1 1 0
A B Y
NOR Gate
0 0 0
This gate is the combination of OR and NOT gates.
0 1 1
Y=A+B― 1 1 0
The truth table of a NOR gate is
as follows
Identity Law
The truth table of an XNOR gate In the Boolean Algebra, we have identity elements for both
is given below AND(.) and OR(+) operations. The identity law state that in
boolean algebra we have such variables that on operating
A B Y with AND and OR operation we get the same result, i.e.
• A + 0 = A
0 0 1 • A.1 = A
Commutative Law
0 1 0 Binary variables in Boolean Algebra follow the commutative
law. This law states that operating boolean variables A and B
1 0 0 is similar to operating boolean variables B and A. That is,
• A. B = B. A
1 1 1 • A + B = B+ A
Associative Law
Associative law state that the order of performing Boolean
Boolean laws and theorems operator is illogical as their result is always the same. This
can be understood as,
Boolean laws and theorems that play a crucial role in digital • ( A . B ) . C = A . ( B . C )
logic and circuit design: • ( A + B ) + C = A + ( B + C)
Laws for Boolean Algebra Distributive Law
The basic laws of the Boolean Algebra are added in the table Boolean Variables also follow the distributive law and the
added below, expression for Distributive law is given as:
Law OR form AND form A . ( B + C) = (A . B) + (A . C)
Identity Law P+0=P P.1 = P Inversion Law
Idempotent Law P+P=P P.P = P
Inversion law is the unique law of Boolean algebra this law The first law states that the complement of the product of the
states that, the complement of the complement of any
variables is equal to the sum of their individual complements
number is the number itself.
(A’)’ = A of a variable.
Apart from these other laws are mentioned below:
AND Law The truth table that shows the verification of De Morgan’s
AND law of the Boolean algebra uses AND operator and the First law is given as follows:
AND law is,
• A . 0 = 0
• A . 1 = A A B A’ B’ (A.B)’ A’+B’
• A . A = A
0 0 1 1 1 1
OR Law
OR law of the Boolean algebra uses OR operator and the OR 0 1 1 0 1 1
law is,
• A + 0 = A 1 0 0 1 1 1
• A + 1 = 1
• A + A = A 1 1 0 0 0 0
The last two columns show that (A.B)’ = A’+B’.
Boolean algebra Theorems
Hence, De Morgan’s First Law is proved.
The two important theorems which are extremely used in
Boolean algebra are De Morgan’s First law and De Morgan’s De Morgan’s Second Law:
second law. These two theorems are used to change the
De Morgan’s Second law states that (A+B)’ = A’. B’.
Boolean expression. This theorem basically helps to reduce
the given Boolean expression in the simplified form. These two The second law states that the complement of the sum of
De Morgan’s laws are used to change the expression from one variables is equal to the product of their individual
form to another form. Now, let us discuss these two theorems complements of a variable.
in detail.
The following truth table shows the proof for De Morgan’s
De Morgan’s First Law: second law.
The dual of a Boolean function, denoted as F<sup>D</sup> Boolean functions expressed as a sum of minterms or
(or sometimes F*), is obtained by interchanging the roles of product of maxterms are said to be in canonical form.
AND and OR operators, as well as the constants 0 and 1. It's
a structural transformation of the Boolean expression. Standard Form – A Boolean variable can be expressed in
either true or complementary forms. In standard form
• Rules for Finding the Dual: Boolean function will contain all the variables in either true
1. Replace each AND operator (.) with an OR form or complemented form while in canonical number of
operator (+). variables depends on the output of SOP or POS.
2. Replace each OR operator (+) with an AND A Boolean function can be expressed algebraically from a
operator (.). given truth table by forming a :
3. Replace each 0 with a 1. • minterm for each combination of the variables that
4. Replace each 1 with a 0. produces a 1 in the function and then takes the OR of all
• Example: those terms.
• maxterm for each combination of the variables that
Let's take the same function F(A, B) = AB + A'B and find produces a 0 in the function and then takes the AND of
its dual, F<sup>D</sup>: all those terms.
these four gates at the first level and one at the second level. OR-OR Implementation
These are The output of an OR-OR
AND-AND, AND-OR, AND-NAND, AND-NOR, gate combination is the Logic
OR-AND, OR-OR, OR-NAND, OR-NOR, Function OR. With this combination,
NAND-AND, NAND-OR, NAND-NAND, NAND-NOR, the OR function can be implemented
NOR-AND, NOR-OR, NOR-NAND, NOR-NOR. with several inputs.
OR-OR implementation
Each two-level combination implements a separate logic
function. These 16 combinations are divided into two The outputs of first-level logic gates: F1=A+B and F2=C+D.
categories. These outputs are applied as inputs of the second level, so the
1. Degenerative form of logic gate Combination output of the second level is F=F1+F2 which means
2. Non-Degenerative form of logic gate Combination F=A+B+C+D.
AND-NAND Implementation
Degenerative form AND gate are present in the
Degenerative form occurs when the output of a two-level logic first level of this logic
realization can be achieved with only one logic gate. The implementation, while NAND
advantage of degenerative form is that the number of inputs gates are present in the
of single Logic gate increases which results in the increment second level. An example of
of fan-in of logic gates. AND-NAND logic realization
In those 16 combinations, there are 8 degenerate forms. is shown in the diagram
Below are instances of each of these degenerate types. below.
AND-AND Implementation
Because the entire function AND-NAND Implementation
results in an AND function of all
the inputs, this AND-AND gate
The outputs of first-level logic gates: F1=AB and F2=CD.
combination is a degenerate
These outputs are applied as inputs of the second level, so the
form.
output of the second level is F= (F1F2)’ which means
F=(ABCD)’.
AND-AND Implementation OR-NOR Implementation
OR-NOR combination of gates results in NOR logic function.
And this degenerate form can be used for the NOR function
The outputs of first-level logic gates: F1=AB and F2=CD. with multiple inputs.
These outputs are applied as inputs of the second level, so the
output of the second level is F=F1F2, which means F=ABCD.
NOR-NAND Implementation
Because the NOR-NAND combination also produces an OR
function, it is likewise a degenerate form. The following is an
example of it with a diagram;
OR-NOR Implementation
NAND-NOR Implementation
AND-OR Implementation
OR-AND Implementation The outputs of first-level logic gates: F1=(A+B)’ and F2=(C+D)’.
The first level gate in an OR-AND combination is an OR gate, These outputs are applied as inputs of the second level, so the
and the second level gate is an AND gate. The Product of Sum output of the second level is F=(F1+F2)’ which means
form is implemented with an OR-AND combination. F=((A+B)’+(C+D)’)’=(A+B)(C+D).
AND-NOR Implementation
The AND-NOR combination is used to implement the AND-
OR-INVERT compound logic (AOI).
OR-AND Implementation
AND-NOR Implementation
The outputs of first-level logic gates: F1=(A+B) and F2=(C+D).
These outputs are applied as inputs of the second level, so the
output of the second level is F=(F1.F2) which means The outputs of first-level logic gates: F1=(AB) and F2=(CD).
F=(A+B)(C+D). These outputs are applied as inputs of the second level, so the
NOR-NOR Implementation output of the second level is F=(F1+F2)’ which means
NOR is also a universal gate and its NOR-NOR combination F=(AB+CD)’.
can be used to implement the Product of Sum form. NAND-AND Implementation
The AND-OR-INVERT (AOI) form can also be implemented
using NAND-AND.
NOR-NOR Implementation
NAND-AND Implementation
NOR-OR Implementation
Example:
K-map for output variable Carry ‘C’: 4. Useful for Basic Operations: Suitable for single-bit
binary addition.
Disadvantages:
2. Full Adder:
Advantages:
Truth table of Full Adder: K-map Simplification for output variable ‘Cout‘
Disadvantages:
3. Half Subtractor:
Disadvantages:
4. Full Subtractor:
Truth Table of Full Subtractor: K-map Simplification for output variable ‘Bout‘ :
Applications:
1. For performing arithmetic calculations in electronic
calculators and other digital devices.
2. In Timers and Program Counters.
3. Useful in Digital Signal Processing.
Advantages:
Disadvantages: