C 474A/57A Computer-Aie Logi Design Leture Binry Deision Digrms (BDDs) C 474/575 Susn Lyseky o 3 Boolen Logi untions Representtions untion n e represente in ierent wys ruth tle, eqution, K-mp, iruit, et Some representtions not unique (not nonil) qution : (,) = + qution 2: (,) = Ciruit ruth tle he untion Ciruit 2 C 474/575 Susn Lyseky 2o 3 Why BDDs An iient Representtion Synthesis, optimiztion, veriition, n testing lgorithms/tools mnipulte lrge Boolen untions Importnt to hve eiient wy to represent these untions Binry Deision Digrms (BDDs) hve emerge s populr hoie or representing these untions BDDs Grph representtion similr to inry tree (i.e. eision trees rom previous letures) Ale to eiiently represent lrge untions Some representtions re nonil (unique) C 474/575 Susn Lyseky 3o 3
Mux Representtion o Boolen untions iruit to implement logi untion S x S x S(x,, ) X3 () X3 () X3 () X3 () () () () () X () X () X () X () S(,, ) = S(,, ) = S(,, ) = S(,, ) = C 474/575 Susn Lyseky 4o 3 Mux Representtion o Boolen untions Reltion to BDDs Corresponing BDD to implement untion S One-to-one orresponene to the gtes in the lippe iruit x S S(x,, ) S(x,, ) x x x S(x,, ) Sme iruit, just lippe C 474/575 Susn Lyseky Corresponing BDD 5o 3 Binry Deision Digrm (BDD) xmple How oes it work? Line with ule represent vlue = Lines without ule represent vlue = S(x,, ) x x S S(,, ) S(,, ) S(,, ) S(,, ) x x x x C 474/575 Susn Lyseky 6o 3 2
Binry Deision Digrm (BDD) ge Nottions Severl wys to represent vlue = n vlue = Bule vs. Non-ule line Dshe vs. Soli line (then) vs. (else) lels We will opt vs. lels onsistent with most o the ook (Hthel) exmples S(x,, ) S(x,, ) S(x,, ) x x x C 474/575 Susn Lyseky 7o 3 Binry Deision Digrm (BDD) xmple 2 Let s onsier nother untion (,,,) = + + Wht is the vlue o (,,,)? Wht is the vlue o (,,,)? Notie tht i = n =, the untion oes not epen on vlue or. C 474/575 Susn Lyseky 8o 3 Orere Binry Deision Digrm (OBDD) Wht is OBDD? Orere inry eision igrms ensure the vriles pper in the sme orer long ll pths rom the root to the leves Orering : Not orere C 474/575 Susn Lyseky 9o 3 3
Orere Binry Deision Digrm (OBDD) Dierent Orering Le to Dierent Complexity xmple Vrile orering importnt, my result in more omplex (or simple) BDD All three BDDs elow represent the sme untion hir orering ( ) optiml euse there is extly one noe or eh vrile Orer : Orer : Orer : C 474/575 Susn Lyseky o 3 Orere Binry Deision Digrm (OBDD) Dierent Orering Le to Dierent Complexity xmple 2 Consier = + + e, gin oth BDDs represent sme untion Vrile orer hs lrge impt on resulting BDD, irst vrile orering ( e ) yiels muh simpler BDD e e e e e Orer : e Orer : e C 474/575 Susn Lyseky o 3 BDDs or Bsi Logi untions NO AND OR XOR NAND C 474/575 Susn Lyseky 2 o 3 4
orml Deinition o BDDs A BDD is iret yli grph (DAG) representing multiple-output swithing untion Noes re prtitione into three susets untion noe Represents the untion symol () Inegree = Outegree = Internl noe Represents vrile in untion (,,, ) Inegree Outegree = 2 untion noe Internl noes erminl noes erminl noe Represents vlue ( or ) Inegree Outegree = C 474/575 Susn Lyseky 3 o 3 orml Deinition o BDDs A BDD einition (ont ) hree types o eges Inoming ege ege rom the untion noe n eines untion rom n internl noe n represents when the orresponing vrile is ege rom n internl noe n represents when the orresponing vrile is Inoming ege ege ege C 474/575 Susn Lyseky 4 o 3 orml Deinition o BDDs A BDD einition (ont ) he untion represente y BDD is eine s ollows he untion o the terminl noe is onstnt vlue ( or ) he untion o ege is the untion o the he noe he untion o ege is the omplement o the untion o the noe he untion o noe v is given y v + v, when is the untion o the ege n is the untion o the ege he untion o the untion noe is the untion o it s outgoing ege untion o the untion noe is the untion o it s outgoing ege untion o this ege is untion o this ege is untion o this terminl noe is untion o this terminl noe is C 474/575 Susn Lyseky 5 o 3 5
BDD Cnonil orm BDDs re nonil (unique) or representtion o given vrile orering i All internl noes re esennts o some noe here re no isomorphi sugrphs or every noe Isomorphi sugrphs Isomorphi wo grphs re isomorphi i there is one-to-one orresponene etween their verties n there is n ege etween two verties o one grph i n only i there is n ege etween the two orresponing verties in the other grph nglish sme sugrph - ll verties the sme, ll eges etween verties the sme C 474/575 Susn Lyseky 6 o 3 Builing BDDs or untion How o I uil BDD given untion? Reursive use o Shnnon s xpnsion heorem = + We n keep pplying expnsion theorem, eventully we reh the unique nonil orm, whih uses only minterms = + + = ( ) + (+ ) = (+ ) = ( ) lso lle the otor o w.r.t. (with respet to) = + + = + = ( + ) + ( ) = + + = + = ( + ) + ( + ) expne w.r.t to expne w.r.t to C 474/575 Susn Lyseky 7 o 3 Builing BDDs - xerise Buil BDD or = + + + Use the vrile orering prtil expnsion with respet to Compute otors o with respet to (irst vrile in orering) = + + + = + = + C 474/575 Susn Lyseky 8 o 3 6
Builing BDDs - xerise Buil BDD or = + + + Use the vrile orering Compute otors o n with respet to (seon vrile in orering) prtil expnsion with respet to = + ( ) = = ( ) = = = + ( ) = = ( ) = = C 474/575 Susn Lyseky 9 o 3 Builing BDDs - xerise Buil BDD or = + + + Use the vrile orering Compute otors o,,, with respet to (thir vrile in orering) = = = = = = = = = = = = C 474/575 Susn Lyseky expnsion with respet to, inl BDD 2 o 3 Builing BDDs - xerise = + + + Does it work? C 474/575 Susn Lyseky 2 o 3 7
Builing BDDs - xerise 2 Buil BDD or = + + Use the vrile orering prtil expnsion with respet to Compute otors o with respet to (irst vrile in orering) = + + = + = + C 474/575 Susn Lyseky 22 o 3 Builing BDDs - xerise 2 Buil BDD or = + + Use the vrile orering Compute otors o n with respet to (seon vrile in orering) = + = + = = = = prtil expnsion with respet to equivlent otors, we n rete single noe (reue) C 474/575 Susn Lyseky = = 23 o 3 Builing BDDs - xerise 2 Buil BDD or = + + Use the vrile orering prtil expnsion with respet to Compute otors o,, n with respet to (thir vrile in orering) = = = = = = = = = = = C 474/575 Susn Lyseky 24 o 3 8
Builing BDDs - xerise 2 Buil BDD or = + + Use the vrile orering Compute otors o with respet to (ourth vrile in orering) = = expnsion with respet to, inl BDD = C 474/575 Susn Lyseky 25 o 3 Builing BDDs - xerise 2 Buil BDD or = + + Does it work? C 474/575 Susn Lyseky 26 o 3 BDD to Boolen untion xerise Cn we go rom BDD to Boolen untion? Sum ll pths rom untion noe to terminl noes = + = () + () = + = + + = + = ( + ) + () = + + = + = () + () = + = = C 474/575 Susn Lyseky 27 o 3 9
BDD to Boolen untion xerise 2 Another xmple = + + = + = ( ) + () = + = + = ( + ) + () = + + = C 474/575 Susn Lyseky 28 o 3 Reuing BDDs When uiling BDDs, result not lwys reue (xmple - slie 9) We hve isomorphi sugrphs, potentil or reution rnsorm non-reue BDD into reue BDD y itertively pplying Ientiy isomorphi sugrphs Remove reunnt noes A orere reue BDD (ROBDD) is unique so we hve nonil orm isomorphi sugrphs = (reunnt noe) C 474/575 Susn Lyseky 29 o 3 Reuing BDDs xmple 2 Let s try to reue n OBDD Itertive pply Ientiy isomorphi sugrphs Remove reunnt noes isomorphi sugrphs = (reunnt noe) C 474/575 Susn Lyseky 3 o 3
Summry, n then some Binry Deision Digrms (BDDs) iient mehnism to representtion o Boolen untions in terms o memory n CPU rnslting untion BDD n BDD untion Importne o vrile orering Metho to reue OBDDs, getting ROBDD We si tht BDDs n e eiiently store n mnipulte HOW? Reer to hnwritten notes Supplementl mterils tthe C 474/575 Susn Lyseky 3 o 3 I Opertor wo rgument opertors expresse in terms o I le Nme xpression quivlent orm AND(, G) G I(, G, ) > G G I(, G, ) < G G I(,, G) G G G XOR(, G) G I(, G, G) OR(, G) + G I(,, G) NOR(, G) ( + G) I(,, G ) XNOR(, G) ( G) I(, G, G ) NO(G) G I(G,, ) G + G I(,, G ) NO() I(,, ) G + G I(, G, ) NAND(, G) (G) I(, G, ) C 474/575 Susn Lyseky 32 o 3 I Algorithm Most stnr mnipultion o BDDs n e one with I Algorithm reursive, se on ormultion where v is the top vrile o, G, H I(, G, H) = G + H = v(g + H) v + v (G + H) v = v( v G v + v H v ) + v ( v G v + v H v ) = I( v, I( v, G v, H v ), I( v, G v, H v ) ) erminl ses re s ollows I(,, G) = I(, G, ) = I(,, ) = I(G,, ) = C 474/575 Susn Lyseky 33 o 3
Pseuo-oe o the I Algorithm I(, G, H){ (result, terminl_se) = RMINAL_CAS(, G, H) i (terminl_se) return (result) // i we in terminl se? (result, in_ompute_tle) = COMPUD_ABL_HAS_NRY(, G, H) i (in_ompute_tle) return (result) // hve we lrey lulte this vlue? } v = OP_VARIABL(, G, H) = I( v, G v, H v) = I( v, G v, H v ) R = IND_OR_ADD_UNIQU_ABL(v,, ) INSR_COMPUD_ABL((, G, H), R) return (R) // reursively lulte this vlue // see i sutree lrey present // reor the lulte vlue C 474/575 Susn Lyseky 34 o 3 2