You are on page 1of 14

Boolean Algebra and Logic Gates

Ranga Rodrigo

July 5, 2009

Outline

Contents
1 Introduction 1
1.1 Manual Building of Digital Systems . . . . . . . . . . . . . . . . . . . . . 2
1.2 HDL Building of Digital Systems . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Digital Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Binary Numbers 3
2.1 Numbers with Different Bases . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Complements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3 Binary Logic 6
3.1 Logic Gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

4 Boolean Algebra and Logic Gates 7


4.1 Axiomatic Definition of Boolean Algebra . . . . . . . . . . . . . . . . . . 7
4.2 Basic Theorems and Properties of Boolean Algebra . . . . . . . . . . . . 8

5 Boolean Functions 9
5.1 Algebraic Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

6 Canonical and Standard Forms 11


6.1 Minterms and Maxterms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

1 Introduction
In the present information age, digital electronic circuits are the workhorses of al-
most every device that we encounter. Many consumer products, cell phones, MPEG
players, digital cameras, personal digital assistants, GPS devices, use a digital circuit
as their main functional unit.
In this course, we will discuss the fundamentals, the design, and applications of
simple and moderately complex digital circuits. At the end of this course you will be
able to manually design simple combinational and sequential circuits, and design
slightly larger ones using computer-based tools.
In order to achieve this we must learn two design methods

1. Manual digital design, and

1
2. Computer-based design.

In the manual design, we will use truth tables, state transition tables, and such to
express the functional need and simplify them using tools such as Karnaugh maps.
Then we will use gates and flip-flops to realize out designs.
In the computer-based method we will use a hardware description language
(such as Verilog or VHDL) to do the combinational and sequential implementa-
tions, and realize the design using programmable logic devices such as field pro-
grammable grate arrays FPGAs. However, we will stop at the simulation level.

1.1 Manual Building of Digital Systems

1.2 HDL Building of Digital Systems


1.3 Digital Systems
We refer to the present era as the digital age. Digital systems are a part of an everyday
life.
Name a few digital devices and technologies.

2
2 Binary Numbers
A decimal number such as 352 represents a quantity equal to 3 hundreds, 5 tens,
plus 2. 352 is the short-hand notation of what should be written as

3 × 102 + 5 × 101 + 2 × 100 .

The convention is to write only the coefficients. each coefficient is any of the ten dig-
its, 0,1, . . . , 9. The decimal number system is said to be of base, or radix 10, because
it uses 10 digits and and the coefficients are multiplied by powers of 10. The binary
system is a different number system. The coefficients of the binary number system
have only tow possible values: 0 and 1. The first digit (bit) from right represents 20 s
or ones, the second digit represents 21 = 2s, the third digit represents 22 = 4s, and so
on.
Example 1. Convert 1101012 to a decimal number.

Example 2. What is the decimal equivalent of the binary number 1010.112 to a dec-
imal number.

3
2.1 Numbers with Different Bases

2.2 Complements
Complements are used in digital computer to simplify the subtraction operation.
There are two types of complements for each base r system.

Radix complement (r ’s complement). E.g., 2’s complement in binary.

Diminished radix complement ((r − 1)’s complement). E.g., 1’s complement in bi-
nary.

Diminished Radix Complement

4
Given a number N in base r having n digits, the (r − 1)’s complement of N is
defined as (r n − 1) − N . Therefore, 1’s complement of a binary number is obtained
by changing 1s to 0s and 0s to 1s.
Example 3. What is the 1’s complement of the binary number 10110002 ?

Radix Complement
The r ’s complement of an n-digit number N is defined as r n − N for N 6= 0 and
0 for N = 0. Comparing with (r − 1)’s complement, we note that r ’s complement is
obtained by adding 1 to the (r − 1)’s complement, since r n − N = [(r n − 1) − N ] + 1.
Example 4. What is the 10’s complement of the number 01239810 ?

Subtraction with Complements


