Uploaded by E A

NumberSystems

advertisement
1. Number Systems
Location in
course textbook
Chapt. 2
ITEC 1011
Introduction to Information Technologies
Common Number Systems
System
Base Symbols
Used by Used in
humans? computers?
Decimal
10
0, 1, … 9
Yes
No
Binary
2
0, 1
No
Yes
Hexadecimal
16
0, 1, … 9,
A, B, … F
No
No
ITEC 1011
Introduction to Information Technologies
Quantities/Counting (1 of 3)
Decimal
0
1
2
3
4
5
6
7
ITEC 1011
HexaBinary decimal
0
0
1
1
10
11
100
101
110
111
2
3
4
5
6
7
Introduction to Information Technologies
p. 33
Quantities/Counting (2 of 3)
Decimal
8
9
10
11
12
13
14
15
ITEC 1011
HexaBinary decimal
1000
8
1001
9
1010
1011
1100
1101
1110
1111
A
B
C
D
E
F
Introduction to Information Technologies
Quantities/Counting (3 of 3)
Decimal
16
17
18
19
20
21
22
23
ITEC 1011
HexaBinary decimal
10000
10
10001
11
10010
10011
10100
10101
10110
10111
12
13
14
15
16
17
Introduction to Information Technologies
Etc.
Conversion Among Bases
• The possibilities:
Decimal
Binary
Hexadecimal
pp. 40-46
ITEC 1011
Introduction to Information Technologies
Quick Example
2510 = 110012 = 1916
Base
ITEC 1011
Introduction to Information Technologies
Decimal to Decimal (just for fun)
Decimal
Hexadecimal
Binary
Next slide…
ITEC 1011
Introduction to Information Technologies
Weight
12510 =>
5 x 100
2 x 101
1 x 102
=
5
= 20
= 100
125
Base
ITEC 1011
Introduction to Information Technologies
Binary to Decimal
Decimal
Hexadecimal
Binary
ITEC 1011
Introduction to Information Technologies
Binary to Decimal
• Technique
– Multiply each bit by 2n, where n is the “weight”
of the bit
– The weight is the position of the bit, starting
from 0 on the right
– Add the results
ITEC 1011
Introduction to Information Technologies
Example
Bit “0”
1010112 =>
1
1
0
1
0
1
x
x
x
x
x
x
20
21
22
23
24
25
=
=
=
=
=
=
1
2
0
8
0
32
4310
ITEC 1011
Introduction to Information Technologies
Decimal to Binary
Decimal
Hexadecimal
Binary
ITEC 1011
Introduction to Information Technologies
Decimal to Binary
• Technique
– Divide by two, keep track of the remainder
– First remainder is bit 0 (LSB, least-significant
bit)
– Second remainder is bit 1
– Etc.
ITEC 1011
Introduction to Information Technologies
Example
12510 = ?2
2 125
2 62
2 31
2 15
7
2
3
2
1
2
0
1
0
1
1
1
1
1
12510 = 11111012
ITEC 1011
Introduction to Information Technologies
Hexadecimal to Decimal
Decimal
Binary
ITEC 1011
Hexadecimal
Introduction to Information Technologies
Hexadecimal to Decimal
• Technique
– Multiply each bit by 16n, where n is the
“weight” of the bit
– The weight is the position of the bit, starting
from 0 on the right
– Add the results
ITEC 1011
Introduction to Information Technologies
Example
ABC16 =>
C x 160 = 12 x
1 =
12
B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810
ITEC 1011
Introduction to Information Technologies
Hexadecimal to Binary
Decimal
Binary
ITEC 1011
Hexadecimal
Introduction to Information Technologies
Hexadecimal to Binary
• Technique
– Convert each hexadecimal digit to a 4-bit
equivalent binary representation
ITEC 1011
Introduction to Information Technologies
Example
10AF16 = ?2
1
0
A
F
0001 0000 1010 1111
10AF16 = 00010000101011112
ITEC 1011
Introduction to Information Technologies
Binary to Hexadecimal
Decimal
Binary
ITEC 1011
Hexadecimal
Introduction to Information Technologies
Binary to Hexadecimal
• Technique
– Group bits in fours, starting on right
– Convert to hexadecimal digits
ITEC 1011
Introduction to Information Technologies
Example
10101110112 = ?16
10 1011 1011
2
B
B
10101110112 = 2BB16
ITEC 1011
Introduction to Information Technologies
Decimal to Hexadecimal
Decimal
Binary
ITEC 1011
Hexadecimal
Introduction to Information Technologies
Decimal to Hexadecimal
• Technique
– Divide by 16
– Keep track of the remainder
ITEC 1011
Introduction to Information Technologies
Example
123410 = ?16
16
16
16
1234
77
4
0
2
13 = D
4
123410 = 4D216
ITEC 1011
Introduction to Information Technologies
Chapter Goals
• Identify the basic gates and describe the
behavior of each
• Describe how gates are implemented
using transistors
• Combine basic gates into circuits
• Describe the behavior of a gate or circuit
using Boolean expressions, truth tables,
and logic diagrams
1
Chapter Goals
• Compare and contrast a half adder
and a full adder
• Explain how an S-R latch operates
2
Computers and Electricity
Gate
A device that performs a basic operation on
electrical signals
Circuits
Gates combined to perform more
complicated tasks
3
Computers and Electricity
How do we describe the behavior of gates and
circuits?
Boolean expressions
Uses Boolean algebra, a mathematical notation for
expressing two-valued logic
Logic diagrams
A graphical representation of a circuit; each gate has its
own symbol
Truth tables
A table showing all possible input values and the associated
output values
4
Gates
Six types of gates
–
–
–
–
–
–
NOT
AND
OR
XOR
NAND
NOR
Typically, logic diagrams are black and white with
gates distinguished only by their shape
We use color for clarity (and fun)
5
NOT Gate
A NOT gate accepts one input signal (0 or 1) and
returns the complementary (opposite) signal as
output
6
AND Gate
An AND gate accepts two input signals
If both are 1, the output is 1; otherwise,
the output is 0
7
OR Gate
An OR gate accepts two input signals
If both are 0, the output is 0; otherwise,
the output is 1
8
XOR Gate
An XOR gate accepts two input signals
If both are the same, the output is 0; otherwise,
the output is 1
9
XOR Gate
Note the difference between the XOR gate
and the OR gate; they differ only in one
input situation
When both input signals are 1, the OR gate
produces a 1 and the XOR produces a 0
XOR is called the exclusive OR because its
output is 1 if (and only if):
• either one input or the other is 1,
• excluding the case that they both are
10
NAND Gate
The NAND (“NOT of AND”) gate accepts two input
signals
If both are 1, the output is 0; otherwise,
the output is 1
NOR Gate
The NOR (“NOT of OR”) gate accepts two inputs
If both are 0, the output is 1; otherwise,
the output is 0
12
Gates with More Inputs
Some gates can be generalized to accept three or more
input values
A three-input AND gate, for example, produces an output of
1 only if all input values are 1
13
Review of Gate Processing
‫يعكس‬/‫يقلب‬
Gate
Behavior
NOT
Inverts its single input
AND
Produces 1 if all input values are 1
OR
Produces 0 if all input values are 0
XOR
Produces 0 if both input values are the same
NAND Produces 0 if all input values are 1
NOR
Produces 1 if all input values are 0
‫انتاج‬
14
Circuits
Combinational circuit
The input values explicitly determine the output
Sequential circuit
The output is a function of the input values and the
existing state of the circuit
We describe the circuit operations using
Boolean expressions
Logic diagrams
Truth tables
15
Combinational Circuits
Gates are combined into circuits by using the
output of one gate as the input for another
This same
circuit using a
Boolean
expression is
AB + AC
16
Combinational Circuits
Three inputs require eight rows to describe all possible
input combinations
17
Combinational Circuits
Consider the following Boolean expression A(B + C)
Does this truth table look familiar?
Compare it with previous table
18
Combinational Circuits
Write the Boolean expression and truth table for the
following diagram:
19
Combinational Circuits
Write the Boolean expression and truth table for the
following diagram:
20
Combinational Circuits
Write the Boolean expression and truth table for the
following diagram:
21
Combinational Circuits
Write the truth table and draw the logic diagram for the
following Boolean expression :
22
Combinational Circuits
Circuit equivalence
Two circuits that produce the same output for
identical input
Boolean algebra
Allows us to apply provable mathematical
principles to help design circuits
A(B + C) = AB + BC (distributive law) so circuits
must be equivalent
23
Properties of Boolean
Algebra
24
Properties of Boolean
Algebra
25
Properties of Boolean
Algebra
26
Properties of Boolean
Algebra
27
Properties of Boolean
Algebra
28
Complement of a Function
• The complement of a function is derived by
interchanging (• and +), and (1 and 0), and
complementing each variable.
• Otherwise, interchange 1s to 0s in the truth
table column showing F.
2020/3/15
Boolean Algebra
PJF - 1
Complementation: Example
• Find G(x,y,z), the complement of
F(x,y,z) = xy’z’ + x’yz
• G = F’ = (xy’z’ + x’yz)’
= (xy’z’)’ • (x’yz)’
DeMorgan
= (x’+y+z) • (x+y’+z’) DeMorgan again
2020/3/15
Boolean Algebra
PJF - 2
Canonical and Standard Forms
• We need to consider formal techniques for the
simplification of Boolean functions.
– Identical functions will have exactly the same
canonical form.
– Minterms and Maxterms
– Sum-of-Minterms and Product-of- Maxterms
– Product and Sum terms
– Sum-of-Products (SOP) and Product-of-Sums (POS)
2020/3/15
Boolean Algebra
PJF - 3
Definitions
•
•
•
•
Literal: A variable or its complement
Product term: literals connected by •
Sum term: literals connected by +
Minterm: a product term in which all the variables
appear exactly once, either complemented or
uncomplemented
• Maxterm: a sum term in which all the variables
appear exactly once, either complemented or
uncomplemented
2020/3/15
Boolean Algebra
PJF - 4
Minterm
• Represents exactly one combination in the truth table.
• Denoted by mj, where j is the decimal equivalent of
the minterm’s corresponding binary combination (bj).
• A variable in mj is complemented if its value in bj is 0,
otherwise is uncomplemented.
• Example: Assume 3 variables (A,B,C), and j=3. Then, bj
= 011 and its corresponding minterm is denoted by mj
= A’BC
2020/3/15
Boolean Algebra
PJF - 5
Maxterm
• Represents exactly one combination in the truth table.
• Denoted by Mj, where j is the decimal equivalent of
the maxterm’s corresponding binary combination (bj).
• A variable in Mj is complemented if its value in bj is 1,
otherwise is uncomplemented.
• Example: Assume 3 variables (A,B,C), and j=3. Then, bj
= 011 and its corresponding maxterm is denoted by
Mj = A+B’+C’
2020/3/15
Boolean Algebra
PJF - 6
Truth Table notation for Minterms and
Maxterms
• Minterms and
Maxterms are easy
to denote using a
truth table.
• Example:
Assume 3 variables
x,y,z
(order is fixed)
2020/3/15
x
y
z
Minterm
Maxterm
0
0
0
x’y’z’ = m0
x+y+z = M0
0
0
1
x’y’z = m1
x+y+z’ = M1
0
1
0
x’yz’ = m2
x+y’+z = M2
0
1
1
x’yz = m3
x+y’+z’= M3
1
0
0
xy’z’ = m4
x’+y+z = M4
1
0
1
xy’z = m5
x’+y+z’ = M5
1
1
0
xyz’ = m6
x’+y’+z = M6
1
1
1
xyz = m7
x’+y’+z’ = M7
Boolean Algebra
PJF - 7
-
Canonical Forms (Unique)
• Any Boolean function F( ) can be expressed as a
unique sum of minterms and a unique product
of maxterms (under a fixed variable ordering).
• In other words, every function F() has two
canonical forms:
– Canonical Sum-Of-Products (sum of minterms)
– Canonical Product-Of-Sums
(product of
maxterms)
2020/3/15
Boolean Algebra
PJF - 8
Canonical Forms (cont.)
• Canonical Sum-Of-Products:
The minterms included are those mj such that
F( ) = 1 in row j of the truth table for F( ).
• Canonical Product-Of-Sums:
The maxterms included are those Mj such that
F( ) = 0 in row j of the truth table for F( ).
2020/3/15
Boolean Algebra
PJF - 9
Example
• Truth table for f1(a,b,c) at right
a
• The canonical sum-of-products form for f1
0
is
f1(a,b,c) = m1 + m2 + m4 + m6
0
= a’b’c + a’bc’ + ab’c’ + abc’
• The canonical product-of-sums form for f1 is 0
0
f1(a,b,c) = M0 • M3 • M5 • M7
= (a+b+c)•(a+b’+c’)•
1
(a’+b+c’)•(a’+b’+c’).
1
• Observe that: mj = Mj’
b
0
0
1
1
0
0
1 1
1 1
2020/3/15
Boolean Algebra
c
0
1
0
1
0
1
0
1
f1
0
1
1
0
1
0
1
0
PJF - 10
Shorthand: ∑ and ∏
• f1(a,b,c) = ∑ m(1,2,4,6), where ∑ indicates that this is
a sum-of-products form, and m(1,2,4,6) indicates
that the minterms to be included are m1, m2, m4, and
m6.
• f1(a,b,c) = ∏ M(0,3,5,7), where ∏ indicates that this
is a product-of-sums form, and M(0,3,5,7) indicates
that the maxterms to be included are M0, M3, M5,
and M7.
• Since mj = Mj’ for any j,
∑ m(1,2,4,6) = ∏ M(0,3,5,7) = f1(a,b,c)
2020/3/15
Boolean Algebra
PJF - 11
Conversion Between Canonical Forms
• Replace ∑ with ∏ (or vice versa) and replace those j’s that
appeared in the original form with those that do not.
• Example:
f1(a,b,c)
= a’b’c + a’bc’ + ab’c’ + abc’
= m1 + m 2 + m 4 + m6
= ∑(1,2,4,6)
= ∏(0,3,5,7)
= (a+b+c)•(a+b’+c’)•(a’+b+c’)•(a’+b’+c’)
2020/3/15
Boolean Algebra
PJF - 12
Standard Forms (NOT Unique)
• Standard forms are “like” canonical forms,
except that not all variables need appear in
the individual product (SOP) or sum (POS)
terms.
• Example:
f1(a,b,c) = a’b’c + bc’ + ac’
is a standard sum-of-products form
• f1(a,b,c) = (a+b+c)•(b’+c’)•(a’+c’)
is a standard product-of-sums form.
2020/3/15
Boolean Algebra
PJF - 13
Conversion of SOP from standard to
canonical form
• Expand non-canonical terms by inserting
equivalent of 1 in each missing variable x:
(x + x’) = 1
• Remove duplicate minterms
• f1(a,b,c) = a’b’c + bc’ + ac’
= a’b’c + (a+a’)bc’ + a(b+b’)c’
= a’b’c + abc’ + a’bc’ + abc’ + ab’c’
= a’b’c + abc’ + a’bc + ab’c’
2020/3/15
Boolean Algebra
PJF - 14
Conversion of POS from standard to
canonical form
• Expand noncanonical terms by adding 0 in terms of
missing variables (e.g., xx’ = 0) and using the
distributive law
• Remove duplicate maxterms
• f1(a,b,c) = (a+b+c)•(b’+c’)•(a’+c’)
= (a+b+c)•(aa’+b’+c’)•(a’+bb’+c’)
= (a+b+c)•(a+b’+c’)•(a’+b’+c’)•
(a’+b+c’)•(a’+b’+c’)
= (a+b+c)•(a+b’+c’)•(a’+b’+c’)•(a’+b+c’)
2020/3/15
Boolean Algebra
PJF - 15
Chapter 3
Gate-level Minimization
1
Chapter 3 Gate-level Minimization
3-2 The Map Method
Two-variable map and Three-variable map
3-3 Four-Variable Map
3-4 Five-variable Map
3-5 Product of Sums Simplification
3-6 Don’t-care Conditions
3-7 NANd and NOR Implementation
3-8 Other Two-LeveI Implementations
3-9 Exclusive-OR Function
2
3-2 The Map Method
• Simplification of Boolean Expression
– Minimum # of terms, minimum # of literals
– To reduce complexity of digital logic gates
– The simplest expression is not unique
• Methods:
– Algebraic minimization  lack of specific rules
• Section 2.4
– Karnaugh map or K-map
• Combination of 2, 4, … adjacent squares
Logic circuit  Boolean function  Truth table  K-map
 Canonical form (sum of minterms, product of maxterms)
 (Simplifier) standard form (sum of products, product of sums)
