UNIT - 2 Half Notes
UNIT - 2 Half Notes
Logic gates are the fundamental components of all digital circuits and systems. In digital
electronics, there are seven main types of logic gates used to perform various logical
operations. A logic gate is basically an electronic circuit designed by using components
like diodes, transistors, resistors, capacitors, etc., and capable of performing logical
operations. In this article, we will study the definition, truth table, and other related
concepts of logic gates. So let’s start with the basic introduction of logic gates.
Z=A.B
Where, A and B are inputs to the AND gate, while Z denotes the output of the AND gate.
We can extend this expression to any number of input variables, such as,
Z=A.B.C.D…
Truth Table of AND Gate:
The truth table of a two input AND gate is given below:
Z=A+B
Z=A+B+C
Here, A, B, and C are inputs and Z is the output variables. We can extend this boolean
expression to any number of input variables.
Truth Table of OR Gate:
The truth table of an OR gate describes the relationship between inputs and output. The
following is the truth table for the two-input OR gate:
Symbol of OR Gate:
The logic symbol of a two-input OR gate is shown in the following figure.
Symbol of Two-Input OR Gate
NOT Gate
In digital electronics, the NOT gate is another basic logic gate used to perform complement
of an input signal applied to it. It takes only one input and one output. The output of the
NOT gate is complement of the input applied to it. Therefore, if we apply a low or logic 0
output to the NOT gate is gives a high or logic 1 output and vice-versa. The NOT gate is
also known as inverter, as it performs the inversion operation.
The bar over the input variable A represents the inversion operation.
Truth Table of OR Gate:
The truth table describes the relationship between input and output. The following is the
truth table for the NOT gate:
NOR Gate
The NOR gate is a type of universal logic gate that can take two or more inputs but one
output. It is basically a combination of two basic logic gates i.e., OR gate and NOT gate.
Thus, it can be expressed as,
NAND Gate
In digital electronics, the NAND gate is another type of universal logic gate used to
perform logical operations. The NAND gate performs the inverted operation of the AND
gate. Similar to NOR gate, the NAND gate can also have two or more input lines but only
one output line.
The NAND gate is also represented as a combination of two basic logic gates namely, AND
gate and NOT gate. Hence, it can be expressed as
In this expression, A and B are the input variables and C is the output variable. We can
extend this relation to any number of input variables like three, four, or more.
The logic symbol of a NAND gate is represented as a AND gate with a bubble on its output
end as depicted in the following figure. It is the symbol of a two-input NAND gate.
Symbol of NAND Gate
XOR Gate
In digital electronics, there is a specially designed logic gate named, XOR gate, which is
used in digital circuits to perform modulo sum. It is also referred to as Exclusive OR gate
or Ex-OR gate. The XOR gate can take only two inputs at a time and give an output. The
output of the XOR gate is high or logic 1 only when its two inputs are dissimilar.
The following two are the main properties of the XOR gate:
It can accept only two inputs at a time. There is nothing like a three or more input XOR
gate.
The output of the XOR gate is logic 1 or high, when its inputs are dissimilar.
The operation of the XOR gate can be described through a mathematical equation called its
boolean expression. The following is the boolean expression for the output of the XOR
gate.
Here, Z is the output variable, and A and B are the input variables.
This expression can also be written as follows:
XNOR Gate
The XNOR gate is another type of special purpose logic gate used to implement exclusive
operation in digital circuits. It is used to implement the Exclusive NOR operation in
digital circuits. It is also called the Ex-NOR or Exclusive NOR gate. It is a combination of
two logic gates namely, XOR gate and NOT gate. Thus, it can be expressed as,
The output of an XNOR gate is high or logic 1 when its both inputs are similar. Otherwise
the output is low or logic 0. Hence, the XNOR gate is used as a similarity detector circuit.
Properties of XNOR Gate:
The following are two key properties of XNOR gate:
XNOR gate takes only two inputs and produces one output.
The output of the XNOR gate is high or logic 1 only when it has similar inputs.
The operation of XNOR gate can be described through a mathematical equation called the
boolean expression of XNOR gate. Here is the boolean expression of the XNOR gate.
I.True Form – In Boolean algebra, the Boolean function can be expressed as Canonical
Disjunctive Normal Form known as minterm and some are expressed as Canonical
Conjunctive Normal Form known as maxterm.
In Minterm, we look for the functions where the output results in “1” while in Maxterm we
look for functions where the output results in “0”.
We perform the Sum of minterm also known as the Sum of products (SOP).
We perform Product of Maxterm also known as Product of sum (POS).
Product of maxterms –
When dealing with Boolean algebra, the product of maxterms is a handy way to express
how combinations of inputs lead to a result of 0. Maxterms basically tell us which
combinations of inputs won’t give us a 1 as an output. They are the opposite of minterms,
which tell us when we get a 1.
Basic Conversion of Logic Gates
1. AND to NAND
2. OR to NOR
3. NAND to AND
4. NAND to OR
6. NOR to NOT
The algebraic expression of the NOR to NOT gate conversion will be the
same as the NOT gate. So the algebraic conversion of the NOT gate
is:- Y=A’
7. NAND to NOT
The algebraic expression of the NAND to NOT gate conversion will be the
same as the NOT gate. So the algebraic conversion of the NOT gate
is:- Y=A’
8. NOR to OR
The algebraic expression of the NOR to XNOR gate is- (A+B’). (A’+B)
Advantages of Logic Gates
Logic gates are easy to understand and work with. Even beginners can
learn how to use basic gates like AND, OR, and NOT. This simplicity
makes it easier for engineers to design digital systems.
They can be the combined to make more complex circuits. Just like
building with the Lego you can put together different logic gates to
create the bigger and more powerful systems. This is how we make the
things like computer processors and the memory chips.
Logic gates work very quickly helping computers run fast. They can
switch between 0 and 1 states in tiny fractions of a second. This speed
is why modern computers can do so many calculations so quickly.
Disadvantages of Logic Gates
Most logic gates can only handle a few inputs at a time. For example, a
typical AND gate has just two inputs. This means that for more
complex operations, you need to use many gates together, which can
make circuits bigger and more complicated.
They need a constant power supply to work. The Logic gates are
always “on” and using the electricity even when they are not actively
processing. This is why the computers and smartphones use up the
battery power even when they seem to be doing nothing.
When many logic gates work together, they can create heat, which can
cause issues. This is why computers need fans or other cooling
systems. Too much heat can make the logic gates work incorrectly or
even damage them. It is also why big data centers need the powerful
air conditioning.
Just like the truth table, a K-map contains all the possible values of input
variables and their corresponding output values. However, in K-map, the
values are stored in cells of the array. In each cell, a binary value of each
input variable is stored.
2 Variable K-map
There is a total of 4 variables in a 2-variable K-map. There are two
variables in the 2-variable K-map. The following figure shows the structure
of the 2-variable K-map:
3-variable K-map
The 3-variable K-map is represented as an array of eight cells. In this
case, we used A, B, and C for the variable. We can use any letter for the
names of the variables. The binary values of variables A and B are along
the left side, and the values of C are across the top. The value of the given
cell is the binary values of A and B at left side in the same row combined
with the value of C at the top in the same column. For example, the cell in
the upper left corner has a binary value of 000, and the cell in the lower
right corner has a binary value of 101.
The 4-Variable Karnaugh Map
The 4-variable K-map is represented as an array of 16 cells. Binary values
of A and B are along the left side, and the values of C and D are across the
top. The value of the given cell is the binary values of A and B at left side
in the same row combined with the binary values of C and D at the top in
the same column. For example, the cell in the upper right corner has a
binary value of 0010, and the cell in the lower right corner has a binary
value of 1010
Simplification of boolean expressions using
Karnaugh Map
As we know that K-map takes both SOP and POS forms. So, there are two
possible solutions for K-map, i.e., minterm and maxterm solution. Let's
start and learn about how we can find the minterm and maxterm solution
of K-map.
Step 1:
Step 2:
Step 3:
Notice that each group should have the largest number of 'ones'. A group cannot
contain an empty cell or cell that contains 0.
In a group, there is a total of 2n number of ones. Here, n=0, 1, 2, …n.
We group the number of ones in the decreasing order. First, we have to try to
make the group of eight, then for four, after that two and lastly for 1.
The elements in one group can also be used in different groups only when the
size of the group is increased.
The elements located at the edges of the table are considered to be adjacent.
So, we can group these elements.
We can consider the 'don't care condition' only when they aid in increasing the
group-size. Otherwise, 'don't care' elements are discarded.
Step 4:
In the next step, we find the boolean expression for each group. By
looking at the common variables in cell-labeling, we define the groups in
terms of input variables. In the below example, there is a total of two
groups, i.e., group 1 and group 2, with two and one number of 'ones'.
In the first group, the ones are present in the row for which the value of A
is 0. Thus, they contain the complement of variable A. Remaining two
'ones' are present in adjacent columns. In these columns, only B term in
common is the product term corresponding to the group as A'B. Just like
group 1, in group 2, the one's are present in a row for which the value of A
is 1. So, the corresponding variables of this column are B'C'. The overall
product term of this group is AB'C'.
Step 5:
Lastly, we find the boolean expression for the Output. To find the simplified
boolean expression in the SOP form, we combine the product-terms of all
individual groups. So the simplified expression of the above k-map is as follows:
The cross(×) symbol is used to represent the "don't care" cell in K-map.
This cross symbol represents an invalid combination. The "don't care" in
excess-3 code are 0000, 0001, 0010, 1101, 1110, and 1111 because they
are invalid combinations. Apart from this, the 4-bit BCD to Excess-3 code,
the "don't care" are 1010, 1011, 1100, 1101, 1110, and 1111.
We can change the standard SOP function into a POS expression by
making the "don't care" terms the same as they are. The missing
minterms of the POS form are written as maxterms of the POS form. In the
same way, we can change the standard POS function into an SOP
expression by making the "don't care" terms the same as they are. The
missing maxterms of the SOP form are written as minterm of the SOP
form.
Solution:
Solution:
F = A'(B' + C')
The 'n' input variable comes from the external source while the 'm' output
variable goes to the external destination. In many applications, the source
or destinations are storage registers.
Half Adder
The half adder is a basic building block having two inputs and two outputs.
The adder is used to perform OR operation of two single bit binary
numbers. The carry and sum are two output states of the half adder.
Full Adder
The half adder is used to add only two numbers. To overcome this
problem, the full adder was developed. The full adder is used to add three
1-bit binary numbers A, B, and carry C. The full adder has three input
states and two output states i.e., sum and carry.
Half Subtractors
The half subtractor is also a building block of subtracting two binary
numbers. It has two inputs and two outputs. This circuit is used to subtract
two single bit binary numbers A and B. The 'diff' and 'borrow' are the two
output state of the half adder.
Full Subtractors
The Half Subtractor is used to subtract only two numbers. To overcome
this problem, full subtractor was designed. The full subtractor is used to
subtract three 1-bit numbers A, B, and C, which are minuend,
subtrahend, and borrow, respectively. The full subtractor has three
input states and two output states i.e., diff and borrow.
Half Adder
The Half-Adder is a basic building block of adding two numbers as two
inputs and produce out two outputs. The adder is used to perform OR
operation of two single bit binary numbers. The augent and addent bits
are two input states, and 'carry' and 'sum 'are two output states of the
half adder.
Block diagram
Truth Table
1. 'A' and' B' are the input states, and 'sum' and 'carry' are the output states.
2. The carry output is 0 in case where both the inputs are not 1.
3. The least significant bit of the sum is defined by the 'sum' bit.
Full Adder
The half adder is used to add only two numbers. To overcome this
problem, the full adder was developed. The full adder is used to add three
1-bit binary numbers A, B, and carry C. The full adder has three input
states and two output states i.e., sum and carry.
Block diagram
Truth Table
1. 'A' and' B' are the input variables. These variables represent the two
significant bits which are going to be added
2. 'Cin' is the third input which represents the carry. From the previous lower
significant position, the carry bit is fetched.
3. The 'Sum' and 'Carry' are the output variables that define the output
values.
4. The eight rows under the input variable designate all possible
combinations of 0 and 1 that can occur in these variables.
Block diagram
Truth Table
o 'A' and 'B' are the input variables whose values are going to be
subtracted.
o The 'Diff' and 'Borrow' are the variables whose values define the
subtraction result, i.e., difference and borrow.
o The first two rows and the last row, the difference is 1, but the
'Borrow' variable is 0.
o The third row is different from the remaining one. When we subtract
the bit 1 from the bit 0, the borrow bit is produced.
Block diagram
Truth Table
o A' and' B' are the input variables. These variables represent the two
significant bits that are going to be subtracted.
o 'Borrowin' is the third input which represents borrow.
o The 'Diff' and 'Borrow' are the output variables that define the
output values.
o The eight rows under the input variable designate all possible
combinations of 0 and 1 that can occur in these variables.
NOTE : DRAW K – MAP (SUM & CARRY) & GENERATE BOOLEAN
EXPRESSION & DRAW LOGIC GATE
The circuit works by comparing the bits of the two numbers starting from
the most significant bit (MSB) and moving toward the least significant bit
(LSB). At each bit position, the two corresponding bits of the numbers are
compared. If the bit in the first number is greater than the corresponding
bit in the second number, the A>B output is set to 1, and the circuit
immediately determines that the first number is greater than the second.
Similarly, if the bit in the second number is greater than the corresponding
bit in the first number, the A<B output is set to 1, and the circuit
immediately determines that the first number is less than the second.
If the two corresponding bits are equal, the circuit moves to the next bit
position and compares the next pair of bits. This process continues until
all the bits have been compared. If at any point in the comparison, the
circuit determines that the first number is greater or less than the second
number, the comparison is terminated, and the appropriate output is
generated.
If all the bits are equal, the circuit generates an A=B output, indicating
that the two numbers are equal.
There are different ways to implement a magnitude comparator, such as
using a combination of XOR, AND, and OR gates, or by using a cascaded
arrangement of full adders. The choice of implementation depends on
factors such as speed, complexity, and power consumption.
1-Bit Magnitude Comparator
A comparator used to compare two bits is called a single-bit comparator. It
consists of two inputs each for two single-bit numbers and three outputs to
generate less than, equal to, and greater than between two binary
numbers.
The truth table for a 1-bit comparator is given below.
From the above truth table logical expressions for each output can be
expressed as follows.
NOTE : FIND THE KMAP FOR GIVEN CONDITIONS & GENERATE LOGIC
GATES
2-Bit Magnitude Comparator
A comparator used to compare two binary numbers each of two bits is
called a 2-bit Magnitude comparator. It consists of four inputs and three
outputs to generate less than, equal to, and greater than between two
binary numbers.
The truth table for a 2-bit comparator is given below.
NOTE : FIND THE KMAP FOR GIVEN CONDITIONS & GENERATE LOGIC
GATES