Number System
-
Upload
ramesh-ragala -
Category
Education
-
view
149 -
download
3
description
Transcript of Number System
1
BOOLEAN ALGEBRA & LOGIC GATESUNIT-I
ITA401 : Introduction to Computer Organization
Summer Course MCA
Instructor: Prof. Ramesh Ragala, SCSE, VITCC
Text BooksM. Morris Mano – Digital Logic and Computer Design
OVERVIEW
Review of Binary Number Systems
Binary Arithmetic & Binary Codes
Boolean Algebra & Boolean Theorems
Truth tables & Boolean functions
Canonical & Standard forms
Logic Operations & Logic Gates
Karnough Map up to 6 variables (Don't Care Condition)
Sum Of Products and Products Of Sum
Simplification – Tabulation Method.
OVERVIEW
Digital Computer and Digital Systems:
Digital computer: follows a sequence of instructions, called programs that operate on given data.
The user can change programs and data according to specific need.
Digital system: best example is general purpose digital computer.
Characteristics of digital system: manipulation of discrete elements of information.
Discrete elements: set of meaningful symbols like electric pulses, decimal digits, the letters of alphabet, arithmetic operation. d,o &g dog;; 128
OVERVIEW
Digital Computer and Digital Systems:
A sequence of discrete elements of information represents forms a language, that is a discipline that conveys information.
In early day, the digital computers are used for numerical computations. discrete elements are digits.
Digital computer discrete information processing system
The discrete elements of information are represented by physical quantities called signals. Two discrete values said to be binary ???????
OVERVIEW
Digital Computer and Digital Systems:
6
THE COMPUTER LEVEL HIERARCHY 6:The level with which we are most
familiar. 5:The level with which we interact
when we write programs in languages such as C, Java.
4:Acts upon assembly language produced from 5.
3: Controls executing processes on the system.
2:Programs written in machine language. No need of compilers, interpreters, or assemblers
1: Control units can be microprogrammed or hardwired
0: Implement the mathematical logic of all other levels
REVIEW OF BINARY NUMBER SYSTEMS
We are familiar to do computation using numbers 0 – 9.
These are digits of a digital system.
why should anyone bother to study the binary number system?
Computers.
Computers do not use 10 digits for computation.
Every computer processor is made of millions of tiny switches that can be turned off or on.
These switches have two states: on / off.
Computer to perform its computations with a number system that only has two digits: the binary number system (language of computer).
UNDERSTANDING OF NUMBER SYSTEMS
The base/radix of any number system is determined by the number of digits in the system.
Example: binary base – 2 Number system. (0/1 two only) 110.112
Decimal is a base – 10, because it uses ten digits. 592.3410
Conversion between binary and decimal numbers
It needsRelationship between digits of a given numberPosition of those digitsBase of the number system.
UNDERSTANDING OF NUMBER SYSTEMS
In general, the relation between a digit, it position and the base of the number system is expressed by the following formula
6.75
Hundreds
Tens Ones . Tenths
Hundredths
102 101 100 10-1 10-2
5 9 2 . 1 5
DIGIT * BASE POSITION
#
Fours Twos Ones . Halves
Fourth
22 21 20 2-1 2-2
1 1 0 . 1 1
UNDERSTANDING OF NUMBER SYSTEMS
In order to convert a decimal number to it binary equivalent repeatedly divide the decimal number by 2.
Division by 2 will either give a reminder 1 or 0.
The collection of the remainders will gives the binary equivalent of given decimal number.
What is the procedure, if the decimal number contains fractional.
Instead of dividing by 2, we repeatedly multiply the decimal fraction by 2.
If the result is greater than or equal to 1, we add a 1 to our answer. If the result is less than 1, we add a 0 to our answer.
UNDERSTANDING OF NUMBER SYSTEMS
In order to convert a decimal number to it binary equivalent repeatedly divide the decimal number by 2.
Division by 2 will either give a reminder 1 or 0.
The collection of the remainders will gives the binary equivalent of given decimal number.
What is the procedure, if the decimal number contains fractional.
Instead of dividing by 2, we repeatedly multiply the decimal fraction by 2.
If the result is greater than or equal to 1, we add a 1 to our answer. If the result is less than 1, we add a 0 to our answer.
NUMBER SYSTEMS – REPRESENTATION
Positive radix, positional number systems
A number with radix r is represented by a string of digits:
An - 1An - 2 … A1A0 . A- 1 A- 2 … A- m + 1 A- m
in which 0 < Ai < r and . is the radix point.
The string of digits represents the power series:
( ) ( ) (Number)r = åå +
j = - m
jj
i
i = 0i rArA
(Integer Portion) + (Fraction Portion)
i = n - 1
j = - 1
NUMBER SYSTEMS – EXAMPLES
General Decimal Binary
Radix (Base) r 10 2
Digits 0 => r - 1 0 => 9 0 => 1
0123
Powers of 4
Radix 5-1-2-3-4-5
r0
r1
r2
r3
r4
r5
r -1
r -2
r -3
r -4
r -5
110
1001000
10,000100,000
0.10.01
0.0010.0001
0.00001
124816320.50.25
0.1250.0625
0.03125
SPECIAL POWERS OF 2
Smallest unit in computer is Bit (Binary Digit) Combination of such 4 bits is called Nibble Combination of such 8 bits is called Byte is denoted
"B" 210 (1,024) is Kilo, denoted " K" 220 (1,048,576) is Mega, denoted "M " 230 (1,073, 741,824) is Giga, denoted "G " 240 (1,099,511,627,776 ) is Tera, denoted " T " 250 (1,125,899,906,842,624) is Peta, denoted "P" 260 (1,152,921,504,606,846,976) is Exa, denoted "E" 270 (1,180,591,620,717,411…) is Zetta, denoted "Z" 280 (1,208,925,819,614….. ) is Yotta, denoted "Y"
BASE 10
BASIC CONCEPTS BEHIND THE BINARY SYSTEM
Recalling elementary school math (Decimal System)
H | T | O
1 | 9 | 3
Years later
102 |101|100
1 | 9 | 3
Decimal system uses the digits 0-9 to represent numbers
1-hundreds plus 9-tens plus 3-ones = 193
}
(1* 102 )+(9*101)+(3*100)= 193}
BASE 2
It operates in base 2 rather than base 10(Binary System)
102|101|100
22 | 21 | 20
Instead of using the digits 0-9, we only use 0-1
What would the binary number 1011 be in decimal?
What would the binary number 1101be in decimal?
BINARY SYSTEM
BINARY SYSTEM CONTD..
1011=(1*23)+(0*22)+(1*21)+(1*20)
= (1*8) + (0*4) + (1*2) + (1*1)
= 11(not one one its eleven)
1101=(1*23)+(1*22)+(0*21)+(1*20)
= (1*8) + (1*4) + (0*2) + (1*1)
= 13
Like Binary we can define any r-base system.
r value for Binary is 2, for Decimal 10, Octal is 8 and Hexadecimal is 16
BINARY ARITHMETIC -- ADDITION
Four Rules:
Rule – 1 : 0 + 0 = 0
Rule – 2: 0 + 1 = 1
Rule – 3 : 1 + 0 = 1
Rule – 4: 1 + 1 = 10
Example 01111 + 00110 =????
Adding multiple binary numbers:
0111 + 0110 + 1101 + 0101 + 1110 =?
BINARY ARITHMETIC -- ADDITION
First, we align the two numbers so that the radix point of each number is located in the same column.
110.01 + 1.011
Next, we fill in the blank spaces with 0s and add the two numbers together.
110.010 + 001.011
The first column adds to 1. 110.010 + 001.011 1
The second column adds to 102, so we write a 0 below it and carry a 1 to the next column.
1 110.010 + 001.011 01
All of the remaining columns add to 1, so we write 1 below them.
1 110.010 + 001.011 111.101
This gives us a final answer of 111.1012.
1 110.010 + 001.011 111.101
BINARY ARITHMETIC -- SUBTRACTION
Four Rules:
Rule – 1 : 0 - 0 = 0
Rule – 2: 0 - 1 = 1 (Special)
Rule – 3 : 1 - 0 = 1
Rule – 4: 1 - 1 = 0
Example: 10101 – 1110 =????
BINARY ARITHMETIC -- SUBTRACTION
1.To compute the first column, we need to borrow a 1 from the next column. Recall that two 1s generated a carry in addition. If we reverse this process, we can borrow a 1 from the second column and mark two 1s in the first column.
10 - 1
2.Once we borrow from the second column, we cross out the 1 and write 0 above it to show this column is now empty. The 1 from the second column is now represented by the two blue 1s in the first column.
1 01 10 - 1
3.To solve our subtraction problem, we take 1 away from our group of two blue 1s. This leaves us with a single 1 which we write below the first column.
1 01 10 - 1 1
4.After cleaning up our work, we can see that the first column of our answer is identical to Rule 2. Since we must borrow a 1 from the next column, 0 - 1 = 1.
10 - 1 1
BINARY ARITHMETIC -- MULTIPLICATION
same techinique as decimal multiplication.
Example : multiply 110 by 10
Example : 1111 * 1011 = ?????
BINARY ARITHMETIC -- DIVISION
same techinique as decimal division.
Example : 112 / 102 = ??
Example : divide the binary number 1000012 by 1102
BINARY ARITHMETIC
Addition (1-bit) Addition (multi-bit)
0 0 1 1 11 (carry)
+ 0 +1 +0 +1 1010 (10)
0 1 1 10 +1111 (15)
11001 (25)
Multiplication (1-bit) Multiplication(multi-bit)
1*1=1, 1*0=0 101
0*1=0, 0*0=0 * 11
101
1010
1111
BINARY ARITHMETIC CONTD..
25
Division
10011(19)
11)111011(59/3)
-11____
101
-11_
101
11
10(2)
26
COMMONLY OCCURRING BASES
Name Radix Digits
Binary 2 0,1
Octal 8 0,1,2,3,4,5,6,7
Decimal 10 0,1,2,3,4,5,6,7,8,9
Hexadecimal 16 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
The six letters (in addition to the 10 integers) in hexadecimal represent:
27
Decimal (Base 10)
Binary (Base 2)
Octal (Base 8)
Hexadecimal (Base 16)
00 00000 00 00 01 00001 01 01 02 00010 02 02 03 00011 03 03 04 00100 04 04 05 00101 05 05 06 00110 06 06 07 00111 07 07 08 01000 10 08 09 01001 11 09 10 01010 12 0A 11 01011 13 0B 12 01100 14 0C 13 01101 15 0D 14 01110 16 0E 15 01111 17 0F 16 10000 20 10
NUMBERS IN DIFFERENT BASES
28
CONVERSION BETWEEN BASES
To convert from one base to another:
1) Convert the Integer Part
2) Convert the Fraction Part
3) Join the two results with a radix point
29
CONVERSION DETAILS
To Convert the Integral Part: Repeatedly divide the number by the new radix and save the
remainders. The digits for the new radix are the remainders in reverse order of their computation. If the new radix is > 10, then convert all remainders > 10 to digits A, B, …
To Convert the Fractional Part:
Repeatedly multiply the fraction by the new radix and save the integer digits that result. The digits for the new radix are the integer digits in order of their computation. If the new radix is > 10, then convert all integers > 10 to digits A, B, …
30
EXAMPLE: CONVERT 11.37510 TO BASE 2
• Convert 11 to Base 2
• Convert 0.375 to Base 2:
• Join results together with the radix point:
31
ADDITIONAL ISSUE - FRACTIONAL PART
•Note that in this conversion, the fractional part can become 0 as a result of the repeated multiplications.
• In general, it may take many bits to get this to happen or it may never happen.
• Example Problem: Convert 0.6510 to N2
• 0.65 = 0.1010011001001 …• The fractional part begins repeating every 4
steps yielding repeating 1001 forever!
•Solution: Specify number of bits to right of radix point and round or truncate to this number.
32
CHECKING THE CONVERSION
To convert back, sum the digits times their respective powers of r.
From the prior conversion of 11.37510
10112 = 1*8 +0*4 + 1*2 +1*1
= 8 + 2 + 1
= 11
0.0112 = 1/4 + 1/8
= 0.25 + 0.125
= 0.375
33
OCTAL (HEXADECIMAL) TO BINARY AND BACK
Octal (Hexadecimal) to Binary: Restate the octal (hexadecimal) as three (four) binary digits
starting at the radix point and going both ways.
Binary to Octal (Hexadecimal): Group the binary digits into three (four) bit groups starting at
the radix point and going both ways, padding with zeros as needed in the fractional part.
Convert each group of three(four) bits to an octal(hexadecimal).
34
OCTAL TO HEXADECIMAL VIA BINARY
Convert octal to binary.
Use groups of four bits and convert as above to hexadecimal digits.
Example: Octal to Binary to Hexadecimal
6 3 5 . 1 7 7 8
110 011 101 . 001 111 111 2
Regroup:
(000)1 1001 1101. 0011 1111 1(000) 2
Convert 1 9 D . 3 F 8 16
|| | |
| | | |
35
CONVERSION SUMMARY
To
From
Dec Bin Octal Hex
Dec -Repeated /
or *Thru Bin Thru Bin
Bin Add weights of 1s -Convert every 3 digits
Convert every 4 digits
Octal Add digit*weightSplit every digit to 3
- Thru Bin
Hex Add digit*weights
Split every digit to 4
Thru Bin -
36
A FINAL CONVERSION NOTE
You can use arithmetic in other bases if you are careful:
Example: Convert 1011102 to Base 10 using binary
arithmetic: Step 1 101110 / 1010 = 100 r 0110
Step 2 100 / 1010 = 0 r 0100
Converted Digits are 01002 | 01102
or 4 6 10
37
BINARY NUMBERS AND BINARY CODING
Flexibility of representationWithin constraints below, can assign any binary combination (called
a code word) to any data as long as data is uniquely encoded.
Information TypesNumeric
Must represent range of data needed Very desirable to represent data such that simple, straightforward
computation for common arithmetic operations permitted Tight relation to binary numbers
Non-numeric Greater flexibility since arithmetic operations not applied. Not tied to binary numbers
38
Given n binary digits (called bits), a binary code is a mapping from a set of represented elements to a subset of the 2n binary numbers.
Example: Abinary codefor the sevencolors of therainbow
Code 100 is not used
NON-NUMERIC BINARY CODES
Binary Number 000001010011101110111
ColorRedOrangeYellowGreenBlueIndigoViolet
39
Given M elements to be represented by a binary code, the minimum number of bits, n, needed, satisfies the following relationships:
2n ³ M > 2(n – 1)
n = log2 M where x , called the ceilingfunction, is the integer greater than or equal to x.
Example: How many bits are required to represent decimal digits with a binary code?
NUMBER OF BITS REQUIRED
40
NUMBER OF ELEMENTS REPRESENTEDGiven n digits in radix r, there are rn distinct elements that can be represented.But, you can represent m elements, m < rn
Examples:You can represent 4 elements in radix r = 2 with n = 2 digits: (00, 01, 10, 11).
You can represent 4 elements in radix r = 2 with n = 4 digits: (0001, 0010, 0100, 1000).
This second code is called a "one hot" code.
DECIMAL CODES - BINARY CODES FOR DECIMAL DIGITS
Decimal 8,4,2,1 Excess3 8,4,-2,-1 Gray 0 0000 0011 0000 0000 1 0001 0100 0111 0001 2 0010 0101 0110 0011 3 0011 0110 0101 0010 4 0100 0111 0100 0110 5 0101 1000 1011 0111 6 0110 1001 1010 0101 7 0111 1010 1001 0100 8 1000 1011 1000 1100 9 1001 1100 1111 1101
There are over 8,000 ways that you can chose 10 elements from the 16 binary numbers of 4 bits. A few are useful:
42
BINARY CODES -- CLASSIFICATION OF BINARY CODES
• The digital data is represented, stored and transmitted as group of binary bits. This group is also called as binary code.
• How many Bits are needed????? 4
• The codes are broadly categorized into following four categories.
• Weighted Codes
• Non-Weighted Codes
• Binary Coded Decimal Code
• Alphanumeric Codes
• Error Detecting Codes
• Error Correcting Codes
• What special property does the Gray code have in relation to adjacent decimal digits? used for error correction.
• two successive values differ in only one bit (binary digit)
GRAY CODE (REFLECTED CODE) – DECIMAL
Decimal 8,4,2,1 Gray 0 0000 0000 1 0001 0001 2 0010 0011 3 0011 0010 4 0100 0110 5 0101 0111 6 0110 0101 7 0111 0001 8 1000 1100 9 1001 1101
BINARY CODED DECIMAL (BCD)
•The BCD code is the 8,4,2,1 code.•8, 4, 2, and 1 are weights•BCD is a weighted code•This code is the simplest, most intuitive binary code for decimal digits and uses the same powers of 2 as a binary number, but only encodes the first ten values from 0 to 9.•Example: 1001 (9) = 1000 (8) + 0001 (1)•How many “invalid” code words are there?•What are the “invalid” code words?
44
WARNING: CONVERSION OR CODING?
• Do NOT mix up conversion of a decimal number to a binary number with coding a decimal number with a BINARY CODE.
•1310 = 11012 (This is conversion)
•13 0001|0011 (This is coding)
45
46
BCD ARITHMETIC
Given a BCD code, we use binary arithmetic to add the digits:8 1000 Eight
+5 +0101 Plus 5 13 1101 is 13 (> 9)
Note that the result is MORE THAN 9, so must be represented by 2 digits!
To correct the digit, subtract 10 by adding 6 modulo 16.8 1000 Eight
+5 +0101 Plus 5 13 1101 is 13 (> 9)
+0110 so add 6 carry = 1 0011 leaving 3 + cy
0001 | 0011 Final answer (two digits) If the digit sum is > 9, add one to the next significant digit
47
DIGITAL BCD CLOCK
ALPHANUMERIC CODES - ASCII CHARACTER CODES
•American Standard Code for Information Interchange
• This code is a popular code used to represent information sent as character-based data. It uses 7-bits to represent:• 94 Graphic printing characters.• 34 Non-printing characters
•Some non-printing characters are used for text format (e.g. BS = Backspace, CR = carriage return)
•Other non-printing characters are used for record marking and flow control (e.g. STX and ETX start and end text areas).• http://www.asciitable.com/
48
50
ASCII PROPERTIES
ASCII has some interesting properties: Digits 0 to 9 span Hexadecimal values 3016 to 3916
Upper case A-Z span 4116 to 5A16. Lower case a-z span 6116 to 7A16 .
• Lower to upper case translation (and vice versa) occurs byflipping 6th bit
Delete (DEL) is all bits set, a carryover from when punched paper tape was used to store messages. Punching all holes in a row erased a mistake!
UNICODE
• UNICODE extends ASCII to 65,536 universal characters codes
• For encoding characters in world languages
• Available in many modern applications
• 2 byte (16-bit) code words
• See Reading Supplement – Unicode on the Companion Website
51
PARITY BIT ERROR-DETECTION CODES
•Redundancy (e.g. extra information), in the form of extra bits, can be incorporated into binary code words to detect and correct errors.
•A simple form of redundancy is parity, an extra bit appended onto the code word to make the number of 1’s odd or even. Parity can detect all single-bit errors and some multiple-bit errors.
•A code word has even parity if the number of 1’s in the code word is even.
•A code word has odd parity if the number of 1’s in the code word is odd.
52
4-BIT PARITY CODE EXAMPLE
• Fill in the even and odd parity bits:
• The codeword "1111" has even parity and the codeword "1110" has odd parity. Both can be used to represent 3-bit data.
Even Parity
Odd Parity
Message - Parity Message - Parity
000 - 000 - 001 - 001 010 - 010 - 011 - 011 - 100 - 100 - 101 - 101 - 110 - 110 - 111 - 111 -
53
-
54
BASIC DEFINITIONS
• Binary Operators
• AND
z = x • y = x y z=1 if x=1 AND y=1
• OR
z = x + y z=1 if x=1 OR y=1
• NOT
z = x = x’ z=1 if x=0
• Boolean Algebra
• Binary Variables: only ‘0’ and ‘1’ values
• Algebraic Manipulation
55
BOOLEAN ALGEBRA POSTULATES
• Closure
x, y ∈ S; z = x y , z ∈S ; S is closed under {N,+}
• Commutative Law
x • y = y • x x + y = y + x
• Identity Element
x • 1 = x x + 0 = x
• Complement
x • x’ = 0 x + x’ = 1
• Inverse
x, y∈ S; x y=y x=e ; e is Identity of S.
Additive inverse {R, x, -x}
*
*
*
*
56
BOOLEAN ALGEBRA THEOREMS
• Duality
• The dual of a Boolean algebraic expression is obtained by interchanging the AND with OR operators and replacing the 1’s by 0’s and the 0’s by 1’s.
• x • ( y + z ) = ( x • y ) + ( x • z )
• x + ( y • z ) = ( x + y ) • ( x + z )
• Theorem 1
• x • x = x x + x = x
• Theorem 2
• x • 0 = 0 x + 1 = 1
BOOLEAN ALGEBRA THEOREMS
Theorem 3: Involution ( x’ )’ = x ( x ) = x
Theorem 4: Associative & Distributive ( x • y ) • z = x • ( y • z ) ( x + y ) + z = x + ( y + z ) x • ( y + z ) = ( x • y ) + ( x • z ) x + ( y • z ) = ( x + y ) • ( x + z )
Theorem 5: DeMorgan ( x • y )’ = x’ + y’ ( x + y )’ = x’ • y’ ( x • y ) = x + y ( x + y ) = x • y
Theorem 6: Absorption x • ( x + y ) = x x + ( x • y ) = x
OPERATOR PRECEDENCE
• Parentheses ( . . . ) • ( . . .)
• NOT x’ + y
• AND x + x • y
• OR
])([ xwzyx
])([
)(
)(
)(
)(
xwzyx
xwzy
xwz
xw
xw
DEMORGAN’S THEOREM
)]([ edcba
)]([ edcba
))(( edcba
))(( edcba
))(( edcba
)( edcba
60
BOOLEAN FUNCTIONS
• Boolean ExpressionExample: F = x + y’ z
• Truth TableAll possible combinationsof input variables
• Logic Circuit
x y z F
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
xyz
F
ALGEBRAIC MANIPULATION
• Literal:A single variable within a term that may be complemented or not.
• Use Boolean Algebra to simplify Boolean functions to produce simpler circuits
Example: Simplify to a minimum number of literals
F = x + x’ y ( 3 Literals)
= x + ( x’ y )
= ( x + x’ ) ( x + y )
= ( 1 ) ( x + y ) = x + y ( 2 Literals)Distributive law (+ over •)
COMPLEMENT OF A FUNCTION
• DeMorgan’s Theorm
• Duality & Literal Complement
CBAF
CBAF
CBAF
CBAF
CBAF
CBAF
63
CANONICAL FORMS
• Minterm
• Product (AND function)
• Contains all variables
• Evaluates to ‘1’ for aspecific combination
Example
A = 0 A B C
B = 0 (0) • (0) • (0)
C = 0
1 • 1 • 1 = 1
A B C Minterm
0 0 0 0 m0
1 0 0 1 m1
2 0 1 0 m2
3 0 1 1 m3
4 1 0 0 m4
5 1 0 1 m5
6 1 1 0 m6
7 1 1 1 m7
CBA
CBA
CBA
CBA
CBA
CBA
CBA
CBA
64
CANONICAL FORMS
• Maxterm
• Sum (OR function)
• Contains all variables
• Evaluates to ‘0’ for aspecific combination
Example
A = 1 A B C
B = 1 (1) + (1) + (1)
C = 1
0 + 0 + 0 = 0
A B C Maxterm
0 0 0 0 M0
1 0 0 1 M1
2 0 1 0 M2
3 0 1 1 M3
4 1 0 0 M4
5 1 0 1 M5
6 1 1 0 M6
7 1 1 1 M7
CBA
CBA CBA CBA CBA CBA CBA CBA
CANONICAL FORMS
• Truth Table to Boolean Function
A B C F
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 1
CBAF CBA CBA ABC
66
CANONICAL FORMS
A B C F
0 0 0 0 0
1 0 0 1 1
2 0 1 0 0
3 0 1 1 0
4 1 0 0 1
5 1 0 1 1
6 1 1 0 0
7 1 1 1 1
ABCCBACBACBAF
7541 mmmmF
)7,5,4,1(F
CABBCACBACBAF
CABBCACBACBAF
CABBCACBACBAF ))()()(( CBACBACBACBAF
6320 MMMMF (0,2,3,6)F
F
1
0
1
1
0
0
1
0
Sum of Minterms
Product of Maxterms
67
STANDARD FORMS
• Sum of Products (SOP)
ABCCBACBACBAF
AC
BBAC
)(
CB
AACB
)(
BA
BA
CCBA
)1(
)(
)()()( BBACCCBAAACBF
ACBACBF
68
STANDARD FORMS
• Product of Sums (POS)
)( AACB
)( BBCA
)( CCBA
)()()( AACBCCBABBCAF
CBBACAF
CABBCACBACBAF
))()(( CBBACAF
TWO - LEVEL IMPLEMENTATIONS
• Sum of Products (SOP)
• Product of Sums (POS)
ACBACBF
))()(( CBBACAF
B’C
FB’A
AC
AC
FB’A
B’C
LOGIC OPERATORS
• AND
• NAND (Not AND)x y NAND0 0 10 1 11 0 11 1 0
x y AND0 0 00 1 01 0 01 1 1
xy
x • y
xy
x • y
71
LOGIC OPERATORS
• OR
• NOR (Not OR)
x y OR0 0 00 1 11 0 11 1 1
x y NOR0 0 10 1 01 0 01 1 0
xy
x + y
xy
x + y
72
LOGIC OPERATORS
• XOR (Exclusive-OR)
• XNOR (Exclusive-NOR) (Equivalence)
x y XOR0 0 00 1 11 0 11 1 0
x y XNOR0 0 10 1 01 0 01 1 1
xy
x Å yx � y
x y + x y
xy
x Å yx y + x y
73
LOGIC OPERATORS
• NOT (Inverter)
• Buffer
x NOT
0 1
1 0
x Buffer
0 0
1 1
x x
x x
74
MULTIPLE INPUT GATES
75
DEMORGAN’S THEOREM ON GATES
• AND Gate
• F = x • y F = (x • y) F = x + y
• OR Gate
• F = x + y F = (x + y) F = x • y
Change the “Shape” and “bubble” all lines
SIMPLIFICATION OF BOOLEAN FUNCTIONS
76
Algebraic Method
K-Map Method
Tabular Method
Schienman Method
Simplified expressions lead to simplified circuits
A function’s truth-table representation is unique; its algebraic
expression is not
SIMPLIFY USING ALGEBRAIC THEOREMS
• Advantage:
Purely based on Boolean Algebra theorems
• Disadvantage:
No Suitable algorithm to apply (Trial type of method)
F = xy’ + xy +yz
= x(y’ + y) + yz
= x(1) + yz
= x + yz
• How many Gates we minimized?
SIMPLIFY USING KARNAUGH MAP
• Advantage:
Simplest and Widely accepted
• Disadvantage:
Applicable for only up to Six variables
A two-variable function has four possible minterms. We can re-arrange these minterms into a Karnaugh map (K-map).
x y minterm
0 0 x’y’
0 1 x’y
1 0 xy’
1 1 xy
Y 0 1
X 0 x’y’ x’y
1 xy’ xy
Y’ Y
X’ x’y’ x’y
X xy’ xy
SIMPLIFY USING KARNAUGH MAP
For a three-variable expression with inputs x, y, z, the arrangement of
minterms is more tricky
YZ 00 01 11 10
X 0 x’y’z’ x’y’z x’yz x’yz’
1 xy’z’ xy’z xyz xyz’
YZ00 01 11 10
0 m0 m1 m3 m2X1 m4 m5 m7 m6
x y z minterm
0 0 0 x’y’z’ 0 0 1 x’y’z 0 1 0 x’yz’ 0 1 1 x’yz
1 0 0 xy’z’ 1 0 1 xy’z 1 1 0 xyz’ 1 1 1 xyz
y’ y
x’ x’y’z’ x’y’z x’yz x’yz’
x xy’z’ xy’z xyz xyz’
z’ z z’
Y
m 0 m1 m 3 m 2
X m 4 m 5 m7 m 6
Z
SIMPLIFY USING KARNAUGH MAP
80
• With this ordering, any group of 2, 4 or 8 adjacent squares on the map contains common literals that can be factored out.
• “Adjacency” includes wrapping around the left and right sides:
•We’ll use this property of adjacent squares to do our simplifications.
x’y’z + x’yz= x’z(y’ + y)= x’z 1= x’z
Y
x’y’z’ x’y’z x’yz x’yz’
X xy’z’ xy’z xyz xyz’
Z
x’y’z’ + xy’z’ + x’yz’ + xyz’= z’(x’y’ + xy’ + x’y + xy)= z’(y’(x’ + x) + y(x’ + x))= z’(y’+y)= z’
Y
x’y’z’ x’y’z x’yz x’yz’
X xy’z’ xy’z xyz xyz’
Z
SIMPLIFY USING KARNAUGH MAP
•K-maps define Boolean functions.
•K-maps are equivalent to Truth Tables or Boolean Expressions.
•K-maps aid visually identifying Prime Implicants (blocks of 2, 4, 8, ... adjacent squares whose values are 1) and Essential Prime Implicants (Prime Implicants that contain a 1-minterm that is not included in any other Prime Implicants) in each Boolean function.
•K-maps are good for manual simplification of Boolean functions.
SIMPLIFY USING KARNAUGH MAP
• Imagine a two-variable sum of minterms:
x’y’ + x’y
• Both of these minterms appear in the top row of a Karnaugh map, which means that they both contain the literal x’.
• What happens if you simplify this expression using Boolean algebra?x’y’ + x’y = x’(y’ + y) [ Distributive ]
= x’ 1 [ y + y’ = 1 ]= x’ [ x 1 = x ]
Y
x’y’ x’y
X xy’ xy
SIMPLIFY USING KARNAUGH MAP
• Another example expression is x’y + xy.
• Both minterms appear in the right side, where y is uncomplemented.• Thus, we can reduce x’y + xy to just y.
• How about x’y’ + x’y + xy?
• We have x’y’ + x’y in the top row, corresponding to x’.• There’s also x’y + xy in the right side, corresponding to
y.• This whole expression can be reduced to x’ + y.
Y
x’y’ x’y
X xy’ xy
Y
x’y’ x’y
X xy’ xy
SIMPLIFY USING KARNAUGH MAP
84
Let’s consider simplifying f(x,y,z) = xy + y’z + xz.
First convert the expression into a sum of minterms form, if it’s not already.
• The easiest is to make a truth table , and then read off the minterms.
• You can either write out the literals or use the minterm shorthand.
Here is the truth table and sum of minterms for our example:
x y z f (x,y,z)
0 0 0 00 0 1 10 1 0 00 1 1 0
1 0 0 01 0 1 11 1 0 11 1 1 1
f(x,y,z) = x’y’z + xy’z + xyz’ + xyz
= m1 + m5 + m6 + m7
SIMPLIFY USING KARNAUGH MAP
85
• Next is drawing and filling in the K-map.
• Put 1s in the map for each minterm, and 0s in the other squares.
• use either the minterm or the shorthand to show where the 1s and 0s belong.
• In our example, we can write f(x,y,z) in two equivalent ways.
• In either case, the resulting K-map is shown below.
Y
x’y’z’ x’y’z x’yz x’yz’
X xy’z’ xy’z xyz xyz’
Z
f(x,y,z) = x’y’z + xy’z + xyz’ + xyz
Y
m0 m1 m3 m2
X m4 m5 m7 m6
Z
f(x,y,z) = m1 + m5 + m6 + m7
Y
0 1 0 0
X 0 1 1 1
Z
SIMPLIFY USING KARNAUGH MAP
• Fill in the K-map directly from a truth table.
• The output in row i of the table goes into square mi of the K-map.
• Remember that the rightmost columns of the K-map are “switched.”
Y
m0 m1 m3 m2
X m4 m5 m7 m6
Z
x y z f (x,y,z)
0 0 0 00 0 1 10 1 0 00 1 1 0
1 0 0 01 0 1 11 1 0 11 1 1 1
Y
X
Z
Y
0 1 0 0
X 0 1 1 1
Z
SIMPLIFY USING KARNAUGH MAP
• The most difficult step is grouping together all the 1s in the K-map.
• Make rectangles around groups of one, two, four or eight 1s.
• All of the 1s in the map should be included in at least one rectangle.
• Do not include any of the 0s.
• Each group corresponds to one product term. For the simplest result:
• Make as few rectangles as possible, to minimize the number of products in the final expression.
• Make each rectangle as large as possible, to minimize the number of literals in each term.
• It’s all right for rectangles to overlap, if that makes them larger.
Y
0 1 0 0
X 0 1 1 1
Z
SIMPLIFY USING KARNAUGH MAP
• Finally, you can find the Minimal Sum of Product (MSP).
• Each rectangle corresponds to one product term.
• The product is determined by finding the common literals in that rectangle.
• For our example, we find that xy + y’z + xz = y’z + xy.
Y
0 1 0 0
X 0 1 1 1
Z
Y
x’y’z’ x’y’z x’yz x’yz’
X xy’z’ xy’z xyz xyz’
Z
SIMPLIFY USING KARNAUGH MAP
• Simplify the sum of minterms
• The final MSP here is x’z + y’z + xyz’.
Y
m0 m1 m3 m2
X m4 m5 m7 m6
Z
Y
0 1 1 0
X 0 1 0 1
Z
SIMPLIFY USING KARNAUGH MAP
•Grouping minterms is similar to the three-variable case, but:• You can have rectangular groups of 1, 2, 4, 8 or 16
minterms.
• You can wrap around all four sides
Y
m0 m1 m3 m2
m4 m5 m7 m6
m12 m13 m15 m14X
Wm8 m9 m11 m10
Z
Y
w’x’y’z’ w’x’y’z w’x’yz w’x’yz’
w’xy’z’ w’xy’z w’xyz w’xyz’
wxy’z’ wxy’z wxyz wxyz’X
Wwx’y’z’ wx’y’z wx’yz wx’yz’
Z
SIMPLIFY USING KARNAUGH MAP
Simplify w’y’z’ + wz + xyz + w’y
The resulting MSP is w’z’ + wz + yz or w’z’ + wz + w’y
Y
w’x’y’z’ w’x’y’z w’x’yz w’x’yz’
w’xy’z’ w’xy’z w’xyz w’xyz’
wxy’z’ wxy’z wxyz wxyz’ X
W wx’y’z’ wx’y’z wx’yz wx’yz’
Z
Y
1 0 1 1
1 0 1 1
0 1 1 0 X
W 0 1 1 0
Z
Y
X
W
Z
Y
1 0 1 1
1 0 1 1
0 1 1 0 X
W 0 1 1 0
Z
KMAP WITH DON’T CARE CONDITIONS
92
• You don’t always need all 2n input combinations in an n-variable function.• If you can guarantee that certain input combinations
never occur.• If some outputs aren’t used in the rest of the circuit.
• We mark don’t-care outputs in truth tables and K-maps with Xs.
• Within a K-map, each X can be considered as either 0 or 1. You should pick the interpretation that allows for the most simplification.
x y z f (x,y,z)
0 0 0 00 0 1 10 1 0 X0 1 1 0
1 0 0 01 0 1 11 1 0 X1 1 1 1
KMAP WITH DON’T CARE CONDITIONS
93
• Minimize the given Boolean Expression
This notation means that input combinations wxyz = 0111, 1010 and 1101
(corresponding to minterms m7, m10 and m13) are unused.
Y
1 0 0 1
1 1 x 0
0 x 1 1 X
W 1 0 0 x
Z
KMAP WITH DON’T CARE CONDITIONS
94
f(w,x,y,z) = (0,2,4,5,8,14,15), d(w,x,y,z) = (7,10,13)
Y
1 0 0 1
1 1 x 0 X
W 0 x 1 1
1 0 0 x
Z
All prime implicants are circled. We can treat X’s as 1s if we want, so the red group includes two X’s, and the light blue group includes one X.
The only essential prime implicant is x’z’. (An essential prime implicant is one that covers a minterm that is covered by no other prime implicants.)
The MSP is x’z’ + wxy + w’xy’. It turns out some of the groups are redundant; we can cover all of the minterms in the map without them.
TABULAR METHOD OF MINIMIZATION
95
• The tabular method is particularly useful when expression is having a large number of variables.
• The method reduces a function in SOP form to a set of prime implicants from which as many variables are eliminated as possible. These prime implicants are then examined to see if some are redundant.
• The tabular method makes repeated use of the law A + = 1. As usual a variable in true form is denoted by 1, in inverted form by 0, and the absence of a variable by a dash ( - )
TABULAR METHOD OF MINIMIZATION
96
•Rules of Tabular Method
Consider a function of three variables f(A, B, C)
Consider the function:
TABULAR METHOD OF MINIMIZATION
97
• Listing the two minterms shows they can be combined
• Now consider the following
• Note that these variables cannot be combined
TABULAR METHOD OF MINIMIZATION
98
• The number of 1's in a term is significant and is referred to as its index.
For example: f(A, B, C, D)
0000...........................Index 0 0010, 1000.................Index 1 1010, 0011, 1001.......Index 2 1110, 1011.................Index 3 1111...........................Index 4
The necessary condition for combining two terms is that the indices
of the two terms must differ by one logic variable which must also
be the same
TABULAR METHOD OF MINIMIZATION
99
Z = f(A,B,C) =
Tabulate the index groups in a column and insert the
decimal value alongside
(0,1,4,5)
TABULAR METHOD OF MINIMIZATION
100
From the first list, we combine terms that differ by 1 digit only
from one index group to the next. These terms from the first list
are then separated into groups in the second list. Note that the
ticks are just there to show that one term has been combined with
another term. From the second list we can see that the expression
is now reduced to:
Z=A’B’+ B’C’ + B’C + AB’
TABULAR METHOD OF MINIMIZATION
101
From the second list note that the term having an index of 0 can
be combined with the terms of index 1. Bear in mind that the
dash indicates a missing variable and must line up in order to
get a third list. The final simplified expression is:
Z = B’
TABULAR METHOD OF MINIMIZATION
102
Consider the function
f(A, B, C, D) = (0,1,2,3,5,7,8,10,12,13,15)
In binary form.
(0000,0001,0010,0011,0101,0111,1000,1010,1100,1101,1111)
In the index form
(0,1,1,2,2,3,1,2,2,3,4)
TABULAR METHOD OF MINIMIZATION
103
TABULAR METHOD OF MINIMIZATION
104
The prime Implicants are
F = A’B’+ B’D’ + A’D + BD + AC’D’ + ABC’
The chart is used to remove redundant prime implicants. A grid is
prepared having all the prime implicants listed at the left and all
the minterms of the function along the top. Each minterm covered
by a given prime implicant is marked in the appropriate position.
TABULAR METHOD OF MINIMIZATION
105
TABULAR METHOD OF MINIMIZATION
106
From the above chart
BD is an essential prime implicant. It is the only prime
implicant that covers the minterm decimal 15 and it
also includes 5, 7 and 13.
B’D’ is also an essential prime implicant. It is the only
prime implicant that covers the minterm denoted by
decimal 10 and it also includes the terms 0, 2 and 8.
107
TABULAR METHOD OF MINIMIZATION
The other minterms of the function are 1, 3 and 12
Minterm 1 is present in A’B’& A’D similarly Minterm 3
Therefore use either of these prime implicants for these minterms.
Minterm 12 is present in AC’D’ & ABC’ either can be used.
108
TABULAR METHOD OF MINIMIZATION
F = A’B’+ B’D’ + BD + AC’D’
or
F = A’D+ B’D’ + BD + AC’D’
or
F = A’B’+ B’D’ + BD + ABC’
or
F = A’D + B’D’ + BD + ABC’