3
3-2 The Map Method
A Karnaugh map is a graphical tool for assisting in
the general simplification procedure.
4

2 variables  4 minterms  4 squares.
Y’
Y
X’
X
5
We can reduce functions by circling 1’s in the Kmap
 Each circle represents minterm reduction
 Following circling, we can deduce minimized andor form.
 Rules to consider
Every cell containing a 1 must be included at least
once.
The largest possible “power of 2 rectangle” must
be enclosed.
The 1’s must be enclosed in the smallest possible
number of rectangles.

6

Two variable maps:
a
a
b 0 1
0 0 1
1 0 1
b
0 1
0 1 1
1 0 0
g = b'
f=a
A
B0 1
00 1
11 0
F=AB+A’B
7
Two-variable Map
m1 + m2 + m3 = x’y + xy’ + xy = x + y
8


Example: F(X,Y) = XY’ + XY
From the map, we see that
F (X,Y) = X.
Note: There are implied 0s in other boxes.
1

1
X
This can be justified using algebraic manipulations:
F(X,Y) = XY’ + XY
= X(Y’ +Y)
= X.1
=X
9

Example:
G(x,y) = m1 + m2 + m3
G(x,y)
Y
= m1 + m2 + m3
= X’Y + XY’ + XY
1
From the map, we can see that
G=X+Y
1
1
X
10

