5/9/ Comintionl Logic ENGG05 st Semester, 0 Dr. Hyden So Representtions of Logic Functions Recll tht ny complex logic function cn e expressed in wys: Truth Tle, Boolen Expression, Schemtics Only Truth Tle representtion is unique We cn convert representtion from one form to the other Truth Tle Deprtment of Electricl nd Electronic Engineering Schemtics Boolen Expression st semester, 0 Schemtics à Boolen Expression Strt from the inputs, deduce the Boolen expression of ech intermedite nodes until the output is otined. The fct tht the AND opertion (AB) is performed efore the OR opertion (C) is cptured implicitly y the precedence of Boolen lger A redundnt, ut still correct expression: x = (AB)C Precedence Determines the order of evlution of Boolen expression Order: A r over n expression cn e viewed s one with (), therefore, () tke precedence E.g. Opertion Precedence ( ) Highest NOT AND OR Lowest = ( ) ( ) first, then inverse st semester, 0 st semester, 0 Schemtics à Boolen Expression Similr conversion, using ()s to show precedence of the OR opertion Quick Quiz Wht is the output expression of the following logic-circuit digrm? Whenever n INVERTER is present in logic-circuit digrm, its output expression is simply equl to the input expression with r over it. x = ( A D) x= D x= D x = ( A D) st semester, 0 5 st semester, 0 6
5/9/ Boolen Expression à Schemtics Strt with the inputs, convert ech Boolen opertion into the corresponding gte, oeying the precedence of opertion E.g. Implement the expression s circuit: c c y = c c c c c c y Truth Tle à Boolen Exp List ll comintions tht give t output Ech row contriutes to minterm Sum up ll terms Sum of products (SOP) x = st semester, 0 7 st semester, 0 8 Cnonicl Form Boolen expression cn e expressed in mny different wys (A D)(B C) AB AC BD CD Two stndrd wys of orgnizing the terms: Sum of Product Product of Sum A cnonicl form puts rules to llows unique representtion of Boolen expression E.g. sort the minterms ccording to order of input signl (write AB, not BA) Cnonicl SOP Boolen expression expressed s sum of product of sic inputs Bsic input my optionlly negted Product Sum E.g. A B(C D) is not NOT cnonicl: No prentheses Very nturl for humn AB C BD AD 9st semester, 0 0 st semester, 0 Cnonicl POS Boolen expression expressed s product of sum of sic inputs Bsic input my optionlly negted (A B C)(B D )(A D) Product Sum E.g. This is not in cnonicl POS form: A B(C D) Not too nturl for humn, ut eqully good for computers. SOP or POS? SOP Wht out? S = A ( B C)( B C) ( A B C) ( A B C) ( A B C) ( A B C) A B C S 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 A B C S 0 0 0 0 0 0 0 0 0 0 0 0 0 0 st semester, 0 st semester, 0
5/9/ Exmple: This exmple illustrte the complete procedure for designing logic circuit. Suppose the logic circuit hving inputs, A, B, C will hve its output HIGH only when mjority of the inputs re HIGH. Step Set up the truth tle Step Write the AND term for ech cse where the output is. Step Write the SOP form the output x= Step Simplify the output expression x= = BC( A A) AC( B B) AB( C C) = BC AC AB A B C x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Exmple: Conversion through the opposite direction: Step Strt from the circuit Step Otin Boolen expression from the circuit (in SOP form) y = AC BC Schemtics A B C y 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Step 5 Implement the circuit Step Write the truth tle st semester, 0 y Truth Tle Boolen Expression Axioms of Boolen Alger Tle. Axioms of Boolen lger Axiom Dul Nme A B 0 if B A B if B 0 Binry field A 0 A 0 NOT A 0 0 0 A AND/OR A A 0 0 0 AND/OR A5 0 0 0 A5 0 0 AND/OR BOOLEAN ALGEBRA The very sis of Boolen lger Cnnot e proven, ssumed true Note the Dul of the Axiom Replce with, replce with 0, nd the xiom still holds true st semester, 0 5 st Tle semester, from DDCA 0 p.57 6 Theorems of one vrile Tle. Boolen theorems of one vrile Theorem Dul Nme T B B T B 0 B Identity T B 0 0 T B Null Element T B B B T B B B Idempotency T B = B Involution T5 B B 0 T5 B B Complements Theorems of multiple vriles Tle. Boolen theorems of severl vriles Theorem Dul Nme B C T6 B C C B Commuttivity T6 C B T7 (B C) D B (C D) T7 (B C) D B (C D) Associtivity T8 (B C) (B D) B (C D) T8 (B C) (B D) B (C D) Distriutivity T9 B (B C) B T9 B (B C) B Covering T0 (B C) (B C) B T0 (B C) (B C) B Comining T (B C) (B D) (C D) T (B C) (B D) (C D) Consensus B C B D (B C) (B D) T B 0 B B... T B 0 B B... De Morgn s (B 0 B B...) (B 0 B B ) Theorem st semester, 0 7 st semester, 0 8
5/9/ Exmple Simplify the following Boolen expression: y = ABD ABD y = AB( D D) y distriutive lw = AB y rule 6 = AB y rule Quick Quiz Simplify the following Boolen expression: AB A AB B z = ( A B) ( A B) z = AA AB BA BB y distriutive lw = 0 AB BA B y rule 8 nd rule 7 = AB BA B y rule = BA ( A ) y distriutive lw = B y rule 6 nd rule = B y rule st semester, 0 9 st semester, 0 0 DeMorgn s Theorems Theorem x y = x y Theorem x y = x y Rememer: Brek the r, chnge the opertor DeMorgn's theorem is very useful in digitl circuit design It llows ANDs to e exchnged with ORs y using invertors DeMorgn's Theorem cn e extended to ny numer of vriles. E.g, for three vriles x, y nd z x y z= x y z x y z= x y z Quick Quiz () Simplify ( AB C) AC BC AC BC AC BC AC BC Simplify AC BD AC BD AC BD AC BD ( A C) ( B D) st semester, 0 st semester, 0 Quick Quiz () Simplify AB CD EF DEF Determine the output expression for the elow circuit nd simplify it using DeMorgn s Theorem A B C A B C st semester, 0 AB CD EF AB CD EF AB CD EF Exmples (Summry): ) ( AB C) = AB C = ( A B) C = AC BC ) ( A C) ( B D) = ( A C) ( B D) = A C B D= AC BD c) A B C= A ( B C) = A ( B C) = A( B C) d) ( A BC) ( D EF) = ( A BC) ( D EF) = ( A BC) ( D EF) = A ( B C) D ( E F) = AB AC DE DF e) AB CD EF = AB CD EF = AB CD EF f ) Determine the output expression for the elow circuit nd simplify it using DeMorgn s Theorem 5
5/9/ Bule Pushing in Schemtics x y = x y Usully redrwn in this wy x y = x y DeMorgn s Theorem llows us to push ules cross gtes to eliminte unnecessry inversions in signls Usully redrwn in this wy SIMPLIFYING LOGIC CIRCUITS 7 st semester, 0 st semester, 0 8 Simplifying Logic Circuits Once the expression for logic circuit is otined, we my try to simplify it, so tht the implementtion requires fewer gtes Exmple: elow two circuits re the sme, ut the second one is much more simpler Minimiztion y Alger Mke use of reltionships nd theorems of Boolen lger to simplify the expressions this method relies on your lgeric skill E.g. To simplify z= AB ( AC) Two methods for simplifying Algeric method (use Boolen lger theorems) Krnugh mpping method (systemtic, step-y-step pproch) 9 st semester, 0 z = AB ( A C) [y DeMorgn thm] = AB ( A C) [cncel doule inverions] = ABA = AB [multiply out] [ A A = A] = AC( B B) AB = AC AB [ B B = ] = AC ( B) st semester, 0 0 Minimiztion y Krnugh Mps Wht is Krnugh mp? Krnugh mp (K mp) is grphicl tool used to simplify logic eqution or to convert truth tle to its corresponding logic circuit With simple nd orderly process, the resulting logic expression will e in its simplest SOP form!!! K mp formt: Vrile K mp: A\BC 00 0 0 0 A grid of squres Ech squre represents one product term eg: top-left represents A B C, ottom-right represents A B C The vriles re ordered ccording to Gry code only one vrile chnges etween djcent squres Squres on edges re considered djcent to squres on opposite edges Vrile K mp AB\CD 00 0 0 00 0??? 0 The squre mrked? represents A B C D The squre mrked?? represents A B C D Note tht they differ in only the C vrile. Krnugh mps ecome clumsier to use with more thn vriles Generl procedure for using K mp:. Fill out the K mp for given Boolen expression. Simplify the expression y properly comining those squres in the K mp tht contins s. This process is clled looping st semester, 0 st semester, 0 5
5/9/ Filling out Krnugh Mp Given n initil (unsimplified) logic Boolen expression Write the expression in SOP form For ech product term, write in ll the squres which re included in the term, 0 elsewhere All vriles present in the product term: one squre One vrile missing: two djcent squres Two terms missing: djcent squres Exmple : X = Exmple : X = BC AC Exmple : X = B A A\BC 00 0 0 0 0 0 0 0 A\BC 00 0 0 0 0 0 0 A\BC 00 0 0 0 0 st semester, 0 5 st semester, 0 Looping Minimiztion is done y spotting ptterns of 's nd 0's Pirs of djcent 's (Looping groups of two) rememer tht djcent squres differ y only one vrile hence the comintion of djcent squres hs the form P ( A A) this cn e simplified (from efore) to just P Exmple (continue) X = A\BC 00 0 0 0 0 0 0 0 -- the djcent squres A B C nd differ only in A -- hence they cn e comined into just BC, indicted y the lue loop -- looping cn lso e done y grouping nd A B C to give AC, s indicted y the red loop -- furthermore, looping cn lso e done y grouping A B C nd to give AB, s indicted y the yellow loop -- The simplified Boolen eqution is one tht sums ll the terms corresponding to ech of the group: X = AC BC AB More exmples on looping of two Looping group of four (quds) A K mp my contin group of four s tht re djcent to ech other. This group is clled qud Looping qud of djcent s elimintes the two vriles tht pper in oth complemented nd uncomplemented form Exmples: 6 st semester, 0 7 st semester, 0 Looping group of eight (Octets) A group of eight s tht re djcent to one nother is clled n octet Looping n octet of djcent s elimintes the three vriles tht pper in oth complemented nd uncomplemented form Exmples: Complete Simplifiction Process. Construct the K mp nd plce s nd 0s in the squres ccording to the truth tle.. Group the isolted s which re not djcent to ny other s. (single loops). Group ny pir which contins djcent to only one other. (doule loops). Group ny octet even if it contins one or more s tht hve lredy een grouped. 5. Group ny qud tht contins one or more s tht hve not lredy een grouped, mking sure to use the minimum numer of groups. 6. Group ny pirs necessry to include ny s tht hve not yet een grouped, mking sure to use the minimum numer of groups. 7. Form the OR sum of ll the terms generted y ech group. 8 st semester, 0 9 st semester, 0 6
5/9/ Exmples: AB\CD 00 0 0 00 0 0 0 0 0 0 0 0 0 0 0 AB\CD 00 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 Quiz AB\CD 00 0 0 AB\CD 00 0 0 00 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Step. Isolted : None Step. Adjcent to only one : None Step. Octet: None Step5. Qud: Blue nd red loops Step6. All s hve een looped => skip this step Step. Isolted : None Step. Adjcent to only one : red loop Step. Octet: None Step5. Qud: Green loops Step6. All s hve een looped => skip this step AB CD BD D ACD BD D ACD BD D D BD D ACD BD ACD ACD ACD ACD BD ACD ACD ACD ACD BD 0 st semester, 0 st semester, 0 More exmples S. Isolted : loop S. Adjcent to only one : loop,5 S. Octet: None S5. Qud: loop 6,7,0, S6. All s hve een looped => skip S. Isolted : None S. Adjcent to only one : loop,7 S. Octet: None S5. Qud: loop 5,6,9,0 nd loop 5,6,7,8 S6. All s hve een looped => skip S. Isolted : None S. Adjcent to only one : loop,6, loop 7,8, loop,5 nd loop 9,0 S-S6. All s hve een looped => skip Putting It Together -BIT ADDER st semester, 0 st semester, 0 Binry Numers Represents numers in se E.g.: 0 = 0 Almost ll computers tody utilize inry representtion of numers internlly Deciml Binry 0 0 0 00 5 0 6 0 7 8 000 9 00 0 00 0 00 From Binry to Deciml Note tht the vlue of inry numer is given y: i i i= 0 where i is the digitl t position i, strting counting from zero from the fr right. Converting from inry to deciml cn e done y dding the power-of- where there is st semester, 0 st semester, 0 5 7
5/9/ Exmple Convert the inry numer 00 into deciml representtion 5 0 0 0 = 0 0 0 = 0 =6 8 = 5 From Deciml to Binry Cn e found using short division : Successively divide the dividend y The reminders form the resulting inry numer when counted from the ottom Exmple: Converts 9 0 into inry 9 9 0 0 è 9 0 = 00 st semester, 0 6 st semester, 0 7 Positive Integers Non-negtive inry numers (0,,,, ) cn e represented nturlly with itstrings tht corresponds to their inry representtion Represents eqully spced integers on the numer line Sometimes clled unsigned integer 00000000 0000000 0000000 000000 0000000 000000 000000 0 5 6 7 8 Vlue Binry Bitstring (8- it) 0 0 00000000 0000000 0 0000000 000000 00 0000000 5 0 000000 6 0 000000 7 00000 8 000 0000000 9 00 000000 0 00 000000 0 00000 00000 st semester, 0 8 Positive Integers With itstring of width n, the following properties hold: min vlue : 0 mx vlue : n The vlue of istring { n n 0 } cn e clculted s: n i i E.g. The vlue of i= 0 0 = 0 =6 = st semester, 0 9 Positive Integers Addition Two ve integers cn e dded similr to the wy deciml numers re dded in long ddition Hlf Adder Bsic ddition of -it vlues Generte crry out to the next it if the result is 9 0 0 0 0 0 0 co s 0 0 0 0 0 0 0 0 0 s = co = How do we implement inry ddition in hrdwre? 0 0 0 0 0 0 st semester, 0 50 st semester, 0 5 8
5/9/ Full Adder The susequent its need to e slightly smrter thn hlf dder There my e crry input from the it to the right A -input function (,, ci) ci co s 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 st semester, 0 0 0 0 s = ci co = ci ( ) 0 0 0 0 0 0 5 Multi-it Adder Both HA nd FA cn dd it only A hlf-dder is simply full-dder with the crry input tied to 0 To mke multi-it dder, we cn connect the crry output from one FA to the crry input of nother one Strt from lest significnt it (usully rightmost it) nd propgte the crry to the left (the most significnt it) Mimic the ction of long ddition 0 0 0 st semester, 0 5 0 0 0 Multi-it Adder <> <> <> <> <> <> <0> <0> Crry out co FA s ci co FA s ci co FA s ci co FA s ci 0 s<> s<> s<> s<0> Note: the <> nottion is shorthnd to denote it within multi-it signl. Other common nottion: (0), [0], 0, etc Engineer sometimes cll multi-it signl us, or signl us. st semester, 0 5 9