Sunteți pe pagina 1din 26

LOGIC GATES AND

BOOLEAN ALGEBRA
O/L ICT
A/L GIT

Dasun Nilanjana BIT-HDIT,MIEEE


Introduction
Boolean functions may be practically implemented by using electronic gates. The
following points are important to understand.
Electronic gates require a power supply.
Gate INPUTS are driven by voltages having two nominal values, e.g. 0V and 5V
representing logic 0 and logic 1 respectively.
The OUTPUT of a gate provides two nominal values of voltage only, e.g. 0V and 5V
representing logic 0 and logic 1 respectively. In general, there is only one output to a
logic gate except in some special cases.
There is always a time delay between an input being applied and the output responding.

Dasun Nilanjana (BIT-HDIT,MIEEE)


LOGIC GATES

Logic generally has only 2 states, ON or The AND gate will only switch on its output Q,
OFF, represented by 1 or 0. Logic gates if Input A is ON and Input B is ON. This can be
react to inputs in certain ways. shown in a Truth Table, 0=OFF and 1=ON.

A B Q
INPUT A 0 0 0
OUTPUT Q 0 1 0
INPUT B
1 0 0
1 1 1
Symbol for AND gate

Logic can be used to control devices according to certain conditions, such as “switch on a fan if it’s hot
AND the sun is out”. Look at the diagrams below.

If both inputs are OFF Even if one input is ON Only if A =1 and B =1


the output is OFF the output is OFF will the output switch on

Dasun Nilanjana (BIT-HDIT,MIEEE)


Logic gates
Digital systems are said to be constructed by using logic gates. These gates are the
AND, OR, NOT, NAND, NOR, EXOR and EXNOR gates. The basic operations are
described below with the aid of truth tables.

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. A.B.
Bear in mind that this dot is sometimes omitted
i.e. AB

Dasun Nilanjana (BIT-HDIT,MIEEE)


AN D

A
Logic Gate: A*B Truth Table:
B

A B A*B
0 0 0
0 1 0
A B 1 0 0
Series Circuit: 1 1 1

A*B

Dasun Nilanjana (BIT-HDIT,MIEEE)


Dasun Nilanjana (BIT-HDIT,MIEEE)
OR Ga t e

A
Logic Gate: A+B Truth Table:
B

A B A+B
A
0 0 0
0 1 1
1 0 1
Parallel Circuit: 1 1 1
B

A+B

Dasun Nilanjana (BIT-HDIT,MIEEE)


Dasun Nilanjana (BIT-HDIT,MIEEE)
Dasun Nilanjana (BIT-HDIT,MIEEE)
Dasun Nilanjana (BIT-HDIT,MIEEE)
MORE LOGIC GATES
Try and work out the truth tables for these gates. The rule will help you.

AND OR
A XOR
A A
Q Q Q
B B B

RULE: Q = 1 if A AND B =1 RULE: Q = 1 if A OR B =1 Q = 1 if A OR B =1, but NOT both

A B Q A B Q A B Q
0 0 0 0 0 0
0 1 0 1 0 1
1 0 1 0 1 0
1 1 1 1 1 1

NAND NOR NOT


A A
Q Q A Q
B B

RULE: Q = 0 if A AND B =1 RULE: Q = 0 if A OR B =1 RULE: Q = 0 if A =1

A B Q A B Q A Q
0 0 0 0 0
0 1 0 1 1
1 0 1 0
1 1 1 1

Dasun Nilanjana (BIT-HDIT,MIEEE)


LOGIC GATES
AND OR
A XOR
A A
Q Q Q
B B B

RULE: Q = 1 if A AND B =1 RULE: Q = 1 if A OR B =1 Q = 1 if A OR B =1, but NOT both

A B Q A B Q A B Q
0 0 0 0 0 0 0 0 0
0 1 0 0 1 1 0 1 1
1 0 0 1 0 1 1 0 1
1 1 1 1 1 1 1 1 0

NAND NOR NOT


A A
Q Q A Q
B B

RULE: Q = 0 if A AND B =1 RULE: Q = 0 if A OR B =1 RULE: Q = 0 if A =1