Example:
F = Σ(m0,m1)
Using algebraic manipulations
F = Σ(m0,m1)
y
= x’y + x’y’ y
1
= x’ (y+y’) x 0
0 x’y’ x’y
= x’
x
1 xy’
xy
x
0
0
1
1
x
y
0
1
0
1
y
F
1
1
0
0
0
0 1
1
1
1 0
0
X’
11

3 variables 8 minterms (m0 – m7).
How can we locate a minterm square on the map?
 Use figure (a) OR  use column # and row # from figure (b)
E.g. m5 is in row 1 column 01 (5 10 = 101 2)
Q. Show the area representing X’? Y’? Z’?
12
Three-Variable map
• 8 minterms for 3 binary variables
• Any two adjacent squares differ by only
one variable
yz
13
 By combining squares in powers of 2, we reduce
number of literals in a product term, reducing the
literal cost, thereby reducing the other two cost
criteria.
 On a 3-variable K-Map:
◦ One square represents a minterm with three variables
◦ Two adjacent squares represent a product term with two
variables
◦ Four “adjacent” terms represent a product term with one
variables
◦ Eight “adjacent” terms is the function of all ones (logic 1).
14

Adjacent Squares
 m0+m2 = XYZ + XYZ = XZ(Y+Y) = XZ
 m4+m6 = XYZ + XYZ = XZ(Y+Y) = ZX
