Computing Boolean Algebra
Computing Boolean Algebra
Certificate in IT BCS(2009-10)
Muhammed Jehanzaib Sultan
1
Boolean Algebra
Boolean algebra is an algebra for the
manipulation of objects that can take on only two
values, typically true and false, although it can
be any pair of values. Because computers are
built as collections of switches that are either
“on” or “off,”
Boolean algebra is a very natural way to
represent digital information. In reality, digital
circuits use low and high voltages, but for our
level of understanding, 0 and 1 will suffice. It is
common to interpret the digital value 0 as false
and the digital value 1 as true.
2
Boolean Expressions
In addition to binary objects, Boolean
algebra also has operations that can be
performed on these objects, or variables.
Combining the variables and operators
yields Boolean expressions. A Boolean
function typically has one or more input
values and yields a result, based on these
input values, in the range {0,1}.
3
Boolean Operators
Three common Boolean operators are:
1. AND operator
2. OR operator
3. NOT operator
4
Truth Table
A Boolean operator can be completely
described using a table that lists the
inputs, all possible values for these inputs,
and the resulting values of the operation
for all possible combinations of these
inputs. This table is called a truth table.
5
Truth Table for AND Operator
• AND is typically represented
by either a dot or Inputs Outputs
no symbol at all x y xy
• The Boolean expression 0 0 0
xy is equivalent to the 0 1 0
1 0 0
expression x · y and
1 1 1
is read “x and y.”
6
Truth Table
7
NAND Gate (Usage)
8
NOR Gate (Usage)
9
Implementation of Boolean
Functions
• Any Boolean function can be implemented in
electronic form as a network of gates. For any
given function, there are a number of alternative
realizations. Consider the Boolean function
represented by the truth table above. We can
express this function by simply itemizing the
combinations of values of A, B, and C that cause
F to be 1:
10
Implementation of Boolean
Functions
• There are three combination of input
values that cause F to be 1, and if any one
of these combination occurs, the result is
1. this form of expression, for self-evident
reasons is known as the sum of products
(SOP) form.
11
Boolean function of three variables
12
Sum of Products implementation
(Graphical Gates representation)
13
Integrated Circuits
• Integrated Circuits
Computers are composed of various digital
components, connected by wires. Like a good program,
the actual hardware of a computer uses collections of
gates to create larger modules, which, in turn, are used
to implement various functions. The number of gates
required to create these “building blocks” depends on the
technology being used.
Typically, gates are not sold individually; they are
sold in units called integrated circuits (ICs). A chip (a
small silicon semiconductor crystal) is a small electronic
device consisting of the necessary electronic
components (transistors, resistors, and capacitors) to
implement various gates.
14
Integrated Circuits …contd
Components are etched directly on the chip,
allowing them to be smaller and to require less power for
operation than their discrete component counterparts.
This chip is then mounted in a ceramic or plastic
container with external pins. The necessary connections
are welded from the chip to the external pins to form an
IC. The first ICs contained very few transistors. The first
ICs were called SSI* chips and contained up to 100
electronic components per chip. We now have ULSI
(ultra large-scale integration) with more than 1 million
electronic components per chip.
15
Combination Circuit
• A combinational circuit is of set of gates whose
output at any time is a function only of the input
at that time.
• As with a single gate, the appearance of the
input is followed almost immediately by the
appearance of the output, with only gate delays.
• Gate Delays: The propagation time of signals
through the gate.
• In general terms, a combinational circuit consist
of n binary inputs and m binary outputs.
16
Combination Circuits ….contd
• As with a gate, combinational circuit can be
defined in three ways:
1. Truth Table: For each of the 2n possible
combination of input signals, the binary value
of each of the m output signals is listed.
2. Graphical Symbols: The interconnected layout
of gates is depicted.
3. Boolean Equations: Each output signal is
expressed as a Boolean function of its input
signals.
17
Simple SSI Circuit
18
Half Adder
The half-adder is a very simple circuit and not really very
useful because it can only add two bits together.
19
Half Adder
20
Full Adder
However, we can extend this adder to a circuit that allows
the addition of larger binary numbers.
21
Full Adder ….contd
Given this full-adder, you may be wondering how this circuit
can add binary numbers, since it is capable of adding only three
bits. The answer is, it can’t. However, we can build an adder
capable of adding two 16-bit words, for example, by replicating the
above circuit 16 times, feeding the Carry Out of one circuit into the
Carry In of the circuit immediately to its left. This type of circuit is
called a ripple-carry adder because of the sequential generation of
carries that “ripple” through the adder stages. Note that instead of
drawing all the gates that constitute a full-adder, we use a black box
approach to depict our adder. A black box approach allows us to
ignore the details of the actual gates. We concern ourselves only
with the inputs and outputs of the circuit. This is typically done with
most circuits, including decoders, multiplexers, and adders, as we
shall see very soon.
22
Full Adder ….contd
Because this adder is very slow, it is not
normally implemented. However, it is easy to
understand and should give you some idea of
how addition of larger binary numbers can be
achieved. Modifications made to adder designs
have resulted in the carry-look-ahead adder, the
carry-select adder, and the carry-save adder, as
well as others. Each attempts to shorten the
delay required to add two binary numbers.
23
Truth Table and Logic Diagram of a
Full Adder
24
Logic Diagram for a Ripple Carry
25
Decoder
In fact, these newer adders achieve speeds 40% to 90% faster
than the ripple- carry adder by performing additions in parallel and
reducing the maximum carry path.
26
Decoder
We mentioned that this decoder is something the
computer uses frequently. At this point, you can probably name
many arithmetic operations the computer must be able to
perform, but you might find it difficult to propose an example of
decoding. If so, it is because you are not familiar with how a
computer accesses memory.
29
Example …contd
When a computer is given an address, it must first
determine which chip to use; then it must find the actual
address on that specific chip. In our example, the
computer would use the 3 leftmost bits to pick the chip
and then find the address on the chip using the
remaining 13 bits. These 3 high-order bits are actually
used as the inputs to a decoder so the computer can
determine which chip to activate for reading or writing. If
the first 3 bits are 000, chip 0 should be activated. If the
first 3 bits are 111, chip 7 should be activated. Which
chip would be activated if the first 3 bits were 010? It
would be chip 2. Turning on a specific wire activates a
chip. The output of the decoder is used to activate one,
and only one, chip as the addresses are decoded.
30