Combinatorial Logic
Combinatorial Logic
Combinatorial Logic
Objectives:
1. Ability to read simple logic diagrams
2. Ability to design simple combinatorial circuits
3. To introduce basic building blocks of more complex systems
Materials:
1. Samples of logic technologies
2. Projectable of logic axioms
3. Circuit Sandbox for demos - including prebuilt circuits - Inverter, Two Input
Gates, 4 Input NAND, A xor BC (five parts), 4 bit adder, decoder, demux, mux
4. Setup with scope, etc. to demonstrate physical properties of gates (needed for
final session devoted to this topic)
I. Introduction
A. From physics we learn that all the complexity of the universe is built up
from combinations of certain fundamental building blocks: electrons,
protons, neutrons (or quarks if you will.) In like manner, all the
complexity of digital computers is built up from fundamental building
blocks called GATES.
1. A gate is an electronic circuit having one or more inputs and one output,
each of which can be in one of two states, commonly called 0 and 1.
Further, the output at any time is some function of the inputs.
2. Gates can be realized in many different ways, but we will say little
about this. We should note that the generations of computer hardware
are largely distinguished by the technology used to realize gates: relays
(0); vacuum tubes (1); transistors (2); integrated circuits (3); very large
scale integration (4). With all pre-IC technologies, a gate would consist
of a number of discrete components wired together on a circuit board
(cf sample transistor board); with IC technologies, one or more gates
are completely contained on a silicon chip. With todays technology,
we may have one chip containing millions of gates.
B. For our purposes, we will think of a gate as a black box having one
or more inputs plus a single output.
1. The voltage at the output of the gate is some function of the input
voltages.
2. Example: a two-input gate
Vin1
Vout = f(Vin1, Vin2)
Vin2
3. Gates are designed so that they respond to two discrete voltages one of which is associated with the value 0 (false) and the other
with the value 1 (true). With the kinds of gates we will be be using
in lab (TTL and CMOS), the value 0 (as input or output) will
normally be represented by a voltage level close to 0. The value 1
will normally be represented by a voltage level of about 5 volts. (In
more recent computers, the there has a been a trend to use a lower
power supply voltage - and hence lower value for 1 - to conserve
power - e.g. 3.3 to as low as 1.2 Volts).
4. In actual practice, any gate technology will accept a RANGE of
voltages for each logic value. For example, with TTL gates of the
kind we will be using in lab, the following rules hold:
a) Any voltage between 0 and 0.8 Volts is regarded as low, and is
interpreted as a zero.
b) Any voltage between 2 and 5 volts is regarded as high, and is
interpreted as a one.
c) Any voltage between 0.8 and 2 volts, or if an input is not
connected at all, constitutes an undefined input. The output of
any gate which has any undefined input can be 0, 1, or
undefined itself. (This may be represented by the symbol "X")
B
Inputs
B
A
0
0
0
1
1
0
1
1
Output
Y
0
0
0
1
1. Note that for a gate with 1 input there are 4 possible truth tables,
representing:
- a gate whose output is always 0, regardless of input
- a gate whose output is always 1, regardless of input
- a gate whose output is the same as its input
- a gate whose output is the opposite of its input:
A
Input
A
0
1
Output
Y
1
0
Of these, only the last two are of any interest at all, and he last one
is most useful. (The first two are sometimes called stuck at 0 and
stuck at 1, and typically arise from a gate being defective for
some reason.)
a) The gate whose output is the same as its input is often used in
situations where it is necessary to amplify a signal to drive a
number of gates. Such a device is called a BUFFER:
symbol:
b) The gate whose output is the opposite of its input is called an
INVERTER. Two symbols can be used for this function:
or
Note use of the "bubble" to symbolize inversion of the logic
sense. In the first case, the symbolism is that the output of the
gate is the opposite of that from a simple buffer. In the second
case, the symbolism is that the output of the gate is the same as
that of a simple buffer whose input has been inverted.
Obviously, the two symbols describe two ways of looking at
the SAME BEHAVIOR, and so can be used interchangeably to
describe the same physical circuit.
DEMONSTRATE (File Inverter)
2. For a gate with 2 inputs, there would be 16 possible truth tables.
(For each of the 4 combinations of the 2 inputs, we could choose
one of two outputs. Thus, there are 24 possible truth tables.
Again, only a limited number are of interest - we defer discussion
until later.)
3. In general, for a gate with n inputs, how many truth tables are
possible?
There are 22n possible truth tables - e.g. for 3 inputs there are 223
= 28 = 256 possible truth tables.
A'
0
1
1
A+ B
0
0
1
1
0
1
0
1
0
1
1
1
Note: 1 + 1 = 1!
B
0
1
0
1
A B
0
0
0
1
A'
AB
A'+AB
0
0
1
1
0
1
0
1
1
1
0
0
0
0
0
1
1
1
0
1
C. As in other algebras, there are certain properties that govern the behavior
of more complicated expressions, such as associativity, commutativity, and
distributivity. However, whereas these are axioms for most algebraic
systems, for boolean algebra they are theorems since any one of them can
be proved from the definitions above by exhaustion (perfect induction).
Here are some of the key properties:
(Note: there are several others that appear in the book but are omitted here)
PROJECT`
A, B, C:
Identity:
A 1 = 1 A=A
A+ 0 =0 +A=A
Null Element:
A 0 = 0 A= 0
A+ 1 =1 +A= 1
Idempotence:
A+A=A
AA=A
Involution:
(A')' = A
Complements:
A A' = 0
A + A' = 1
Commutativity:
A+ B = B +A
A B = BA
Associativity:
A + (B + C) = (A + B) + C
A (B C) = (A B) C
Distributivity:
A (B + C) = (A B) + (A C)
A + (B C) = (A + B) (A + C) !!
Demorgan's
Theorems:
A+B (A+B)'
A'
B'
A'B'
0
0
1
1
0
1
0
1
0
1
1
1
1
1
0
0
1
0
1
0
1
0
0
0
1
0
0
0
Notice that, for all possible values of A and B, the (A+B)' and A'B'
columns are the same - implying that (A+B)' = A'B' for all A and B
III. Realization of Boolean Functions - Basic Types of Gates
A. Crucial to the design of computer systems is the ability to realize
circuits composed of gates whose output corresponds to some boolean
function of its inputs. To do this, we usually use certain types of gates
as building blocks, with more complex functions realized by
combinations of gates in which the output of one gate becomes an
input to another.
B. While we could theoretically implement any truth table as a hardware
primitive, most designs are built around a limited number of basic
functions implemented in hardware. We have met one already, the
inverter. Two-input functions of interest include:
1. 2-input AND:
A
Y
B
Y=A B
2. 2-input OR:
A
Y
Y=A+B
3. 2-input NAND:
A
Y
B
Y = (A B)'
4. 2-input NOR:
A
Y
B
Y = (A + B)'
Y = (A A)' = A'
(2) AND realized using NAND:
A
Y
B
Y = ((A B)')' = A B
10
Y = (A' B')' = A + B
(by DeMorgan's theorem)
11
C. Two other functions of two inputs are of some interest, though less
than the previous four
1. 2-input XOR:
A
Y
Y=A B
Truth table:
0
0
1
1
0
1
0
1
0
1
1
0
Y = (A B)'
Truth table:
0
0
1
1
0
1
0
1
1
0
0
1
12
3. Both can be realized using other types of gates. For example, the
following is a realization of XOR using NAND - assuming that
both the inputs and their complements are available. (If not, two
inverters would also be needed - however, for reasons we will see
later, it is often that case that both the uncomplemented and
complemented form of each input are readily available).
A
B
Y
A
B
B
C
D
Truth Table:
13
E.
A B C D Z
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
14
0
0
0
0
1
1
1
1
0
0
0
1
1
1
1
0
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1. Find each row in the truth table where the output is 1. This will
contribute one term to the sum. Thus, this function can be
represented as a sum of four products:
2. Each product will contain each of the inputs either plain or
complemented. An input will appear plain if the row in question
contains a value of 1 for that input, and complemented if it
contains a 0. Thus, the fourth row in the truth table (the first
containing a 1 output) gives rise to the term A'BC.
A term that is the product of the true or complemented form of all
the inputs is called a minterm.
15
16
17
This involves both fewer gates and simpler gates, and so would
be easier to build from SSI chips (as we will do in lab) or on a
VLSI integrated circuit.
E. For functions of four variables or less, this simplification can be done
simply by the use of a Karnaugh map.
1. Example, for the above:
AB/C
00
01
11
10
0
1
0
1
0
0
1
1
00 01
11
00
01
11
10
1
1
0
1
0
0
0
1
1
1
0
1
0
0
0
1
10
2s that cover two adjacent squares horizontally or vertically including ones that wrap around top and bottom or left and right
4. The method works because the values are ordered in such a way that any
two horizontally or vertically adjacent entries differ in exactly one input,
whose value is irrelevant if both squares contain a 1.
5. In setting up functions to be minimized using a Karnaugh map, it is often
helpful to use a different notation for the function. Basically, we
represent each 1 of the function by a decimal number that is the
equivalent of the binary number representing the values of the inputs.
a) Example: Y = A'B'CD + AB'C'D can be written
Y(A,B,C,D) = (3, 9)
because A'B'CD corresponds to an input pattern of 0011 =
decimal 3 and AB'C'D corresponds to an input pattern of 1001
= decimal 9
b) In doing this, one must be sure to include all the variables in
each term.
Example: Y = A'CD + ABC
must be written as Y = A'B'CD + A'BCD + ABCD' + ABCD
which yields (3, 7, 14, 15)
F. Often, in designing a logic circuit, it happens that certain input
patterns are known to not be possible. Thus, the output produced for
these patterns is irrelevant. We refer to this as a don't care condition.
1. Example: a 7-segment decoder translates the binary representation of
a decimal digit into 7 outputs corresponding to the 7 segments of an
LED display. Consider just the output for the bottom bar:
19
01 11 10
00
01
11
10
0
1
d
0
1
0
d
1
1
0
d
d
1
1
d
d
01 11 10
00
01
11
10
0
1
d
0
1
0
d
1
1
0
d
d
1
1
d
d
20
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
0
This yields a product of sums form in which each factor is zero for just
one row of the truth table; of course, the overall function is zero just
when any factor is zero, and one when all the factors are one:
Y = (A + B + C)(A + B + C')(A + B' + C)(A' + B' + C')
2. We can realize with a product of sums with one NOR gate for each
factor plus one NOR (drawn in dual form) to multiply all factors.
DEMONSTRATE: Fifth part of A xor BC file
3. We can also use Karnaugh-map minimization, we covering the
ZEROES, and put the variable in the expression in straight form if
it is a zero and complemented if it is a one.
21
0
0
1
1
0
1
0
1
22
23
A one out of 4 decoder could process these two bits to select one
of the 4 drives:
drive
select
bits in
command
drive
drive
drive
drive
0
1
2
3
24
a) Note that the selected output is low (0), and the other three outputs
are high (1). This is an example of negative logic. Decoders are
typically designed this way because a level of inversion is inherent
in the typical transistor circuits used to implement gates.
b) Devices that are designed to be used with decoders (eg memory
chips) often have active low enable inputs as a result.
B. A circuit that is very similar to a decoder is a demultiplexer.
1. A demultiplexer has one additional input (often called enable).
When enable is active, the device functions just like a decoder; but
when enable is inactive, none of the outputs is selected.
2. One place where demultiplexers are useful is when chaining
decoders together to produce a bigger decoder - e.g. a 1 out of 16
decoder (4 selection inputs, 16 outputs) might be made using 5 1
out of 4 demultiplexers - with one used to select which of the other
four is enabled, based on two bits of the selection value, with the
other two bits going to all four of the other demultiplexers.
3. A demultiplexer uses the same circuit as a decoder, but with one
extra input to each gate - called "enable".
25
26
add contents of B
add contents of C
add contents of D
add contents of E
add contents of H
add contents of L
add contents of a memory location
This can be implemented by using one MUX per bit, with the
selection inputs tied to the appropriate field of the instruction
register.
to adder input7
to adder input6
B7
(from bits
6..2)
to adder input1
to adder input0
B6
B1
B0
C7
C6
C1
C0
D7
D6
D1
D0
E7
E6
E1
E0
H7
H6
H1
H0
L7
L6
L1
L0
mem7
mem6
mem1
mem0
A7
A6
A1
A0
(to bits
6..2)
27
data
output
data
input 2
data
input 3
28
0
0
0
0
1
1
1
1
0
0
0
1
1
1
1
0
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
A B C
VII.Full Adders
A. One example of such a building-block is called a full adder.
Note that the boolean or operation, represented by +, is not the same as
addition. For example, 1 + 1 = 1 if + means or, but 10 if it means add.
B. To perform arithmetic addition, we use a building block known as a
full adder. This has two outputs (sum plus carry) and three inputs
(two bits to be added, plus a carry in from the previous bit). The
symbol that is typically used is:
A
B
Cin
Cout
Cin
Cout
0
0
0
0
0
(The sum is 1 if an odd number of
0
0
1
1
0
inputs are 1; the carry is 1 if at
0
1
0
1
0
least two of the inputs are 1)
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
C. The following equations describe the two outputs as functions of the
inputs:
= A B Cin
Cout = AB + (A + B)Cin
(+ = or)
30
Cout (overall)
A2
B2
A1
B1
A0
B0
0
0
31
32
34
inputs of 8 gates
inputs of 8 gates
inputs of 8 gates
D. Propagation Delay
1. In our ideal description of gates, we assumed that the output at any
point in time reflects the inputs at that same time. In reality, as
physical devices, all gates exhibit a finite propagation delay, such
that when the input changes, the corresponding change at the
output occurs some amount of time later.
Example: the typical propagation delay for TTL gates of the sort
we are using in lab is about 10 ns.
2. Of course, when gates are interconnected in such a way that the
output of one gate is connected to the input of another, the overall
propagation delay for a network is the sum of the propagation
delays down the longest (in terms of time) path from input to
output in the network.
Example: consider the full adder we looked at earlier:
35
Suppose that the propagation delays for the and and or gates are
0.1 ns each, while that for the xors is 0.2 ns. (XOR requires a
more complex circuit). Then the delay from A or B to Cout is
max(0.1 + 0.1 ns, 0.2 + 0.1 + 0.1 ns) = max (0.2, 0.4 ns) = 0.4 ns.
3. This delay is very important; it is, in fact, one of the key factors in
determining how fast a digital system can run.
Example: Suppose a CPU is designed to run at 2 GHz. Then the
worst-case propagation delay down any path must be less than
1 / (2 GHz) = 1 / (2 x 109 sec-1) = 0.5 x 10-9 sec = 0.5 ns. If all
gates in the system have the same propagation delay, and the the
longest path in the system involves 10 gates, then an individual
gates propagation delay must be less that 0.05 ns.
4. As you know, CPU clock speeds have increased dramatically in
your life time (by a factor of better than 1000 : 1). This has been
made possible, in part, by a dramatic decrease in propagation delay
due to technological improvements. (There have also been
reductions due to techniques that have shortened the longest path)
Example: One could not build a 2 GHz CPU using TTL gates of
the sort we are using in lab, since the typical propagation delay for
36
37