Note that Z’ wraps from left edge to right edge.
15

F = X’Y’Z’ + X’YZ’ + XY’Z’ + XYZ’
=
=
=
=
Z’ (X’Y’ + X’Y + XY’ + XY)
Z’ (X’ (Y’+Y) + X (Y’+Y))
Z’ (X’+ X)
Z’
16

F=AB’C’ +ABC +ABC +ABC + A’B’C + A’BC’
BC
00 01 11 10
A
00 1 0 1
11 1 1 1
F=A+BC +BC
17
Y

Example:
F (x, y, z)= Σm (2, 3, 6, 7)
YZ
X
00
01
11
0
X
1
10
1
1
1
1
Y
Z


Applying the Minimization Theorem three times:
F(x, y, z) = x y z + x y z + x y z + x y z
= yz + y z
= y
Thus the four terms that form a 2 × 2 square correspond to the term
"y".
18

Example: Simplify
F (x, y, z)= Σm (2, 3, 4, 5)
Y
YZ
X
00
01
11
0
X
1
XY’
1
1
10
1
X’Y
1
Z
F(X,Y,Z) = X’Y + XY’
19

Example: Simplify
G (a, b, c)= Σm (3, 4, 6, 7)
b
bc
X
a
a
00
01
11
0
1
10
bc
1
1
1
1
c
ac’
G (a,b,c) = bc + ac’
20