The subtraction of two n-digit unsigned numbers M − N in the base r can be
done as follows:
1. Ass the minuend M to the r ’s complement of the number N : M + (r n − N ) =
M − N + r n.

2. If M ≥ N , the sum will will produce an end carry r n , which can be discarded.
What is left in the result is M − N .

3. If M < N , the sum does not produce an end carry and is equal to r n − (N − M ),
which is the r ’s complement of (N − M ). To obtain the answer in a familiar
form, take r ’s complement of the sum place a negative sign in front.
Example 5. Using 10’s complement, subtract 72532 − 3250.

5
Example 6. Using 10’s complement, subtract 3250 − 72532.

Example 7. Given the two binary numbers X = 1010100 and Y = 1000011, perform
the subtraction (a) X − Y and (b) Y − X by using 2’s complement.

3 Binary Logic
Binary logic deals with variable that take on two discrete values and with operations
that assume logical meaning(true or false). The binary logic is equivalent to an al-
gebra called boolean algebra. Binary logic consist of binary variables and a set of
logical operations.The variables are designated by letters of the alphabet, such as
A, B,C , x, y, z etc., with each variable having two and only two distinct possible val-
ues: 1 and 0. There are three basic logical operations. AND, OR, AND not.

Truth tables of logical operations

6
3.1 Logic Gates
Logic gates are electronic circuits that operate on one or more input signals to pro-
duce an output signals interpreted to be either 0 or 1 and produce an output signal
of similar kind. In reality, however, these signals are wither voltages or currents.
Therefore,a range of values is defined as logic zero and a different range as logic 1.

4 Boolean Algebra and Logic Gates


Using simple and cheaper and equivalent realizations of a digital circuit is impor-
tant. Mathematical methods that simplify circuits rely primarily on Boolean alge-
bra.

4.1 Axiomatic Definition of Boolean Algebra


In 1854, George Boole developed an algebraic system now called Boolean algebra.
In 1938, C. E. Shannon introduced a two-valued Boolean algebra called switching
algebra. Boolean algebra is an algebraic structure defined by a set of elements, B ,

7
together with two binary operators, + and ·, provided that the following (Hunting-
ton) postulates are satisfied:

1. (a) The structure is called with respect to the operator +. (b) The structure is
called with respect to the operator ·.

2. (a) The element 0 is an identity element with respect to +; that is, x +0 = 0+x =
x. (b) The element 1 is an identity element with respect to ·; that is, x ·1 = 1·x =
x.

3. (a) The structure is commutative with respect to +; that is, x + y = y + x. (b)


The structure is commutative with respect to ·; that is, x · y = y · x.

4. (a) The operator · is distributive over +; that is, x · (y + z) = (x · y) + (x · z). (b)


The operator + is distributive over ·; that is, x + (y · z) = (x + y) · (x + z).

5. For every element x ∈ B , there exists an element x 0 ∈ B (called the complement


of x) such that (a) x + x 00 = 1 and (b) x · x 0 = 0.

6. There exist at least two elements x, y ∈ B such that x 6= y.

There are the differences compared to arithmetic and ordinary algebra.

1. Huntington postulates do not include the associative law. However this law
holds for Boolean algebra and can be derived (for both operators) from the
order postulates.

