Computer Organization
Review: Combinational circuits
Week 1 Lecture Notes
Adapted by
Dr. Adel Ammar
Computer Organization
Combinational vs. sequential digital circuits
Computer Organization
Part 1: Design
Computer Organization
Overview
Design digital circuit from specification
Digital inputs and outputs known
Need to determine logic that can transform data
Start in truth table form
Create K-map for each output based on function of
inputs
Determine minimized sum-of-product representation
Draw circuit diagram
Computer Organization
4
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.
There are five ways to represent a function:
Boolean expression
truth table
logic circuit
minterms/maxterms
Karnaugh map
Computer Organization
5
Combinational logic design
Use multiple representations of logic functions
Use graphical representation to assist in simplification
of function.
Use concept of “don’t care” conditions.
Example
encoding BCD to seven segment display.
Computer Organization
6
BCD to Seven Segment Display
Used to display binary coded decimal (BCD) numbers
using seven illuminated segments.
BCD uses 0’s and 1’s to represent decimal digits 0 - 9.
Need four bits to represent required 10 digits.
Binary coded decimal (BCD) represents each decimal
digit with four bits
0
0
0
0
0
1
0
0
0
1
2
0
0
1
0
7
0
1
1
1
8
1
0
0
0
9
1
0
0
1
Computer Organization
a
f
g
e
b
c
d
7
BCD to seven segment display
List the segments that should be illuminated for each
digit.
0
1
2
3
4
5
6
7
8
9
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
g
e
Computer Organization
b
c
d
8
BCD to seven segment display
Derive the truth table for the circuit.
Each output column in one circuit.
Inputs
Dec
0
1
2
7
8
9
w
0
0
0
0
1
1
x
0
0
0
1
0
0
y
0
0
1
1
0
0
Outputs
z
0
1
0
1
0
1
a
1
0
1
1
1
1
b
1
1
1
1
1
1
Computer Organization
c
1
1
0
1
1
1
d
1
0
1
0
1
1
e
1
0
1
0
1
0
.
.
.
.
.
.
.
.
9
BCD to seven segment display
Find minimal sum-of-products representation for each
output
For segment “a” :
yz
00 01 11 10
wx
00 1
0
1
1
01 0
1
1
1
11
10 1
1
Note: Have only
filled in ten
squares,
corresponding to
the ten numerical
digits we wish to
represent.
Computer Organization
10
Don’t care conditions (BCD display) ...
Fill in don’t cares for undefined outputs.
Note that these combinations of inputs should never happen.
Leads to a reduced implementation
For segment “a” :
yz
00 01 11 10
wx
00 1
0
1
1
01 0
1
1
1
11 X X X X
10 1
1
Put in “X” (don’t
care), and interpret as
either 1 or 0 as
desired ….
X X
Computer Organization
11
Don’t care conditions (BCD display) ...
Circle biggest group of 1’s and Don’t Cares.
Leads to a reduced implementation
For segment “a” :
yz
00 01 11 10
wx
00 1 0 1 1
01 0
1
1
1
Fa1 y
11 X X X X
10 1
1
X X
Computer Organization
12
Don’t care conditions (BCD display)
Circle biggest group of 1’s and Don’t Cares.
Leads to a reduced implementation
For segment “a” :
yz
wx
00 01 11 10
00 1
0
1
1
01 0
1
1
1
Fa2 w
11 X X X X
10 1
1
X X
Computer Organization
13
Don’t care conditions (BCD display) ...
Circle biggest group of 1’s and Don’t Cares.
All 1’s should be covered by at least one implicant
For segment “a” :
yz
yz
00 01 11 10
wx
00 01 11 10
wx
00 1 0 1 1
00 1 0 1 1
01 0
1
1
1
01 0
1
1
1
11 X X X X
11 X X X X
10 1
10 1
1
X X
Fa3 x z
1
X X
Fa4 xz
Computer Organization
14
Don’t care conditions (BCD display) ...
Put all the terms together
Generate the circuit
For segment “a” :
yz
00 01 11 10
wx
00 1 0 1 1
01 0
1
1
F y w x z xz
1
11 X X X X
10 1
1
X X
Computer Organization
15
BCD to seven segment display
Derive the truth table for the circuit.
Each output column in one circuit.
Inputs
Dec
0
1
2
7
8
9
w
0
0
0
0
1
1
x
0
0
0
1
0
0
y
0
0
1
1
0
0
Outputs
z
0
1
0
1
0
1
a
1
0
1
1
1
1
b
1
1
1
1
1
1
Computer Organization
c
1
1
0
1
1
1
d
1
0
1
0
1
1
e
1
0
1
0
1
0
.
.
.
.
.
.
.
.
16
BCD to seven segment display
Find minimal sum-of-products representation for each
output
For segment “b” :
yz
00 01 11 10
wx
00 1
1
1
1
01 1
0
1
0
See if you
complete this
example.
11
10 1
1
Computer Organization
17
Summary
Need to formulate circuits from problem description
Determine number of inputs and outputs
Determine truth table format
Determine K-map
Determine minimal SOP
There may be multiple outputs per design
Solve each output separately
Current approach doesn’t have memory.
Computer Organization
18
Part 2: Adder and substractor
Computer Organization
Overview
Addition and subtraction of binary data is fundamental
Need to determine hardware implementation
Represent inputs and outputs
Inputs: single bit values, carry in
Outputs: Sum, Carry
Hardware features
Create a single-bit adder and chain together
Same hardware can be used for addition and subtraction
with minor changes
Dealing with overflow
What happens if numbers are too big?
Computer Organization
20
3.5 Half Adder
Combinational
circuits give us
useful devices.
logic
many
One of the simplest is the
half adder, which finds the
sum of two bits.
Computer Organization
21
Half Adder
As we see, the sum can be
found using the XOR
operation and the carry
using the AND operation.
Computer Organization
22
Full adder
We can change our half
adder into to a full adder
by including gates for
processing the carry bit.
Computer Organization
23
3.5 Full adder
How can we change the
half adder shown below
to make it a full adder?
Computer Organization
24
Full adder
Here’s our completed full adder.
Computer Organization
25
Full Adder
Full adder made of several half adders
Ci
Ai
Si
Bi
C i+1
•Half-adder
•Half-adder
Computer Organization
26
Full Adder
Hardware repetition simplifies hardware design
Ci
Ai
Bi
S
half-adder
half-adder
C
Si
C
C i+1
A full adder can be made from two half adders (plus an OR gate).
Computer Organization
27
Full Adder
Putting it all together
Ai
Single-bit full adder
Common piece of computer hardware
C i+1
Bi
Full Adder
Ci
Si
•Block Diagram
Computer Organization
28
4-Bit Adder
Chain single-bit adders together.
A3
B3
A2
Full Adder
Full Adder
S3
B1
S2
•C
•A
•B
•S
A0
Full Adder
C2
C3
C4
A1
B2
B0
Full Adder
0
C1
S1
S0
1 1 1 0
0 1 0 1
0 1 1 1
1 1 0 0
Computer Organization
29
Negative Numbers – 2’s Complement.
Subtracting a number is the same as:
1. Perform 2’s complement
2. Perform addition
If we can augment adder with 2’s complement
hardware?
110 = 0116 = 00000001
-110 = FF16 = 11111111
12810 = 8016 = 10000000
-12810 = 8016 = 10000000
Computer Organization
30
4-bit Subtractor: E = 1
A3
B3
A2
B2
A1
B1
A0 B 0
E
Full Adder
C3
C4
SD3
Full Adder
Full Adder
C2
SD2
Full Adder
+1
C1
SD1
SD0
Add A to B’ (one’s complement) plus 1
That is, add A to two’s complement of B
D=A-B
Computer Organization
31
Adder- Subtractor Circuit
Computer Organization
32
Overflow in two’s complement addition
Definition: When two values of the same signs are
added:
Result won’t fit in the number of bits provided
Result has the opposite sign.
Computer Organization
33
Addition cases and overflow
00
0010
0011
-------0101
2
3
5
01
0011
0110
-------1001
11
1110
1101
-------1011
10
1101
1010
-------0111
00
0010
1100
-------1110
11
1110
0100
-------0010
3
6
-7
-2
-3
-5
-3
-6
7
2
-4
-2
-2
4
2
OFL
OFL
Computer Organization
34
Summary: Adder-Substractor
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
The approach is called ripple-carry addition
Can be slow for large designs
Overflow is an important issue for computers
Processors often have hardware to detect overflow
Computer Organization
35
Decoding
Decoding - the conversion of an n-bit input code to an mbit
output
code
with
n m 2n such that each valid code word produces a
unique output code
Circuits that perform decoding are called decoders
Here, functional blocks for decoding are
called n-to-m line decoders, where m 2n, and
generate 2n (or fewer) minterms for the n input variables
When n = 2, there are 2^2 = 4 outputs that can be decoded.
When n = 3, there are 2^3 = 8 outputs that can be decoded.
Computer Organization
Chapter 3
36
Decoders
Decoders are an important type of combinational
circuit.
Among other things, they are useful in selecting a
memory location according a binary value placed on the
address lines of a memory bus.
Address decoders with n inputs can select any of 2n
locations.
•This is a
block
diagram for a
decoder.
Computer Organization
37
Decoder Examples
1-to-2-Line Decoder A
0
1
2-to-4-Line Decoder
D0 D1
D0 5 A
1
0
0
1
D1 5 A
A
(a)
(b)
•A•0
•A•1 •A•0
•D•0 •D•1 •D•2 •D•3
•0
•0
•1
•1
•1
•0
•0
•0
•0
•1
•0
•1
•0
•1
•0
•0
•0
•0
•1
•0
•A•1
•0
•0
•0
•1
•D•0 •5 • A•1• A•0
•D•1 •5 • A•1• A•0
•(a)
Note that the 2-4-line
•D•2 •5 • A•1• A•0
made up of 2 1-to-2line decoders and 4 AND gates.
•D•3 •5 • A•1• A•0
Computer Organization•(b)
Chapter 3
38
Decoder: exercise
Design a 3X8 decoder using a truth table.
•
Computer Organization
39
Decoder: block diagram
Design a 3X8 decoder using a truth table.
•
Computer Organization
40
Encoding
Encoding - the opposite of decoding - the
conversion of an m-bit input code to a n-bit output
code with n m 2n such that each valid code word
produces a unique output code
Circuits that perform encoding are called encoders
An encoder has 2n (or fewer) input lines and n output
lines which generate the binary code corresponding
to the input values
Typically, an encoder converts a code containing
exactly one bit that is 1 to a binary code
corresponding to the position in which the 1 appears.
Computer Organization
Chapter 3
41
Encoder: exercise
Design an 8X3 encoder using a truth table.
•
Computer Organization
42
Encoder: block diagram
Design an 8X3 encoder using a truth table.
•
Computer Organization
43
Multiplexer
A multiplexer or data selector (abbreviated MUX) consists of a group of
data inputs and a group of control inputs. The control inputs are used to
select exactly one data input to be outputted.
A MUX with n control inputs can select from a maximum of 2^n data
•
inputs.
When n = 2, there are 2^2 = 4 data inputs that can be selected.
When n = 3, there are 2^3 = 8 data inputs that can be selected.
An 8X1 (n = 3) MUX uses three control inputs to select exactly one of eight
data inputs to be outputted. The three control inputs are labeled as A, B, and
C or s0, s1 and s2.
Computer Organization
44
Multiplexer
It selects a single output
from several inputs.
The
particular
input
chosen for output is
determined by the value of
the multiplexer’s control
lines.
To be able to select among
n inputs, log2n control
lines are needed.
Computer Organization
•This is a
block
diagram for a
multiplexer.
45
An 4X1 Multiplexer
This is what a 4-to-1 multiplexer looks like on the
inside.
•If S0 = 1 and S1 =
0, which input is
transferred to the
output?
Computer Organization
46
An 8X1 Multiplexer
An 8X1 (n = 3) MUX uses three control inputs to select exactly one
of eight data inputs to be outputted. The three control inputs are
labeled as A, B, and C.
•
Computer Organization
47
Conclusion
Combinational logic circuits are usefull for situations
when we require the immediate application of a
Boolean function to a set of inputs.
There are other times, however, when we need a
circuit to change its value with consideration to its
current state as well as its inputs.
These circuits have to “remember” their current state.
Sequential logic circuits provide this functionality for
us.
Computer Organization
48