Example: Simplify
F(X, Y, Z) = X’Z + X’Y + XY’Z + YZ
F(X, Y, Z) = Σm (1, 2, 3, 5, 7)
z
• In general, as more squares
are combined, we obtain a
product term with fewer
literals.
• Overlap is allowed.
YZ
X
X
00
xy
Y
01
11
10
0
1
1
1
1
1
1
Z
F(x, y, z) = z + x y
21
3-3 Four-Variable Map
• Two adjacent squares represent a term of three literals
• Four adjacent squares represent a term of two literals
• Eight adjacent squares represent a term of one literal
The larger the number of squares combined, the smaller the
number of literals in the term
22

23
Examples 3-5 and 3-6
x
x
24

F = m(0,1,2,4,5,6,8,9,12,13,14)
F = Y’ + XZ’ + W’Z’
25

F = m(0,2,4,5,6,7,10,13,15)
26
Simplification Using
Prime Implicants
 A Prime Implicant is a product term obtained by combining
the maximum possible number of adjacent squares in the
map into a rectangle with the number of squares .
 A prime implicant is called an Essential Prime Implicant if
it is the only prime implicant that covers (includes) one or
more minterms.
 Prime Implicants and Essential Prime Implicants can be
determined by inspection of a K-Map.
27
1
28

