/28/2 Lerning Outcomes At the end of this lecture you should: Computer Systems - Architecture Lecture 4 - Boolen Logic Eddie Edwrds eedwrds@doc.ic.c.uk http://www.doc.ic.c.uk/~eedwrds/compsys (Hevily sed on notes y Andrew Dvison nd In Hrries) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.) understnd how logic reltes to computing prolems e le to represent Boolen logic prolems s: Truth tles Logic circuits Boolen lger e le to produce circuits for the hlf dder nd full dder hve feeling for how electronic circuits cn e joined together to crete numer mnipultors (simple computers???) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.2) Wht is Logic? Dictionry definitions (dictionry.com - reduced!) reson or sound judgement system of principles of resoning the science tht investigtes the principles governing correct or relile inference Brnch of philosophy Principles of inference Ancient civiliztions (Indi the Rigved, Chin Gongsun Long 325 BC) Greek Aristotle (Syllogistic logic) Modern: John Sturt Mill The science of resoning, Frege, Russell, Gödel... You use logic ll the time in your everydy life Computer Systems - Architecture (EEdwrds) Boolen Logic (4.3) Boolen Logic Nmed fter George Boole Provides system of logicl opertions Rules for comining opertions Descries their ppliction to inry numers or? TRUE or FALSE? YES OR NO? Computer Systems - Architecture (EEdwrds) Boolen Logic (4.4)
/28/2 Simple Emple If it is rining then I will tke n umrell It is rining cn e TRUE or FALSE I will tke n umrell - cn e TRUE OR FALSE The truth of tke n umrell depends on the truth of rining Cn e represented in the form of truth tle: Rining Flse True Umrell Flse True Cn e used to mke decision (i.e. inference): (tke umrell) = (rining) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.5) Emple 2 If it is rining or the wether forecst is d then I tke n umrell Truth tle: Rining Bd forecst umrell Flse Flse Flse Flse True True True Flse True True True True (tke umrell) = ((rining) OR (d forecst)) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.6) Emple 3 Digitl Logic If it is rining nd I hve no cr then I will tke n umrell Truth tle: Rining No Cr Umrell Flse Flse Flse Flse True Flse True Flse Flse True True True (tke umrell) = ((rining) AND (NOT cr)) Computers mke decisions using logic Bsic logic opertions Also NOT AND OR Eclusive OR (XOR) NOT AND (NAND) NOT OR (NOR) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.7) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.8) 2
/28/2 3 Computer Systems - Architecture (EEdwrds) Boolen Logic (4.9) Digitl Logic Computers operte electroniclly using Logic Gtes One or more inputs One output Input nd output re inry digits ( or ) = FALSE = TRUE Electronic circuits re esily connected together to perform more comple functions, from these sic uilding locks of computers Computer Systems - Architecture (EEdwrds) Boolen Logic (4.) Logic Gtes NOT gte: AND gte: Computer Systems - Architecture (EEdwrds) Boolen Logic (4.) Wht is the truth tle for the NOR gte? A B C D E Computer Systems - Architecture (EEdwrds) Boolen Logic (4.2) Logic Gtes OR gte: XOR gte:
/28/2 How mny sic logic gtes re required Answer NOT AND A (XOR) = (NOT ) AND (NOT ) OR ( OR ) B (XOR) = OR (( AND NOT ) AND ) OR C (XOR) = NOT((NOT AND NOT ) OR ( AND )) XOR cn e mde up of NOT, AND nd OR gtes Drw the circuit D (XOR) = ( AND NOT ) OR (NOT AND ) E (XOR) = ( OR ) AND NOT ( AND ) Wht is the corresponding logic eqution? IN FACT C, D or E re correct nswers, ut D,E more concise Computer Systems - Architecture (EEdwrds) Boolen Logic (4.3) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.4) Summry Prcticl digitl circuits Bsic logic gtes AND, OR nd NOT re enough Useful to hve others - XOR, NAND etc. Cn hve more comple gtes (e.g, multiple inputs) 3-input AND gte NAND gte (AND followed y NOT) 74 dul in-line pckge Computer Systems - Architecture (EEdwrds) Boolen Logic (4.5) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.6) 4
/28/2 Boolen lger - nottion Boolen lger - rules Infuritingly, there is no single greed representtion for the logicl opertors in Boolen lger: A AND B º A B º A Ù B º A & B º AB A OR B º A + B º A Ú B º A B A XOR B º A Å B NOT A º A º Ø A º Ā (with r) º A' We will use A B, A + B, A' Computer Systems - Architecture (EEdwrds) Boolen Logic (4.7) There re mny rules tht cn e used for lgeric mnipultion Negtion: (A')' = A A A' = Associtive: (A B) C = A (B C) (A+B)+C = A+(B+C) Commuttive: A B = B A A+B = B+A A+A' = Distriutive: A (B+C) = A B + A C A+(B C) = (A+B) (A+C) Note the precedence Computer Systems - Architecture (EEdwrds) Boolen Logic (4.8) Boolen lger - rules Boolen Alger de Morgn s rules Single vriles: A A = A A+A = A Simplifiction rules with nd : A = A = A A+ = A A+ = (A + B)' = A' B' (A B)' = A' + B' s efore, A nd B cn e ny Boolen epression Cn generlise to n Boolen vriles: (A + B + C + D +...)' = A' B' C' D'... (A B C D...)' = A ' + B' + C' + D' +... Computer Systems - Architecture (EEdwrds) Boolen Logic (4.9) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.2) 5
/28/2 Boolen lger rules for XOR Addition using logic gtes A Å B = A B' + A' B Complement Lw for XOR: (AÅB)' = AÅB' = A'ÅB Suppose we wnt to dd two one-it inputs? Wht is the truth tle for The sum? Any it tht might crry over? Eclusive NOR (NOT XOR) sometimes clled n equivlence gte why? Computer Systems - Architecture (EEdwrds) Boolen Logic (4.2) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.22) Addition using logic circuits The hlf-dder In the following circuit: Upper o is: A. AND B. OR C. NOT D. XOR E. NOR Lower o is: A. AND B. OR C. NOT D. XOR E. NOR Computer Systems - Architecture (EEdwrds) Boolen Logic (4.23) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.24) 6
/28/2 The full dder The full-dder For full dder, we need nother input, the crry it from the net less significnt it. Wht is the logic circuit for the full dder? Computer Systems - Architecture (EEdwrds) Boolen Logic (4.25) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.26) The full dder - redrwn Lerning Outcomes You should now: understnd how logic reltes to computing prolems Effectively two hlf-dders plus n OR gte e le to represent Boolen logic prolems s: Truth tles Logic circuits Boolen lger e le to produce circuits for the hlf dder nd full dder hve feeling for how electronic circuits cn e joined together to crete numer mnipultors (simple computers???) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.27) Computer Systems - Architecture (EEdwrds) Boolen Logic (4.28) 7
/28/2 This lecture - feedck The pce of the lecture ws: A. much too fst B. too fst C. out right D. too slow E. much too slow The lerning ojectives were met: A. Fully B. Mostly C. Prtilly D. Slightly E. Not t ll Computer Systems - Architecture (EEdwrds) Boolen Logic (4.29) 8