2. The distributive law of + over · (i.e., x + (y · z) = (x + y) · (x + z), is valid for


Boolean algebra, but not for ordinary algebra.

3. Boolean algebra does not have additive multiplicative inverses; therefore, there
are no subtraction or division operations.

4. Aforementioned postulate 5 defines an operator called complement that is not


available in ordinary algebra.

4.2 Basic Theorems and Properties of Boolean Algebra


The important property of Boolean algebra called the duality principle states that
every algebraic expression deducible from the postulates of Boolean algebra remain
valid if the operators and identity elements are interchanged. If the dual of any al-
gebraic expression is desired, we simply interchange OR and AND operations and
replace 1s by 0s and 0s by 1s.

Postulates and Theorems of Boolean Algebra

8
5 Boolean Functions
Boolean algebra is an algebra that deals with binary variables and logic operations. A
Boolean function described by an algebraic expression consists of binary variables,
the constants 0 and 1, and the logic operations symbols. For a given value of bi-
nary variable, the function can be equal to either 0 or 1. A Boolean function can be
represented in a truth table uniquely. However, the algebraic representation is not
unique, that is, the same function can be expressed in a variety of ways, but equiv-
alent in logic. A Boolean function can be transformed from an algebraic expression
into a circuit diagram composed of logic gates.
Example 8. In regard to the following Boolean functions, give the truth table and the
circuit:

F 1 = x + y 0 z,
F2 = x 0 y 0 z + x 0 y z + x y 0 .

5.1 Algebraic Manipulation


When a Boolean expression is implemented with logic gates, each term requires a
gate and each variable within the term designates an input to the gate. We define a
literal to be a single variable within a term, in complemented or non-complemented
form. The function F 2 = x 0 y 0 z + x 0 y z + x y 0 has three terms and eight literals, and
F 3 = x 0 z + x y 0 has two terms are four literals. By reducing the number of terms, the
number of literals, or both in a Boolean expression, it is often possible to obtain a
simpler circuit.

9
Example 9. Simplify the following Boolean functions to a minimum number of lit-
erals.

F 1 = x(x 0 + y),
F 2 = x + x 0 y,
F 3 = (x + y)(x + y 0 ),
F 4 = x y + x 0 z + y z,
F 5 = (x + y)(x 0 + z)(y + z).

10
Example 10. Find the complements of the following Boolean functions.

F 1 = x 0 y z 0 + x 0 y 0 z,
F 2 = x(y 0 z 0 + y z).

A simpler way to for obtaining the complement of a function is to take the dual
of the function and complement each literal.

6 Canonical and Standard Forms


6.1 Minterms and Maxterms
A binary variable may appear wither in its normal form or in its complement form.
If we combine two binary variables with an AND operation, There are four possible
combinations: x 0 y 0 , x 0 y, x y 0 , x y. Each of these four AND terms is called a minterm
or a standard product. In a similar manner, n variables can be combined to form 2n
minterms. Table below shows the minterms for three variables. In a similar fashion,
n variables forming OR terms, with each variable being primed or unprimed provide
2n possible combinations called maxterms. The table shows the eight maxterms for
three variables together with symbolic designations.

Minterms and Maxterms for Three Binary Variables

11
x y z Term Designation Term Designation
0 0 0 x0 y 0z0 m0 x +y +z M0
0 0 1 x0 y 0z m1 x + y + z0 M2
.. .. .. .. .. ..
. . . . . .

It is important to note that each maxterm is obtained from an or term or a vari-


able, with each variable being unprimed if the corresponding bit is a 0 and primed
if the corresponding bit is a 1, and each maxterm is the complement of its minterm
and vise-versa.
A Boolean function can be expressed algebraically from a given truth table by
forming a minterm for each combination of the variables that produce a 1 in and
then taking the OR combination of all those terms.
Example 11. Express the functions defined by the following truth table using minterms.
x y z f1 f2
0 0 0 0 0
0 0 1 1 0
0 1 0 0 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

12
As the aforementioned example shows, any Boolean fucntion can be expressed
as a sum (ORing) of minterms. Now consider the complement of a Boolean function.
It may be read form the truth table by forming a minterm for each combination that
produces a 0 in the function and then ORing those terms. The complement of f 1 is
read as

As demonstrated by the example any Boolean function can be expressed as a


product (ANDing) of maxterms. Product of maxterms can be directly obtained from
the truth table by forming a maxterm for each combination of the variable that pro-
duces a 0 in the function and then forming the AND of all those maxterms. Boolean
functions expressed as a sum of minterms or a product of maxterms are said to be
in canonical form.
Example 12. Express the Boolean function F = A + B 0C as a sum of minterms.

13
An alternative way is to use the truth table.
Example 13. Express the Boolean function F = x y + x 0 z as a product of maxterms.

14

You might also like