Find ALL Prime Implicants
CD
C
BD
1
1
BD
A
AB
1
1
1
1
1
1
1
D
AD
ESSENTIAL Prime Implicants
C
BD
1
1
1
B
1
BD
1
B
A
1
1
1
1
1
1
1
1
D
BC
Minterms covered by single prime implicant
Find all prime implicants for:
F (W,X,Y,Z) = (0,2,3,8,9,10,11,12,13,14,15)

Y
1
W
1 1
1 1
1
1
1
1
1
Prime implicants are: W, X‘Y,
and X‘Z‘
1
Z
X
Note that all of these prime
implicants are essential.
Find all prime implicants for:
G(W,X,Y,Z) = (0,2,3,4,7,12,13,14,15)

Prime Implicants are WX, XY’Z',
W’Y’Z', W’X’Z', W’X’Y, W’YZ,
XYZ.
Y
W
1
1
1
1
1 1
1
Z
1
1
X
There is only one essential
prime implicant: WX.
Chapter 3
Gate-level Minimization
1
E.g. Simplify the following
Boolean function in productof-sums form
F(A,B,C,D)=
m(0,1,2,5,8,9,10)
1.
2.
3.
4.
Mark with 1’s the minterms of
F.
Mark the remaining squares
with 0’s. These represent F’.
Find the simplified F’.
F’ = AB + CD + BD’
Complement 3 to obtain a
simplified F in product-ofsums form
F = (A’ + B’)(C’ + D’) (B’ +D)
Simplify :
F= (0,1,2,5,8,9,10) in
Product-of-Sums Form
1.
Mark with 0’s the
Maxterms of F
2.
Combine 0’s to obtain a
simplified F’ in SOP.
A
3.
Complement 2 to obtain
a simplified F in POS.
F’ = AB + CD + BD’
F = (A’+B’)(C’+D’)(B’+D)
C
B
D
Example 3-8
Simply Boolean function F(A, B, C, D) =(0, 1, 2,5, 8, 9,
10) in (a) sum of products and
(b) product of sums
(a) F = B’D’
+ B’C‘
+ A’C’D
(b) 1. Obtain simplified complemented function:
F’ = AB + CD+BD’
2. Applying DeMorgan’s theorem to obtain F
F = (A’ + B’) (C’+D’) (B’ + D)
4
F(x, y, z) = (1, 3, 4, 6) = (0, 2, 5, 7)
F(x, y, z) = (1, 3, 4, 6) = (0, 2, 5,7)
F = x’z + xz‘
F’ = xz + x’z’  F = (x’ + z’)(x + z)
5

Sometimes a function table or map contains entries for
which it is known:
◦ the input values for the minterm will never occur, or
◦ The output value for the minterm is not used




In these cases, the output value need not be defined
Instead, the output value is defined as a “don't care”
By placing “don't cares” ( an “x” entry) in the function
table or map, the cost of the logic circuit may be
lowered.
Example 1: A logic function having the binary codes
for the BCD digits as its inputs. Only the codes for 0
through 9 are used. The six codes, 1010 through 1111
never occur, so the output values for these codes are
“x” to represent “don’t cares.”
Example 3-9
product of sums?
7
Download