A B Q A B Q A Q
0 0 1 0 0 1 0 1
0 1 1 0 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 0
Dasun Nilanjana (BIT-HDIT,MIEEE)
n-b it In p u t s
Fo r c o n ve n ie n c e , it is s o m e t im e s u s e fu l t o
t h in k o f t h e lo g ic g a t e s p ro c e s s in g n-b it s a t
a t im e . Th is re a lly re fe rs t o n in s t a n c e s o f
t h e lo g ic g a t e , n o t a s in g le lo g ic d a t e wit h n-
in p u t s .
1101100101
1101110111
0100110111

10001111
00001100
00111100

110001 001110

Dasun Nilanjana (BIT-HDIT,MIEEE)


NAND and NOR as Universal Logic Gates
An y lo g ic c irc u it
c a n b e b u ilt
u s in g o n ly
NAND g a t e s , o r
o n ly NOR
g a t e s . Th e y
a re t h e o n ly
lo g ic g a t e
needed.
He re a re t h e

NAND
e q u iva le n t s :

Dasun Nilanjana (BIT-HDIT,MIEEE)


NAND and NOR as Universal Logic Gates (cont)

He re a re t h e
NOR
e q u iva le n t s :
NAND a n d NOR

ca n be use d to
re d u c e t h e
num be r of
re q u ire d g a t e s
in a c irc u it .

Dasun Nilanjana (BIT-HDIT,MIEEE)


3-13 Alternate Logic-Gate
Representations
St a n d a rd a n d a lt e rn a t e s ym b o ls fo r
va rio u s lo g ic g a t e s a n d in ve rt e r.

Dasun Nilanjana (BIT-HDIT,MIEEE)


3-6 Describing logic circuits
algebraically
An y lo g ic c irc u it , n o m a t t e r h o w
c o m p le x, c a n b e c o m p le t e ly d e s c rib e d
u s in g t h e t h re e b a s ic Bo o le a n
o p e ra t io n s : OR, AND, NOT.
Exa m p le : lo g ic c irc u it wit h it s Bo o le a n

e xp re s s io n

Dasun Nilanjana (BIT-HDIT,MIEEE)


Parentheses
(Often needed to establish precedence;
sometimes used optionally for clarity)

Ho w t o in t e rp re t A B+ C?
Is it AB ORed with C ?
Is it A ANDed with B+C ?
Order of precedence for Boolean algebra: AND
before OR. Parentheses make the expression
clearer, but they are not needed for the case on
the preceding slide.

Note that parentheses are needed here :


Dasun Nilanjana (BIT-HDIT,MIEEE)
Precedence

Firs t , p e rfo rm a ll in ve rs io n s o f s in g le
t e rm s
Pe rfo rm a ll o p e ra t io n s wit h p a re t h e s e s

Pe rfo rm a n AND o p e ra t io n b e fo re a n OR

o p e ra t io n u n le s s p a re n t h e s e s in d ic a t e
o t h e rwis e
If a n e xp re s s io n h a s a b a r o ve r it ,

p e rfo rm t h e o p e ra t io n s in s id e t h e
e xp re s s io n firs t a n d t h e n in ve rt t h e
re s u lt
Dasun Nilanjana (BIT-HDIT,MIEEE)
3-8 Implementing Circuits
From Boolean Expressions
Wh e n t h e o p e ra t io n o f a c irc u it is
d e fin e d b y a Bo o le a n e xp re s s io n , we
c a n draw a logic-circuit d ia g ra m d ire c t ly
from that expression.

Dasun Nilanjana (BIT-HDIT,MIEEE)


Example

Dra w t h e c irc u it d ia g ra m t o im p le m e n t
t h e e xp re s s io n
x =( A +B )( B +C)

Dasun Nilanjana (BIT-HDIT,MIEEE)


3-10 Boolean Theorems
(single-variable)

Dasun Nilanjana (BIT-HDIT,MIEEE)


Multivariable Theorems

Dasun Nilanjana (BIT-HDIT,MIEEE)


Proof by using Truth tables

Dasun Nilanjana (BIT-HDIT,MIEEE)


Boolean Algebraic Proof – Example 1
A +A·B=A (Absorption Theorem)
Proof Steps Justification
A+A·B
=A· 1 +A· B Identity element: A · 1 = A
= A · ( 1 + B) Distributive
=A· 1 1+B=1
=A Identity element

Our primary reason for doing proofs is to learn:


Careful and efficient use of the identities and theorems
of Boolean algebra, and
How to choose the appropriate identity or theorem to
apply to make forward progress, irrespective of the
application.

26

S-ar putea să vă placă și