Digital Electronics, 2003
Binary Logic and Boolean algebra
Boolean algebra: Devised for dealing mathematically with philosophical propositions which have ONLY TWO possible values: TRUE or FALSE, Light ON or OFF.
SW1 Lamp R
BC
SW1 Open
>> Lamp is OFF
SW1 Closed >> Lamp is ON
Two states: SW1 OPEN CLOSED Lamp OFF ON
Truth Table
Ovidiu Ghita
Page 1
Digital Electronics, 2003
Electronic Systems: Analog >> Continuous System Digital >> Discrete System In Boolean algebra the TWO possible conditions can be represented by the DIGITS 0 and 1. Binary Digits Bits. Light ON = 1 = +5V = HIGH Light OFF = 0 = 0V = LOW If we define: Open = 0, CLOSED = 1 Then: SW1 0 1 Lamp 0 1
Boolean algebra deals with the rules which govern various operations between the binary variables.
Ovidiu Ghita
Page 2
Digital Electronics, 2003
AND operation: Describes events which can occur IF and only IF 2 or more other events are TRUE. Consider:
A B L R
The truth table is: A B L
OFF OFF OFF ON
A
0 0 1 1
B
0 1 0 1
L
0 0 0 1
OPEN OPEN OPEN CLOSED CLOSED OPEN CLOSED CLOSED
Lamp will light ONLY when the switches A and B are CLOSED, i.e. A and B both 1 NOTATION: C = A.B C = AB
Ovidiu Ghita
Boolean Equation
Page 3
Digital Electronics, 2003
SYMBOL: AND gate:
OR Operation: Describes events which can occur IF at LEAST ONE of the other events are TRUE. Consider:
+ A
B L R
Switches in parallel, lamp will light when A OR B are closed, i.e. A or B = 1 or Both 1 A B L
OFF ON ON ON
A
0 0 1 1
B
0 1 0 1
L
0 1 1 1
Page 4
OPEN OPEN OPEN CLOSED CLOSED OPEN CLOSED CLOSED
Ovidiu Ghita
Digital Electronics, 2003
NOTATION: C = A + B SYMBOL: OR gate:
NOT operation: Changes a statement from TRUE to FALSE and viceversa, i.e. inversion Consider:
+
V
R
A R
The Truth table is: A
OPEN CLOSED
L
ON OFF
A
0 1
L
1 0
When A is CLOSED virtually NO CURRENT flows through L, so it is effectively OFF.
Ovidiu Ghita Page 5
Digital Electronics, 2003
NOTATION: C = A SYMBOL: NOT gate
Ovidiu Ghita
Page 6
Digital Electronics, 2003
BASIC LAWS OF BOOLEAN ALGEBRA
1. COMUTATIVE LAW:
A+B = B+A A.B =B.A
2. ASSOCIATIVE LAW:
A + (B + C) = (A + B) + C A(BC) = (AB)C
3. DISTRIBUTIVE LAW:
A(B + C) = AB + AC
THESE LAWS CAN BE EXTENDED TO INCLUDE ANY NUMBER OF VARIABLES.
Ovidiu Ghita
Page 7
Digital Electronics, 2003
BASIC RULES OF BOOLEAN ALGEBRA
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12.
A+0=A A+1=1 A.0 = 0 A.1 = A A+A=A A+A=1 A.A=A A.A=0 A =A A + AB = A A + AB = A + B (A+B)(A+C) = A+BC
Ovidiu Ghita
Page 8
Digital Electronics, 2003
PROOF OF RULES 10, 11, 12: Rule 10: A+AB = A(1+B) =A.1 (Rule 2) =A (Rule 4) Rule 11: A + AB = = (A + AB) + AB = (AA + AB) + AB = AA +AB + AA + AB i.e. adding AA =0 = (A+A)(A + B) = 1 . (A + B) = A+B Rule 12: (A + B)(A + C) = = AA + AC + AB + BC = A +AC +AB +BC = A(1+C) + AB + BC = A . 1 + AB + BC = A + AB + BC = A(1 + B) + BC = A .1 + BC = A + BC
(Rule 10) (Rule 7) (Rule 8) (Factoring) (Rule 6)
(Distrib.) (Rule 7) (Distrib.) (Rule 4) (Rule 2) (Distrib.) (Rule 2) (Rule 4)
Ovidiu Ghita
Page 9
Digital Electronics, 2003
DE MORGANS THEOREMS 1. AB = A + B
THIS STATES THAT THE INVERSE (i.e.) OF A PRODUCT [AND] IS EQUAL TO THE SUM [OR] OF THE COMPLEMENTS
2. A + B = A . B
THIS STATES THAT THE INVERSE (COMPLEMENT) OF A SUM [OR] IS EQUAL TO THE PRODUCT [AND] OF THE COMPLEMENTS
TWO VERY IMPORTANT THEOREMS
THESE THEOREMS CAN BE EXTENDED TO COVER SEVERAL VARIABLES:
ABC = A + B + C A+B+C =A.B.C
Ovidiu Ghita Page 10
Digital Electronics, 2003
PROOF OF (1): AB = A + B A 0 0 1 1 B AB AB A 0 0 1 1 1 0 1 1 0 0 1 0 1 1 0 0 B A+B 1 1 0 1 1 1 0 0
A B
AB
AB
=
A B B A A+B
Ovidiu Ghita
Page 11
Digital Electronics, 2003
PROOF OF (2): A + B = A . B A 0 0 1 1 B A+B A 0 0 1 1 1 1 0 1 0 1 1 0 B A+B A . B 1 1 1 0 0 0 1 0 0 0 0 0
A B
A+B
A+B
=
A B B A AB
Ovidiu Ghita
Page 12
Digital Electronics, 2003
EXCLUSIVE OR OPERATION EVENTS WHICH ARE TRUE ONLY IF AND ONLY IF ONE OF THE MOTIVATING EVENTS ARE TRUE ABREVIATED: XOR TRUTH TABLE:
A 0 0 1 1 B 0 1 0 1
A XOR B
0 1 1 0
NOTATION: F = A B
A F
SYMBOL:
Ovidiu Ghita
Page 13
Digital Electronics, 2003
F=1 IF A=1 OR B=1 BUT NOT A = B = 1 >> F = (A + B)(AB)
A B F=(A+B)(AB) A+B
AB
ANOTHER WAY OF EXPRESING XOR
F = (A+B)(AB) = (A+B)(A+B) (De Morgan)
= AA + AB + AB + BB (Distrib.) = AB + AB
A B F = AB + AB
(Rule 8)
Ovidiu Ghita
Page 14
Digital Electronics, 2003
NAND OPERATION DE MORGANS THEOREMS MEANS THAT ANY BOOLEAN OPERATION CAN BE PERFOMED BY A COMBINATION OF AND AND NOT OPERATIONS A VERY USEFULL OPERATION IS THE NAND i.e. AN AND OPERATION FOLLOWED BY A NOT OPERATION TRUTH TABLE:
A 0 0 1 1 B 0 1 0 1
A NAND B
1 1 1 0
NOTATION: F = A . B
Ovidiu Ghita
Page 15
Digital Electronics, 2003
SYMBOL NAND GATE:
A B F = AB
=
A B AB F = AB
IMPORTANT NOTE: ANY BOOLEAN FUNCTION MAY BE IMPLEMENTED USING ONLY NAND GATES!
1. NOT GATE (INVERTER)
F = AA = A
Ovidiu Ghita
Page 16
Digital Electronics, 2003
2. AND GATE
A B AB F = AB = AB
3. OR GATE
F=AB=A+B
Ovidiu Ghita
Page 17
Digital Electronics, 2003
NOR OPERATION
FROM DE MORGANS THEOREMS, WE ALSO CAN EXPRESS ANY BOOLEAN FUNCTION IN TERMS OF OR AND NOT OPERATIONS A NOR OPERATION IS A OR OPERATION FOLLOWED BY A NOT OPERATION TRUTH TABLE: A 0 0 1 1 B 0 1 0 1
A NOR B
1 0 0 0
NOTATION: F = A + B SYMBOL: NOR GATE
A B F=A+B
Ovidiu Ghita
Page 18
Digital Electronics, 2003
1. NOT GATE (INVERTER)
A F=A+A=A
2. OR GATE
A B A+B F=A+B=A+B
3. AND GATE
A A F = A + B = AB
B B
Ovidiu Ghita
Page 19
Digital Electronics, 2003
ANY COMPLEX BOOLEAN FUNCTION CAN BE IMPLEMENTED USING ONLY
NOR GATES. E.G. >> F = (A + B)(C + D) = (A + B) + (C + D)
A B C D
A+B F
C+D
IN PRACTICE NAND GATES ARE USED MAINLY (E.G. 7400) AS THEY ARE THE CHEAPEST.
Ovidiu Ghita
Page 20
Digital Electronics, 2003
EXEMPLE 1: IMPLEMENT THE XOR OPERATION USING NAND GATES.
F = A B = AB + AB = AB . AB
A B B
AB
F=A A
AB
EXEMPLE
IMPLEMENT THE FOLOWING AND-OR FUNCTION USING NAND GATES:
2:
F = AB + CD
Ovidiu Ghita Page 21
Digital Electronics, 2003
F = AB + CD = AB . CD
A B C D
AB F = AB . CD
CD
SUMMARY
BOOLEAN ALGEBRA: SYMBOLS, RULES EXPRESS THE LOGICAL FUNCTIONS AND, OR, NOT, XOR, NAND AND NOR MATHEMATICALLY BASIC LAWS OF BOOLEAN ALGEBRA AND HOW TO APPLY THEM. DE MORGANS THEOREMS AND HOW TO APPLY THEM.
Ovidiu Ghita Page 22
Digital Electronics, 2003
LOGIC DESIGN AIM: TO DESIGN DIGITAL SYSTEMS
USING THE RULES OF ALGEBRA (FLOYD 4-5/4-6). BOOLEAN
DESIGNING A LOGIC SYSTEM: 1. DEFINE THE PROBLEM 2. WRITE THE TRUTH TABLE 3. WRITE THE BOOLEAN (OR LOGIC) EQUATIONS 4. SIMPLIFY EQUATIONS TO
MINIMISE THE NUMBER OF GATES 5. DRAW A LOGIC DIAGRAM
6. IMPLEMENT THE LOGIC DIAGRAM
USING ELECTRONIC CIRCUITRY
NEXT, WE WILL INVESTIGATE MINIMISATION TECHNIQUES USING BOOLEAN ALGEBRA LAWS.
Ovidiu Ghita Page 23
Digital Electronics, 2003
EXAMPLE 1:
WE HAVE A CAR WITH 3 MAIN CONTROL SYSTEMS. WE WANT A WARNING LAMP TO LIGHT IF ANY OF THE FOLLOWING CONDITIONS OCCUR: 1. 2. 3. 4. ALL SYSTEMS ARE DOWN SYSTEMS A,B DOWN BUT C IS OK SYSTEMS A,C DOWN BUT B IS OK SYSTEM A DOWN BUT B,C ARE OK
1. DEFINE THE PROBLEM
NOTE: THERE ARE TWO POSSIBLE STATES FOR EACH SYSTEM. ASSIGN: SYSTEM: DOWN = 0, LIGHT: OFF = 0,
SYSTEM A SYSTEM B SYSTEM C
OK = 1 ON = 1
F
WARNING LIGHT
LOGIC BLOCK DIAGRAM
Ovidiu Ghita Page 24
Digital Electronics, 2003
1. TRUTH TABLE
A B C
0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1
F
1 1 1 1 0 0 0 0
3. WRITE LOGIC EQUATIONS F = ABC + ABC + ABC + ABC 4. SIMPLYFY EQUATIONS F = A(BC + BC + BC + BC) = A[B(C + C) + B(C + C)] = A(B . 1 + B . 1) = A(B + B) =A.1=A
Ovidiu Ghita
>> F = A
Page 25
Digital Electronics, 2003
5. LOGIC DIAGRAM
A F=A
EXAMPLE 2:
4 SYSTEMS : A, B, C AND D A WARNING BUZZER IS TO SOUND WHEN THE FOLLOWING CONDITIONS OCCUR. (a) (b) (c) (d) A AND B ARE DOWN A,C AND D ARE DOWN B,C AND D ARE DOWN B AND D ARE DOWN
1. DEFINE THE PROBLEM SYSTEM: DOWN = 0, OK = 1 BUZZER: OFF = 0, ON = 1
A B C D
Ovidiu Ghita
F F Buzzer
Page 26
Digital Electronics, 2003
2. TRUTH TABLE:
A
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
B
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
C
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
D
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 0 0 0 1 0 1 0 0 0 0 0
F
(a) (d) (a) (a) (d) (a) (b)
(c) (d) (d)
3. LOGIC EQUATION:
F = ABCD + ABCD + ABCD + ABCD + ABCD + ABCD + ABCD
Ovidiu Ghita Page 27
Digital Electronics, 2003
4. SYMPLIFY: F = ABC(D + D) + ABC(D + D) + ABCD + ABD (C + C) = ABC . 1 + ABC . 1 + ABD + ABCD = AB(C + C) + ABD + ABCD = AB . 1 + ABD + ABCD = B(A + AD) + ABCD = B(A + D) + ABCD = = AB + BD + ABCD = AB + D(B + ABC) = AB + D(B + BAC) = AB + DB + ACD >> F = AB + BD + ACD >> SUM OF PRODUCT FORM (*) (*)
NOTE: A + AB = A + B (Rule 11)
Ovidiu Ghita
Page 28
Digital Electronics, 2003
5. LOGIC DIAGRAM
ASSUMNING A,B,C,D ARE AVAILABLE AS INPUTS, WE CA IMPLEMENT THIS 3 WAYS: (a) AND OR CONFIGURATION
A B A C D B D F AB
(b) NAND CONFIGURATION:
F = AB + BD + ACD F = AB + BD + ACD = AB . BD . ACD F=F = AB . BD . ACD
Ovidiu Ghita Page 29
(De Morgan)
Digital Electronics, 2003
A B A C D B D AB F
(c) NOR CONFIGURATION:
F = AB + BD + ACD = A+B + B+D + A+C+D (DM) F = F = A+B + B+D + A+C+D
A B A C D B D A+B F F
NOTE: MORE GATES >>> LONGER PROPAGATION DELAYS, i.e. TIME FOR SIGNAL TO GO FROM INPUT TO OUTPUT
Ovidiu Ghita Page 30
Digital Electronics, 2003
MINIMISATION USING KARNAUGH MAPS
WE HAVE SEEN THAT MINIMISATION USING BOOLEAN ALGEBRA IS A BIT CUMBERSOME.
WE CAN REPRESENT ANY LOGICAL EXPRESION ON A DIAGRAM CALLED A KARNAUGH MAP.
THIS MAP PROVIDES A SYSTEMATIC METHOD OF SIMPLYFYING A BOOLEAN FUNCTION TO PRODUCE THE SIMPLEST SUM OF PRODUCTS EXPRESION
KARNAUGH MAP FORMAT: FOR N VARIABLES WE HAVE 2 COMBINATIONS, EACH COMBINATION IS CONTAINED IN A KARNAUGH CELL
N
Ovidiu Ghita
Page 31
Digital Electronics, 2003
FOR 2 VARIABLES A, B: 22 = 4 PRODUCTS >> 4 CELLS: AB, AB, AB AND AB. THIS IS REPRESENTED IN A KARNAUGH MAP AS FOLLOWS: B B
A AB AB A AB AB
THE KARNAUGH MAP IS FILLED IN BY PUTTING A 1 IN EACH CELL THAT LEADS TO A 1 OUTPUT. 0 IS PLACED IN ALL THE OTHER CELLS. EXAMPLE: (a) REPRESENT F = XY BY ITS KARNAUGH MAP X Y 1 Y 0
Ovidiu Ghita
X 0 0
F =1 WHEN XY OCCURS OTHER >> F=0
Page 32
Digital Electronics, 2003
(a) REPRESENT F = XY + XY X Y 0 Y 1 X 1 0
F=1 FOR PRODUCT TERMS XY, XY ONLY. THE EXPRESSION FOR F MUST BE WRITTEN SUM-OF-PRODUCTS FORM TO BEGIN WITH.
FOR 3 VARIABLES A,B,C 23 = 8 PRODUCT TERMS >> 8 CELLS BC A ABC A ABC BC ABC ABC BC ABC ABC BC ABC ABC
Ovidiu Ghita
Page 33
Digital Electronics, 2003
EXAMPLE: F = ABC + ABC + ABC DO AS EXERCISE.
RESULT: BC A A 0 1 BC 1 1 BC 0 0 BC 0 0
NOTE: WHEN MOVING HORIZONTALY OR VERTICALLY WE SHOULD ONLY ENCOUNTER A CHANGE IN 1 VARIABLE.
Ovidiu Ghita
Page 34
Digital Electronics, 2003
FOR 4 VARIABLES A,B,C,D 24 = 16 PRODUCT TERMS >> 16 CELLS CD AB ABCD AB ABCD AB ABCD AB ABCD EXAMPLE:
A 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
Ovidiu Ghita
CD ABCD ABCD ABCD ABCD
CD
CD
ABCD ABCD ABCD ABCD ABCD ABCD ABCD ABCD
B 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
C 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
F 1 1 0 0 0 1 1 0 0 1 1 0 0 0 0 1
Page 35
Digital Electronics, 2003
F = ABCD + ABCD + ABCD + ABCD + ABCD + ABCD + ABCD K-MAP:
CD 00 01 11 10 AB 00 1 1 0 0 01 0 1 0 1 11 0 0 1 0 10 0 1 0 1
NOTE: FOR A 4 VARIABLE K-MAP EACH CELL HAS 4 ADJACENT CELLS DONT FORGET THAT THE K-MAP IS CONSIDERED CONTINOUS (ROLLED OVER) SO THAT THE TOP ROW IS ADJACENT TO THE BOTTOM ROW AND THE RIGHT COLUMN IS ADJACENT TO THE LEFT COLUMN
Ovidiu Ghita
Page 36
Digital Electronics, 2003
EXAMPLE: THE 4 CELLS ADJACENT TO ABCD ARE ABCD, ABCD, ABCD AND ABCD
CD AB AB AB AB CD CD CD
# # #
Ovidiu Ghita
Page 37
Digital Electronics, 2003
MINIMISATION BY GROUPING CELLS
WE CAN MINIMISE ANY BOOLEAN EXPRESSION BY GROUPING ADJACENT CELLS CONTAINING 1s ACCORDING TO THE FOLLOWING RULES: 1. ADJACENT CELLS ARE CELLS THAT ONLY DIFFER BY A SINGLE VARIABLE. >> E.G. ABCD AND ABCD 2. THE 1s IN ADJACENT CELLS MUST BE COMBINED IN GROUPS OF 2N, I.E. 1,2,4,8,16 ETC. 3. EACH GROUP OF 1s SHOULD BE MAXIMISED TO INCLUDE THE LARGEST NUMBER OF ADJACCENT CELLS POSSIBLE IN ACCORDANCE WITH RULE 2 4. EVERY 1 ON THE MAP MUST BE INCLUDED IN AT LEAST ONE GROUP (OR SUBCUBE). THERE CAN BE OVERLAPPING GROUPS IF THEY INCLUDE NON_COMMON 1s PROCEDURE: WE DRAW A LOOP ABOUT THE CELLS IN ORDER TO DEFINE OUR SUBCUBE.
Ovidiu Ghita
Page 38
Digital Electronics, 2003
EXAMPLES: CD 00 01 11 10 00 01 11 10
AB
0 1 1 0
0 1 1 1
BC
1 1 1 0
BC
1 1 1 0
BC
BC A A
0 1
BC
0 1
BC
0 0
BC
0 0
BC
A A
0 1
BC
0 0
BC
0 0
BC
0 1
BC
A A
1 1
0 0
0 0
1 1
Page 39
Ovidiu Ghita
Digital Electronics, 2003
EXERCISE: DRAW THE SUBCUBES FOR THE FOLLOWING EXPRESSIONS: (a) F = ABCD + ABCD + ABCD + ABCD (b) F = ABCD + ABCD + ABCD + ABCD + ABCD + ABCD + ABCD + ABCD
(a) AB AB AB AB (b) AB AB AB AB
Ovidiu Ghita
CD CD CD CD
1 0 0 1
0 0 0 0
0 0 0 0
1 0 0 1
CD CD CD CD
0 1 1 0
0 1 1 0
0 1 1 0
0 1 1 0
Page 40
Digital Electronics, 2003
SYMPLIFYING THE EXPRESSION
1. EACH SUBCUBE OF 1s CREATES A
PRODUCT TERM COMPOSED OF ALL VARIABLES THAT APPEAR IN ONLY ONE FORM (COMPLEMENTED OR NOT) WITHIN THE GROUP. VARIABLES THAT APPEAR BOTH UNCOMPLEMENTED AND COMPLEMENTED ARE ELLIMINATED I.E. >> THE ONE THAT CHANGES WE DROP
2. THE FINAL SIMPLIFIED EXPRESSION
IS FORMED BY PRODUCT TERMS SUBCUBES
SUMMING OF ALL
THE THE
THIS WILL BECAME CLEARER AFTER WE LOOK AT SOME EXAMPLES.
Ovidiu Ghita
Page 41
Digital Electronics, 2003
EXAMPLES: 1.
CD CD CD CD AB AB AB AB
0 1 1 0
0 1 1 1
1 1 1 0
ACD
1 1 1 0
AC B
F = B + AC + ACD
1. FROM THE 8 CELL GROUP THE PRODUCT TERM IS B, WITH THE REFERENCE TO RULE 1, A AND A, C AND C, D AND D ALL APPEAR. >> THEY ARE ELLIMINATED FROM THE PRODUCT TERM; HENCE WE END UP WITH B. 2. SIMILARLY IN THE 4 CELL SUBCUBE D,D AND B,B ARE ELLIMINATED TO LEAVE US WITH AC. 3. IN THE 2 CELL SUBCUBE, B, B ARE ELLIMINATED TO LEAVE ACD
Ovidiu Ghita Page 42
Digital Electronics, 2003
THIS CAN BE UNDERSTOOD BY REMEMBERING THE FOLLOWING BOOLEAN RULE:
AX + AX = A(X + X) = A . 1= A
ELLIMINATE
FOR EXAMPLE: ABCD + ABCD = ACD (B + B) = ACD ABCD + ABCD + ABCD + ABCD = = ABC(D + D) + ABC(D + D)= = ABC + ABC = = AC(B + B) = AC IN GENERAL, A SUBCUBE OF 2M CELLS IN AN N VARIABLE K-MAP WILL HAVE M VARIABLES DIFFERING AND THE SUBCUBE CAN BE REPLACED BY ONE PRODUCT CONSISTING OF N M VARIABLES WHICH REMAIN CONSTANT.
Ovidiu Ghita Page 43
Digital Electronics, 2003
LAST EXAMPLE: N=4 >>> A,B,C,D 2M = 4 >>> M = 2 >>>> 4 2 = 2 VARIABLE PRODUCT = AC EXAMPLES: (a) F = ABCD + ABCD + ABCD + ABCD +ABCD + ABCD + ABCD CD CD CD CD AB AB AB AB AB
1 1 0 1
1 0 0 0
ACD
1 0 0 0
1 0 0 1
BD
3 SUBCUBES
F = AB + ACD + BD
Ovidiu Ghita
Page 44
Digital Electronics, 2003
(b) CD CD CD CD AB AB AB AB ABC
1 0 0 0
1 1 0 0
0 0 1 0
0 0 0 0
ABCD
ACD
F = ABC + ACD + ABCD
CONCLUDING NOTE: ALWAYS TRY TO OBTAIN THE REPRESENTATON THAT HAS THE FEWER NUMBER OF CUBES. EXAMPLE: BEST
1 0 0 0
1 1 1 0
0 1 1 0
1 1 0 0
1 0 0 0
1 1 1 0
0 1 1 0
1 1 0 0
1 0 0 0
1 1 1 0
0 1 1 0
1 1 0 0
4 SUBCUBES 4 SUBCUBES 3 SUBCUBES
Ovidiu Ghita Page 45
Digital Electronics, 2003
FEWER SUBCUBES: >> FEWER PRODUCT TERMS >> FEWER GATES >> MAXIMISE THE SIZE OF SUBCUBES >> SMALLER PRODUCT TERMS
AT THIS STAGE YOU SHOULD BE ABLE TO MINIMISE A BOOLEAN EXPRESSION BY: BOOLEAN ALGEBRA KARNAUGH MAP REDUCTION TECHNIQUES
Ovidiu Ghita
Page 46
Digital Electronics, 2003
NUMBER SYSTEMS
IN ANY NUMBER SYSTEM, THE POSITION OF EACH OF THE DIGITS INDICATES THE MAGNITUDE OF THE QUANTITY REPRESENTED AND CAN BE ASSIGNED A WEIGHT. THE VALUE OF THE NUMBER IS THE SUM OF THE DIGIT TIMES THEIR RESPECTIVE COLUMN WEIGHT.
EXAMPLE DECIMAL NUMBERS 23 = 2 * 10 + 3 * 1 = 20 + 3 I.E. >> DIGIT 2 HAS A WEIGHT OF 10 3 HAS A WEIGHT OF 1 AS INDICATED BY THEIR RESPECTIVE POSITIONS
THE BASE OF A NUMBER SYSTEM IS THE NUMBER OF DIFFERENT DIGITS THAT CAN OCCUR IN EACH POSITION
Ovidiu Ghita
Page 47
Digital Electronics, 2003
DECIMAL SYSTEM = BASE 10
10 DIGITS >>> 0 9 E.G. 2610 = 26
HEXADECIMAL SYSTEM = BASE 16
16 DIGITS >>> 0 9, AF E.G. 3A16 BINARY NUMBERS
THE BINARY NUMBER SYSTEM HAS A BASE OF 2, THE TWO BINARY DIGITS ARE 0 AND 1 EACH BINARY DIGIT IS CALLED A BIT THE POSITION OF A BIT DETERMINES ITS WEIGHT BUT NOW THE WEIGHT ASCENDS IN POWERS OF 2.
EXAMPLES: DECIMAL: 1110 = 1 * 101 + 1*100
Ovidiu Ghita
Page 48
Digital Electronics, 2003
BINARY 1012 = 1*22 + 0*21 + 1*20 = =4 + 0 + 1 = 510 10102 = 1*23 + 0*22 + 1*21 + 0*20 = 8 + 0 + 2 + 0 = 1010 11.0112 = 1*21 + 1*20 + 0*2-1 + 1*2-2 + 1*2-3 = 2 + 1 + 0 + 12 + 13 = 3 3
2 2
8
IN GENERAL:
AnAn-1A1A0A -1A -2A -m = An*2n + An-1*2n-1 +A1*21 + A0*20 + A -1*2-1 + A -2*2-2 + + A -m*2-m
WE FOLLOW THE ABOVE PROCEDURE WHEN WE WISH TO CONVERT FROM BINARY TO DECIMAL FORM
Ovidiu Ghita
Page 49
Digital Electronics, 2003
DECIMAL TO BINARY CONVERSION
TO CONVERT FROM DECIMAL TO BINARY WE REPEATEDLY DIVIDE BY 2 THE DECIMAL NUMBER, AND THE REMAINDERS ARE THE BITS OF THE RESULTING BINARY NUMBER EXAMPLES: 1. 1910 19 : 2 9:2 4:2 2:2 1:2 0
1 1 0 0 1
LSB
READ UP
MSB
REMAINDER
1910 = 100112 NOTE THE POSITION OF THE DECIMAL POINT, YOU READ UP FROM THE MSB MSB = MOST SIGNIFICANT BIT LSB = LEAST SIGNIFICANT BIT
Ovidiu Ghita Page 50
Digital Electronics, 2003
2.
2810
28 : 2 14 : 2 7:2 3:2 1:2 0
0 0 1 1 1
LSB
MSB
2810 = 111002 DECIMAL FRACTIONS:
THE ABOVE DESCRIBED METHOD DOES NOT WORK FOR FRACTIONS. HERE WE REPEATEDLY MULTIPLY THE FRACTION BY TWO (UNTIL THE FRACTIONAL PRODUCT IS ZERO) AND THE WHOLE NUMBER CARRYS ARE THE BITS OF THE RESULTING BINARY NUMBER.
EXAMPLE:
.437510
READ DOWN
.4375 * 2 .8750 * 2 .7500 * 2 .5000 * 2 .0000
CARRY CARRY CARRY CARRY
0 MSB 1 1 1 LSB
.437510 = .01112
Ovidiu Ghita Page 51
Digital Electronics, 2003
AGAIN, NOTE THE DECIMAL POINT POSITION AND READ DOWN.
MIXED DECIMAL NUMBERS
THESE MUST BE SPLIT INTO THEIR WHOLE AND FRACTIONAL PARTS, EACH PART CONVERTED SEPARATELY AND THE TWO PARTS ARE THEN ADDED.
EXAMPLE 13.7510 = 1310 + .7510 13 : 2 6:2 3:2 1:2 0
1 0 1 1
.75 * 2 .50 * 2 .00
1 1
13.7510 = 1101.112
Ovidiu Ghita
Page 52
Digital Electronics, 2003
BINARY NUMBERS BINARY 0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 1 21 DECIMAL 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 20 LSB
23 22 MSB
Ovidiu Ghita
Page 53
Digital Electronics, 2003
BINARY ADDITION
SIMILAR TO DECIMAL ADDITION BUT SIMPLER AS ONLY 0s AND 1s ARE ALLOWED. THE FOUR BASIC RULES ARE:
0+0=0 0+1=1 1+0=1 1 + 1 = 102 >> i.e. 0 WITH A CARRY OF 1 EXAMPLES: (a) 112 + 112 1102 310 + 310 610 15 + 20 3510 3.25+ 5.75 9.0010
Page 54
>>
i.e. 1+1+1 = 1 WITH A CARRY 1
(b) 1111 + 10100 >> 1000112 (c) 11.01 + 101.11 >> 1001.002
Ovidiu Ghita
Digital Electronics, 2003
LOGIC CIRCUITS
THE HALF ADDER: TO ADD 2 LEAST SIGNIFICANT BITS (LSB) WE DO NOT NEED A CARRY INPUT FROM A PREVIOUS STAGE. >> WE ONLY NEED A HALF ADDER THIS WILL HAVE TWO INPUTS A0, B0 AND TWO OUTPUTS S0 AND C0 A0 0 0 1 1 B0 0 1 0 1 S0 0 1 1 0 C0 0 0 0 1
A0 B0
HALF ADDER
C0 S0
S0 : SUM OUT C0: CARRY OUT THE LOGIC EQUATIONS ARE:
S0 = A0B0 + A0B0 = A B > (XOR Gate) C0 = A0B0 > (AND Gate)
Ovidiu Ghita Page 55
Digital Electronics, 2003
THE LOGIC DIAGRAM CAN ALSO BE EXPRESSED AS FOLLOWS:
A o Bo Co
Ao Bo
A o Bo So A o Bo
THE FULL ADDER:
FOR ALL OTHER BITS (EXCEPT THE LSB) A HALF ADDER WILL NOT SUFFICE BECAUSE THERE MAY BE A CARRY INPUT FROM A PREVIOUS STAGE.
Ovidiu Ghita
Page 56
Digital Electronics, 2003
A FULL ADDER HAS 3 INPUTS: AK, BK ,
CK-1
AND 2 OUTPUTS: SK, CK CK-1 = CARRY IN FROM THE PREVIOUS STAGE Ck = CARRY OUT TO THE NEXT STAGE
AK BK CK-1
FULL ADDER
SK CK
Ak Bk Ck-1 Sk Ck 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 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
Ovidiu Ghita Page 57
Digital Electronics, 2003
THE LOGIC EQUATIONS ARE: SK = AKBKCK-1 + AKBKCK-1 + AKBKCk-1 + AKBKCK-1 CK = AKBKCK-1 + AKBKCK-1 + AKBKCk-1 + AKBKCK-1
K-MAP FOR SK: AKBK 00 01 11 10 0 0 1 0 1 0 1 0 1 1
CK-1
NO SIMPLIFICATION POSSIBLE
Ovidiu Ghita
Page 58
Digital Electronics, 2003
K-MAP FOR CK: AKBK 00 01 11 10 0 0 0 1 0 1 1 1 1 0
CK-1
CK = BKCK-1 + AKBK + AKCK-1
THE LOGIC DIAGRAM FOR A FULL ADDER IS:
AK
BK SK
C K-1
CK
Ovidiu Ghita
Page 59
Digital Electronics, 2003
FULL ADDER USING HALF ADDERS
ONE HLF ADDER ADDS AK TO BK TO GIVE AN INTERMEDIATE SUM S K AND CARRY C K ANOTHER HALF ADDER ADDS S K AND CK-1 TO GIVE THE FINAL SUM SK AND ANOTHER INTERMEDIATE CARRY C K THERE WILL BE A FINAL CARRY IF EITHER C K OR C K ARE 1
AK BK C K-1
HALF ADDER
AK C' K = AK BK BK
HALF ADDER
C" K = C K-1 (AK AK BK + C K-1 (AK BK)
BK) AK BK C K-1
CK
Ovidiu Ghita
SK
Page 60
Digital Electronics, 2003
REMEMBER THE BOOLEAN OPERATION FOR HALF ADDER:
SK = AK BK CK = AKBK
FOR FULL ADDER:
SK = AK BK CK-1 CK = AKBK + CK-1(AK BK) PROOF: SK = AKBKCK-1 + AKBKCK-1 + AKBKCk-1
+ AKBKCK-1 = CK-1(AKBK + AKBK) + + CK-1(AKBK + AKBK) = CK-1(AK BK) + + CK-1(AK BK) = AK BK CK-1
CK = AKBKCK-1 + AKBKCK-1 + AKBKCk-1
+ AKBKCK-1 = = AKBK(CK-1 + CK-1) + CK-1(AKBK + AKBK) = = AKBK + CK-1(AK BK)
Ovidiu Ghita Page 61
Digital Electronics, 2003
THE PARALLEL ADDER: ALSO CALLED RIPPLE CARRY ADDER USED TO ADD TWO N-BIT NUMBERS. IT CONSISTS OF N FULL ADDERS WHERE THE CARRY OUTPUT OF EACH STAGE IS THE CARRY IN OF THE NEXT STAGE. EXAMPLE: 4-BIT PARALLEL ADDER ADD A3A2A1A0 AND B3B2B1B0
A3 B3 A2 B2 A1 B1 A0 B0 C-1 = 0
F.A.
C3
Overflow (S4)
F.A.
C2
F.A.
C1
F.A.
C0
LSB S3 S2 S1 S0
C3 = 1 >>> OVERFLOW A = 1010 B = 1001 Overflow (1)0011
Ovidiu Ghita
E.G.
(1010) (910) 310
Page 62
Digital Electronics, 2003
BINARY NEGATIVE NUMBERS
IN THE DECIMAL NUMBER SYSTEM NEGATIVE NUMBERS ARE DENOTED BY A MINUS SIGN. SINCE ONLY 0s AND 1s ARE ALLOWED BY BOOLEAN ALGEBRA WE MUST USE THESE DIGITS TO REPRESENT POSITIVE AND NEGATIVE NUMBERS. THERE ARE 3 DIFFERENT FORMS TO REPRESENT POSITIVE AND NEGATIVE NUMBERS IN BINARY
1. SIGNED MAGNITUDE FORM:
THE MAGNITUDE OF THE NUMBER IS IN NORMAL BINARY FORM THE EXTRA LEADING BIT IS USED FOR THE SIGN: 0 >>> POSITIVE 1 >>> NEGATIVE THIS REPRESENTATION IS ALSO CALLED SIGN PLUS MAGNITUDE
Ovidiu Ghita
Page 63
Digital Electronics, 2003
EXAMPLES: +3 = 0 0011 +14 = 0 1110 +5 = 0 0101 SIGN MAG. -3 = 1 0011 -14 = 1 1111 -5 = 1 0101 SIGN MAG.
NOTE THE ZERO AMBIGUITY: ZERO = 0 0000 OR 1 0000
2. ONES COMPLEMENT FORM:
FOR POSITIVE NUMBERS THE 1s COMPLEMENT IS FORMED BY PLACING A LEADING 0 TO THE LEFT OF THE MAGNITUDE.
E.G.
+1210 = 0 11002 +210 = 0 00102
FOR NEGATIVE NUMBERS WE INVERT (COMPLEMENT) EACH BIT OF THE CORRESPONDING POSITIVE NUMBER.
E.G.
Ovidiu Ghita
-1210 = 1 00112 -210 = 1 11012
Page 64
Digital Electronics, 2003
IF WE HAVE A 5-BIT 1s COMPLEMENT NUMBER THEN: FIRST BIT (MSB) >>> SIGN 4 OTHER BITS >>> MAGNITUDE 0 1111 0 1110 0 1101 0 0 1 1 1 0001 0000 1111 1110 1101 +1510 +1410 +1310 +110
ZERO AMBIGUITY
-110 -210 -1410 -1510
1 0001 1 0000
Ovidiu Ghita
Page 65
Digital Electronics, 2003
ONES COMPLEMENT ADDITION (a) ADDITION OF 2 POSITIVE NUMBERS E.G. +7 +5 +12 00111 00101 01100 +11 01011 +4 00100 +15 01111
(b) ADDITION OF POSITIVE AND NEGATIVE NUMBERS E.G. +3 -12 -9 0 0011 1 0011 1 0110
NEGATIVE NUMBER
= 3 + (-12) 1 0110 >>> - [0110] = -1001 = -9
+9 -4 +5
0 1001 1 1011 (1)0 0100 1 +5 = 0 0101
ADD END AROUND CARRY
Ovidiu Ghita
Page 66
Digital Electronics, 2003
*** DONT FORGET END AROUND CARRY +12 -12 0 0 1100 1 0011 1 1111 = 0
(c) ADD 2 NEGATIVE NUMBERS
ALWAYS WILL BE AN END AROUND CARRY
-3 -11 -14
1 1100 1 0100 (1)1 0000 1 1 0001
-4 1 1011 -7 1 1000 -11 (1)1 0011 1 1 0100
1 0100 >> -[0100] = -11
1 0001 >> -[0001] = -14
THUS, A 5-BIT 1s COMPLEMENT ADDER CAN BE BUILT FROM 5 FULL ADDERS
Ovidiu Ghita
Page 67
Digital Electronics, 2003
A4 B4
A3 B3
A2 B2
A1 B1
A0 B0
F.A.
C4
F.A.
C3
F.A.
C2
F.A.
C1
F.A.
C0
S4
S3
S2
S1
S0
END AROUND CARRY RANGE: +15 -15
THE MOST SIGNIFICANT CARRY OUTPUT IS ALWAYS CONNECTED TO THE LEAST SIGNIFICANT CARRY INPUT THERE IS AN END AROUND CARRY IF C4=1, OTHERWISE THE LEAST SIGNIFICANT CARRY INPUT IS 0.
Ovidiu Ghita
Page 68
Digital Electronics, 2003
3. TWOS COMPLEMENT FORM:
MOST POPULAR BINARY FORM SIMILAR TO 1s COMPLEMENT BUT FOR NEGATIVE NUMBERS ADD 1 TO THE 1s COMNPLEMENT RESULT E.G. +5
-5 -5
= 0 0101
= 1 1010 1s COMPLEMENT 1 = 1 1011 2s COMPLEMENT
+0 = 0 0000 1 1111 INVERT 1 ADD 1 (1) 0 0000 = -0 *** UNAMBIGOUS ZERO ! +16 >>> NOT POSSIBLE -16 >>> 1 0000
(a) ADDING TWO POSITIVE NUMBERS STRAIGHTFORWARD PROVIDING THERE IS NO OVERFLOW
Ovidiu Ghita Page 69
Digital Electronics, 2003
E.G.
5-BIT NUMBERS +12 +3 +15 0 1100 0 0011 0 1111
+5 0 0101 +9 0 1001 +14 0 1110
(b) ADDING TWO NEGATIVE NUMBERS -6 -9 -15 1 1010 1 0111 (1) 1 0001 IGNORE -12 -4 -16 1 0100 1 1100 (1) 1 0000
IGNORE
(c) ADDING POSITIVE AND NEGATIVE NUMBERS -9 +3 -6 1 0111 0 0011 1 1010 +12 0 1100 -4 1 1100 +8 (1) 0 1000
+15 0 1111 -1 1 1111 +14 (1) 0 1110
-8 1 1000 +8 0 1000 0 (1) 0 0000
ALWAYS IGNORE THE MOST SIGNIFICANT CARRY
Ovidiu Ghita Page 70
Digital Electronics, 2003
ADVANTAGE OVER 1s COMPLEMENT IN THAT NO END AROUND CARRY NEEDED
N BITS >> 2N NUMBERS MAY BE REPRESENTED
(INCLUDING ZERO)
4 BITS >> 16 NUMBERS RANGE: -8 y +7
OVERFLOW AND UNDERFLOW
REMEMBER THE NUMBER OF DIGITS IS RESTRICTED WHEN ADDING NUMBERS OF OPOSITE SIGN THE RESULT CAN NEVER EXCEED THE PERMITED RANGE BUT WHEN TWO POSITIVE NUMBERS ARE ADDED THE RESULT MAY BE TOO LARGE i.e. OVERFLOW OCCURS
Ovidiu Ghita
Page 71
Digital Electronics, 2003
E.G.
0 1101 0 0101 1 0010
+13 +5 -14 <<< WRONG OVERFLOW
A B S
0 1000 0 1000 1 0000
+8 +8 -16
<<< WRONG
OVERFLOW
IF EACH NUMBER HAS N+1 BITS OVERFLOW = ANBNSN OVERFLOW INDICATES WE ARE OUTSIDE THE RANGE AND WE CANNOT REPRESENT THE RESULT IN OUR RESTRICTED NUMBER OF BITS
Ovidiu Ghita
Page 72
Digital Electronics, 2003
UNDERFLOW
UNDERFLOW MAY OCCUR WHEN TWO NEGATIVE NUMBERS ARE ADDED THE RESULT IS OUTSIDE THE RANGE E.G. 1 0011 1 1000 (1) 0 1011 -13 -8 +11
<<< WRONG
A B S
1 0000 1 1111 (1) 0 1111
-16 -1 +15
<<< WRONG
SHOULD BE 17 BUT THIS IS OUTSIDE THE PERMITED RANGE
IF EACH NUMBER HAS N+1 BITS UNDERFLOW = ANBNSN
Ovidiu Ghita
Page 73
Digital Electronics, 2003
SUBTRACTION
DIRECT SUBTRACTION (i.e. NOT USING SPECIAL REPRESENTATIONS TO GENERATE NEGATIVE NUMBERS) CAN BE PERFORMED BY DETERMINING THE TRUTH TABLE AND THEN DESIGNING A LOGIC DIAGRAM
THE FOUR BASIC RULES ARE:
00=0 11=0 10=1 0 1 = 102 1 = 1 WITH A BORROW OF 1
A B A - B BORROW B0 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0 0 HALF SUBTRACTOR DIFFERENCE = A B = A B BORROW = B0 = AB
Ovidiu Ghita Page 74
Digital Electronics, 2003
FULL SUBTRACTOR: A B BORROW IN
BIN
BORROW OUT BOUT A(B+BIN) DIFF
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 1 1 1 0 0 0 1
USING K-MAPS IT CAN BE SHOWN THAT: BOUT = ABIN + AB + BBIN DIFF = ABBIN + ABBIN + ABBIN + ABBIN
NOTE: SUBTRACTION MAY BE DONE MORE ECONOMICALLY BY REPRESENTING THE NEGATIVE NUMBERS USING 2s COMPLEMENT FORM E.G. 9 6 = 9 + (-6)
Page 75
Ovidiu Ghita
Digital Electronics, 2003
TWOs COMPLEMENT ADDER/SUBTRACTOR
IT IS POSSIBLE TO BUILD A CIRCUIT WHICH ADDS AND SUBTRACTS USING ONLY FULL ADDERS AND SOME
ADDITIONAL CIRCUITRY TO GENERATE THE 2s COMPLEMENT WHEN WISH TO DO SUBTRACTION
ADD/SUB
B3 A3
B2 A2
B1 A1
B0 A0
C IN
FA
FA
FA
FA
S3
S2
S1
S0
ADD/SUB = 0 >> ADDER = 1 >> SUBTRACTOR
XOR GATES ACT AS TRUE/COMPLEMENT GATES
INVERT B WHEN ADD/SUB =1 1 IS ADDED TO THE LSB TO GENERATE THE 2s COMPLEMENT OF B
Ovidiu Ghita Page 76