Unit-4 (Logic Gates)
Unit-4 (Logic Gates)
1. Logic Functions.
2. Switch & Lamp logic(all gates except xor n xnor).
3. Logic gates(all gates).
4. DeMorgans Theorem (state & prove).
5. Rules & Laws of Boolean Algebra (12 rules & 3 Laws).
6. Show how NAND & NOR are used as Universal Gates (implementing all gates interms of Nand & Nor).
7. Simply & Realise Boolean functions using Basic gates & Universal gates.
8. Combinational logic: Introduction (definition), examples of test book.
9. Adders: Half adder, Full adder, Full adder using two half adder.
10. Sequential Logic: Introduction (Latch & FF & their differences using SR).
11. JK FF function (no Master Slave FF)
12. JK applications: four stage binary counters, four stage shift register.
13. Solved & Unsolved exercise problems.
Consider the circuit with two switches shown in Fig. 10.3. Here the lamp will only operate when switch A is
closed and switch B is closed.Let’s look at the operation of the circuit. Since there are two switches (A and B)
and there are two possible states for each switch (open or closed), there is a total of four possible conditions for
the circuit.
AND logic
In this case the lamp will operate when either of the two switches is closed. As before, there is a total of four
possible conditions for the circuit. We can summarize these conditions in Table 10.3.
Condition Switch A Switch B Comment
1 Open Open No light produced =logic
0
2 Open closed light produced =logic 1
3 closed Open light produced =logic 1
4 Closed closed Light produced = logic 1
Once again, adopting the convention that an open switch can be represented by 0 and a closed switch by 1, we
can rewrite the truth table in terms of the binary states as shown in Fig.
A B Y
0 0 0
0 1 1
1 0 1
1 1 1
Numerical 1: Figure 10.7 shows a simple switching circuit. Describe the logical state of switches A, B, and C in
order to operate the lamp. Illustrate your answer with a truth table.
Solution
In order to operate the lamp, switch A and either switch B or switch C must be operated. The truth table is shown
in Fig. 10.8.
A B C Y=A(B+C)
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
3. Logic gates
i) NOT gate
The NOT gate is an electronic circuit that produces an inverted version of the input at its output. It is also known
as an inverter. If the input variable is A, the inverted output is known as NOT A. This is also shown as A', or A
with a bar over the top, as shown at the outputs.
ii) OR gate: The OR gate is an electronic circuit that gives a high output (1) if one or more of its inputs are
high. A plus (+) is used to show the OR operation.
iii) AND gate: The AND gate is an electronic circuit that gives a high output (1) only if all its inputs are high. A
dot (.) is used to show the AND operation i.e.Y= A.B.
v) NOR gate: This is a NOT-OR gate which is equal to an OR gate followed by a NOT gate. The outputs of all
NOR gates are low if any of the inputs are high. The symbol is an OR gate with a small circle on the output. The
small circle represents inversion
vi) EX-OR gate: The 'Exclusive-OR' gate is a circuit which will give a high output if either, but not both, of
its two inputs are high. An encircled plus sign ( ) is used to show the EOR operation.
vii) EX-NOR gate: The 'Exclusive-NOR' gate circuit does the opposite to the EOR gate. It will give a low output
if either, but not both, of its two inputs are high. The symbol is an EXOR gate with a small circle on the output.
The small circle represents inversion
4. DeMorgans Theorem (state & prove).
De Morgan's First Theorem:-
Statement - The complement of a logical sum equals the logical product of the complements.
Logic equation ̅̅̅̅̅̅̅̅
𝐴 + 𝐵= 𝐴̅. 𝐵̅
6. The NAND and NOR gates are called universal functions since with either one the AND and OR
functions and NOT can be generated.
Implementation of all the gates usin only NAND Gates
Implementation of all the gates using NOR Gates
Y = AB
2.
.
̅̅̅̅ +A𝐵̅C(AB+C)
3. Y =AB+𝐴𝐶
̅̅̅̅ +A𝐵̅CAB+ A𝐵̅CC
= AB+𝐴𝐶
̅̅̅̅ +0+ A𝑩
= AB+𝐴𝐶 ̅C
̅ C) +𝐴𝐶
= A(B+ 𝑩 ̅̅̅̅
̅̅̅̅
= A(B+C) +𝐴𝐶
̅̅̅̅
= AB+AC+𝐴𝐶
= AB+1
=1
4. Simplify:Y = A’(A + B) + (B + AA)(A + B’)
= A’A+A’B+ AB+AA+BB’+AB’
= 0+B(A’+A)+ A+0+AB’
= B.1+A(1+B’)
= B+A.1
= A+B
5.
6.
7.
TO WORK OUT
Simplify: F= (A + C)(AD + AD,) + AC + C
Ans: A+C
9. Y = ̅̅̅̅
𝑨𝑩(𝑨 ̅ + B) (𝑩
̅ +B)
10. simplify
Ans: A’C’+B’
8. Combinational logic :
By using a standard range of logic levels (i.e. voltage levels used to represent the logic 1 and logic 0 states) logic
circuits can be combined together in order to solve complex logic functions
Example 10.2 A logic circuit is to be constructed that will produce a logic 1 output whenever two, or more, of its
three inputs are at logic 1.
A B C Y
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1BC
1 0 0 0
1 0 1 1 AC
1 1 0 1 AB
1 1 1 1ABC
Y= BC+AC+AB+ABC
Logic diagram
9. Adders: Half adder, Full adder, Full adder using two half adder
Half ADDER:
Half adder is the simplest of all adder circuits. Half adder is a combinational arithmetic circuit that adds two
numbers and produces a sum bit (s) and carry bit (c) both as output. The addition of 2 bits is done using a
combination circuit called a Half adder. The input variables are augend and addend bits and output variables are
sum & carry bits. A and B are the two input bits.
Sum = A XOR B
Carry = A AND B
FULL ADDER
Full Adder is the adder that adds three inputs and produces two outputs. The first two inputs are A and B and
the third input is an input carry as C-IN. The output carry is designated as C-OUT and the normal output is
designated as S which is SUM.
.
10. Sequential Logic: Introduction (Latch & FF & their differences using SR).
J-K bistables have two clocked inputs (J and K), two direct inputs (PRESET and CLEAR), a CLOCK (CK)
input, and outputs (Q and Q). Similarly, the PRESET and CLEAR inputs are invariably both active low (i.e. a 0
on the PRESET input will set the Q output to 1 whereas a 0 on the CLEAR input will set the Q output to 0).
Tables 10.4 and 10.5 summarize the operation of a J-K bistable respectively for the PRESET and CLEAR
inputs and for clocked operation
ii) When J =0 K =1 and clk = 1; output of NAND gate connected to K will be Q’ and corresponding NAND
gate output will be 0; which RESETs the flip-flop.
iii) When J =1 K = 0 and clk = 1; output of NAND gate connected to J will be Q and corresponding NAND
gate output will be 0; which the SETs the flip-flop.
iv) When J=1 K = 1 and clk = 1;, repeated clock pulses cause the output to turn off-on-off-on-off-on and so
on.
This off-on action is like a toggle switch and is called toggling. Each clock pulse toggles the outputs to switch
to their opposite states.
In the next clock pulse, the outputs will switch or “toggle” from set (Q=1 and Q’=0) to reset (Q=0 and Q’=1).
Conversely, a “reset” state inhibits input K so that the flip-flop acts as if J=1 and K=0 when in fact both are 1.
Then the next clock pulse toggles the circuit again from reset to set.
Initially when the clock input is applied at the LSB flip-flop i.e.,
1. The output QA will change from 0 to 1 at the falling edge of the clock pulse. Further QA holds its state 1
and toggles from 1 to 0 only when another falling edge of the clock input is received. Again QA toggles
from 0 to 1 at the next falling edge of the input clock pulse.
As we have already discussed that only the first flip-flop is triggered with an external clock signal.
2. So, now the output of flip-flop A will act as the clock input for flip-flop B and the external clock signal
will not be going to affect QB.
3. Further for flip-flop C, the clock input will now be the output of flip-flop B i.e., QB. So, the output QC will
be according to the transition of QB.As we can see in the diagram that first time QC toggles from 0 to 1
only at the first falling edge of QB signal. And maintains the state till it reaches the next falling edge of
QB.
4. Further for flip-flop D, the clock input will now be the output of flip-flop C i.e., QC. So, the output
QD will be according to the transition of QC. As we can see in the diagram that first time QD toggles
from 0 to 1 only at the first falling edge of QC signal.
Figure 10.22 shows the arrangement of a four stage binary counter based on J-K bistables. The timing diagram
for this circuit is shown in Fig. 10.23.
Each stage successively divides the clock input signal by a factor of two. Note that a logic 1 input is transferred
to the respective Q-output on the falling edge of the clock pulse and all J and K inputs must be taken to logic 1
to enable binary counting.
Four Stage Shift Register Based On J-K Bistables.
Figure 10.24 how the arrangement of a four stage shift register based on J-K bistables. The timing diagram for
this circuit is shown in Fig. 10.25. Note that each stage successively feeds data to the next stage. Note that all
data transfer occurs on the falling edge of the clock pulse.
Example 10.4: A logic arrangement has to be designed so that it produces the pulse train shown in Fig. 10.27.
Devise a logic circuit arrangement that will generate this pulse train from a regular square wave input.
Problems
10.1 Show how a four-input AND gate can be made from three two-input AND gates.
10.2 Show how a four-input OR gate can be made from three two-input OR gates.
10.3 Construct the truth table for the logic gate arrangement shown in Fig. 10.37.
10.4 Using only two-input NAND gates, show how each of the following logical functions can be satisfied: (a)
two-input AND; (b) two-input OR; (c) four-input AND. In each case, use the minimum number of gates. (Hint:
a two-input NAND gate can be made into an inverter by connecting its two inputs together)
10.13 With the aid of a diagram, explain how a three-stage binary counter can be built using J-K bistables
10.14 With the aid of a diagram, explain how a three-stage shift register can be built using J-K bistables