Chapt 4
Chapt 4
Design
Chapter 4
Approaches
Boolean expression approach
Truth table approach
The Problem
How can we convert from a circuit drawing to an
equation or truth table?
Two approaches
Create intermediate equations
Create intermediate truth tables
A
B
C
A
B
C
Out
Out
R = ABC
S=A+B
T = CS
Out = R + T
A
B
C
A
B
C
Out
R = ABC
S=A+B
T = CS = C(A + B)
Out
B
C
A
B
C
Out
A
B
C
Out
T
0
0
1
0
1
0
1
0
R + T = Out
A
B
C
A
B
C
A
0
0
0
0
1
1
1
1
T
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
R
0
0
0
0
0
0
0
1
S
0
0
1
1
1
1
1
1
T
0
0
1
0
1
0
1
0
Out
Out
0
0
1
0
1
0
1
1
Example 2
Step 3: Note labels on interior nodes
Example 2:
Truth Table
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
F2
0
0
0
1
0
1
1
1
F2
1
1
1
0
1
0
0
0
T1
0
1
1
1
1
1
1
1
T2
0
0
0
0
0
0
0
1
T3
0
1
1
0
1
0
0
0
F1
0
1
1
0
1
0
0
1
Design Procedure
Design a circuit from a specification.
1. Determine number of required inputs and
outputs.
2. Derive truth table
3. Obtain simplified Boolean functions
4. Draw logic diagram and verify correctness
A B C RS
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
S = A+ B + C
R = ABC
0 1 1 0 1
1 0 0 0 1
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Design Procedure
Boolean algebra can be used to simplify
expressions, but not obvious:
how to proceed at each step, or
if solution reached is minimal.
0 0 0 0
0 0 0 1
0 0 1 0
0 1 1 1
1 0 0 0
1 0 0 1
a
f
b
c
a,b,c,d,e,f
b,c
a,b,d,e,g
a,b,c,d,g
b,c,f,g
a,c,d,f,g
a,c,d,e,f,g
a,b,c
a,b,c,d,e,f,g
a,b,c,d,f,g
a
f
b
c
Outputs
Dec
w x y z
a b c d e .
0 0 0 0
1 1 1 1 1 .
0 0 0 1
0 1 1 0 0 .
0 0 1 0
1 1 0 1 1 .
.
0 1 1 1
1 1 1 0 0 .
0 0 0
1 1 1 1 1 .
0 0 1
1 1 1 1 0 .
11
10 1
11 X X X X
10 1
X X
Put in X (dont
care), and interpret as
either 1 or 0 as
desired .
11 X X X X
10 1
X X
Fa1 y
00 01 11 10
00 1
01 0
11 X X X X
10 1
X X
Fa2 w
01 0
11 X X X X
11 X X X X
10 1
10 1
X X
Fa3 x z
X X
Fa4 xz
11 X X X X
10 1
X X
F y w x z xz
Outputs
Dec
w x y z
a b c d e .
0 0 0 0
1 1 1 1 1 .
0 0 0 1
0 1 1 0 0 .
0 0 1 0
1 1 0 1 1 .
.
0 1 1 1
1 1 1 0 0 .
0 0 0
1 1 1 1 1 .
0 0 1
1 1 1 1 0 .
11
10 1
See if you
complete this
example.
Hardware features
Create a single-bit adder and chain together
Half Adder
Add two binary numbers
A0 , B0 -> single bit inputs
S0 -> single bit sum
C1 -> carry out
A0
B0
A0 B0 S0 C 1
0
0
1
1
0
1
0
1
0
1
1
0
0
0
0
1
S0
C1
Dec Binary
1
+1
2
1
+1
10
Multiple-bit Addition
Consider single-bit adder for each bit position.
A3 A2 A1 A0
A 0 1 0 1
A
B
1
0
0
1
1
1
1
1
1
0 1
1 1
0 0
B3 B 2 B 1 B 0
B 0 1 1 1
Ci+1
Ci
Ai
+Bi
Si
Full Adder
Full adder includes carry in Ci
Notice interesting pattern in Karnaugh map.
Ci Ai Bi Si Ci+1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
0
1
0
0
0
1
0
1
1
1
AiBi
00
Ci
11
0
1
01
10
1
Si
Full
Add
Full adder includes carry in Ci
er
Alternative to XOR implementation
Ci Ai Bi Si Ci+1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
0
1
0
0
0
1
0
1
1
1
Full
Add
er
Now consider implementation of carry out
Two outputs per full adder bit (Ci+1, Si)
Ci Ai Bi Si Ci+1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
0
1
0
0
0
1
0
1
1
1
AiBi
00
Ci
01
10
0
1
11
Ci+1
Full
Add
Now
er consider implementation of carry out
Minimize circuit for carry out - Ci+1
Ci Ai Bi Si Ci+1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
0
1
0
0
0
1
0
1
1
1
AiBi
00
Ci
01
10
0
1
11
Ci+1
Ci+1 = AiBi + CiBi + CiAi
Full Adder
Ci+1 = AiBi + CiBi + CiAi
Ci+1 = AiBi +Ci (Ai+Bi)
Ci+1 = AiBi +Ci (AiBi+Ai Bi)
Ci+1 = AiBi +Ci (Ai XOR Bi)
As we have:
Si = Ci XOR (Ai XOR Bi)
Ci+1 = AiBi +Ci (Ai XOR Bi)
Full Adder
Full adder made of several half adders
Si = Ci XOR (Ai XOR Bi)
Ci+1 = AiBi +Ci (Ai XOR Bi)
Ci
Ai
Si
Bi
Half-adder
Half-adder
C i+1
Full
Add
Hardware
repetition simplifies hardware design
er
Ci
Ai
Bi
S
half-adder
C
half-adder
Si
C
C i+1
Full
Add
Putting
it all together
er
Single-bit full adder
Common piece of computer hardware
Ai
C i+1
Bi
Full Adder
Si
Block Diagram
Ci
4Bit
Chain
Add single-bit adders together.
er
A3
B3
A2
Full Adder
Full Adder
C3
C4
S3
A1
B2
Full Adder
C2
S1
S2
C
A
B
S
B1
1
0
0
1
1
1
1
1
1
0
1
0
0
1
1
0
A0
C1
B0
Full Adder
S0
4-bit Subtractor: E = 1
A3
B3
A2
B2
A1
B1
A0
B0
E
Full Adder
C
C4
SD 3
Full Adder
3
SD2
Full Adder
C2
Full Adder
C1
SD1
SD 0
+1
AN-1
BN-1
Overflow?
CN-1
Addition and
subtraction
Addition and subtraction are fundamental to computer
systems
Key create a single bit adder/subtractor
Chain the single-bit hardware together to create bigger designs
Magnitude Comparators
Digital building block
Magnitude comparators
Compare two multi-bit binary numbers
Create a single bit comparator
Use repetitive pattern
Multiplexers
Select one out of several bits
Some inputs used for selection
Also can be used to implement logic
Magnitude
Comparator
Design Approaches
the truth table
- 22n entries - too cumbersome for large n
use inherent regularity of the problem
- reduce design efforts
- reduce human errors
A[3..0]
B[3..0]
Magnitude
Compare
A<B
A=B
A>B
Mag
nitu
de
Co
mp
arat
or
A0
A1
A2
A3
B0
B1
B2
B3
C0
D01
C1
A_EQ_B
C2
C3
D23
28 = 256
Mag
nitu
de
A0
CoB0
mp
A1
B1
arat
A2
orB2
A3
B3
C0
D01
C1
A_EQ_B
C2
C3
Find A > B
D23
Because A3 > B3
i.e. A3 . B3 = 1
If A = 1001 and
B = 0111
Therefore, one term in the
is A > B?
logic equation for A > B is
Why?
A3 . B3
Magnitude Comparator
If A = 1010 and
B = 1001
is A > B?
Why?
A > B = A3 . B3
+ C3 . A2 . B2
+ ..
Because A3 = B3 and
A2 = B2 and
A1 > B1
i.e. C3 = 1 and C2 = 1 and
A1 . B1 = 1
Therefore, the next term in the
logic equation for A > B is
C3 . C2 . A1 . B1
Magnitude
Comparison
Algorithm -> logic
A = A3A2A1A0 ; B = B3B2B1B0
A=B if A3=B3, A2=B2, A1=B1and A1=B1
Implementation
xi = (AiBi'+Ai'Bi)
Multiplexer
s
Digital building block
4 to 1- Line Multiplexer
Multiplexer as combinational
modules
Connect input variables to select inputs of
multiplexer (n-1 for n variables)
Thr
ee-
A multiplexer can be constructed with three-state gates
stat
e Output state: 0, 1, and high-impedance (open ckts)
gat If the select input (E) is 0, the three-state gate has no
es output
Thr
eestat
e
gat
es
Encoders and
Decoders
Binary decoders
Binary encoders
Converts one of 2n inputs to an n-bit output
Useful for compressing data
Can be developed using AND/OR gates
Binary Decoder
Black box with n input lines and 2n output lines
Only one output is a 1 for any given input
n
inputs
Binary
Decoder
2n outputs
Y F0
0 1
1 0
0 0
1 0
F1 F2 F3
0 0 0
1 0 0
0 1 0
0 0 1
F0 = X'Y'
F1 = X'Y
F2 = XY'
X
Y
2-to-4
Decoder
F3 = XY
F0
F1
F2
F3
3to-8
Truth
Bina Table:
ry
x y z F0 F1 F2
Dec
0 0 0 1 0 0
oder
0 0 1 0 1 0
0
0
1
1
1
1
1
1
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
F0 = x'y'z'
F3
0
0
0
1
0
0
0
0
F4
0
0
0
0
1
0
0
0
F5
0
0
0
0
0
1
0
0
F6
0
0
0
0
0
0
1
0
F7
0
0
0
0
0
0
0
1
F1 = x'y'z
F2 = x'yz'
F3 = x'yz
F4 = xy'z'
F5 = xy'z
F6 = xyz'
F0
X
Y
Z
F7 = xyz
F1
3-to-8
Decoder
F2
F3
F4
F5
F6
F7
3-to-8 0
Decoder 1
x
S2
S1
S0
2
3
4
5
6
7
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
C S
0 0
0 1
0 1
1 0
0 1
1 0
1 0
1 1
Encoders
If the decoder's output code has fewer bits than the
input code, the device is usually called an encoder.
e.g. 2n-to-n
The simplest encoder is a 2n-to-n binary encoder
One of 2n inputs = 1
2n
inputs
.
.
.
Binary
encoder
.
.
.
n
outputs
I0
I1
Inputs
I0
1
0
0
0
0
0
0
0
I1
0
1
0
0
0
0
0
0
I2
0
0
1
0
0
0
0
0
I3
0
0
0
1
0
0
0
0
I4
0
0
0
0
1
0
0
0
Outputs
I5
0
0
0
0
0
1
0
0
I6
0
0
0
0
0
0
1
0
y2 = I4 + I5 + I6 + I7
I2
I3
y1 = I2 + I3 + I6 + I7
I4
I5
I6
I7
y0 = I1 + I3 + I5 + I7
I7
0
0
0
0
0
0
0
1
y2
0
0
0
0
1
1
1
1
y1
0
0
1
1
0
0
1
1
y0
0
1
0
1
0
1
0
1
I0
0
1
X
X
X
X
X
X
X
I1
0
0
1
X
X
X
X
X
X
I2
0
0
0
1
X
X
X
X
X
I3
0
0
0
0
1
X
X
X
X
I4
0
0
0
0
0
1
X
X
X
Outputs
I5
0
0
0
0
0
0
1
X
X
I6
0
0
0
0
0
0
0
1
X
I7
0
0
0
0
0
0
0
0
1
y2
x
0
0
0
0
1
1
1
1
y1
x
0
0
1
1
0
0
1
1
y0 Idle
x 1
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
When more than one input are asserted, the output generates the
code of the input with the highest priority
Priority Encoder :
H7=I7
(Highest Priority)
H6=I6.I7
H5=I5.I6.I7
H4=I4.I5.I6.I7
H3=I3.I4.I5.I6.I7
H2=I2.I3.I4.I5.I6.I7
I0
H1=I1. I2.I3.I4.I5.I6.I7
I1
H0=I0.I1. I2.I3.I4.I5.I6.I7
IDLE= I0.I1. I2.I3.I4.I5.I6.I7 I2
Encoder
Y0 = I1 + I3 + I5 + I7
Y1 = I2 + I3 + I6 + I7
Y2 = I4 + I5 + I6 + I7
Priority encoder
Priority Circuit
Binary encoder
I0
H0
I0
I1
H1
I1
I2
H2
I2
Y0
I3
I3
H3
I3
Y1
I4
I4
H4
I4
Y2
I5
I5
H5
I5
I6
I6
H6
I6
I7
I7
H7
I7
IDLE
Y0
Y1
Y2
IDLE
Alarm
Signal
Contoller
Response
Machine 1
Machine 2
Encoder
Machine n
Action
Machine
Code
Controller