Lec 2: Gtes nd Logic Kvit Bl CS 34, Fll 28 Computer Science Cornell University Announcements Clss newsgroup creted Posted on we-pge Use it for prtner finding First ssignment is to find prtners Due this Fridy Sections strt this week
A switch A switch is simple device tht cn ct s conductor or isoltor Cn e used for mzing things Trnsistors Solid-stte switch The most mzing invention of the 9s - + collector P P emitter N se PNP nd NPN se collector emitter PNP se emitter collector + - N P N NPN 2
P nd N Trnsistors PNP Trnsistor B E NPN Trnsistor B E C Connect E to C when se = C Connect E to C when se = Inverter in out Function: NOT Clled n inverter Symol: in out In Out Truth tle Useful for tking the inverse of n input CMOS: complementry-symmetry metl oxide semiconductor 3
NAND Gte Function: NAND Symol: out A B out +Vdd NOR Gte out Function: NOR Symol: Vss A B out out 4
NOT: Building Functions AND: OR: NAND nd NOR re universl Cn implement ny function with NAND or just NOR gtes useful for mnufcturing NOT: Building Functions AND: OR: NAND nd NOR re universl Cn implement ny function with NAND or just NOR gtes useful for mnufcturing 5
Logic Equtions AND out = = & = OR out = + = = NOT out = =! = Identities Identities useful for mnipulting logic equtions For optimiztion & ese of implementtion + = + = + = = = = (+c) = + c ( + ) = ( ) = + + = 6
Logic Mnipultion Cn specify functions y descriing gtes, truth tles or logic equtions Cn mnipulte logic equtions lgericlly Cn lso use truth tle to prove equivlence Exmple: (+)(+c) = + c c + +c LHS c RHS (+)(+c) = + + c + c = + (+c) + c = ( + (+c)) + c = + c Logic Minimiztion A common prolem is how to implement desired function most efficiently One cn derive the eqution from the truth tle c minterm for ll outputs c tht re, c c tke the corresponding c minterm c Otin the result in c sum of products form c c How does one find the most efficient eqution? Mnipulte lgericlly until stisfied Use Krnugh mps (or K mps) 7
Multiplexer A multiplexer selects etween multiple inputs out =, if d = out =, if d = d Build truth tle Minimize digrm Derive logic digrm Multiplexer Implementtion d d out Build truth tle = d + d + d + d = d + d 8
Multiplexer Implementtion Drw the circuit d d out out = d + d d out Logic Gtes One cn uy gtes seprtely ex. 74xxx series of integrted circuits cost ~$ per chip, mostly for pckging nd testing Cumersome, ut possile to uild devices using gtes put together mnully 9
Integrted Circuits Or one cn mnufcture complete design using custom msk Intel Pentium hs pproximtely 25 million trnsistors Voting mchine Build something interesting A voting mchine Elections re coming up! Assume: A vote is recorded on piece of pper, y punching out hole, there re t most 7 choices we will not worry out hnging chds or invlids
Voting mchine For now, let s just disply the numericl identifier to the llot supervisor we won t do counting yet, just decoding we cn use four photo-sensitive trnsistors to find out which hole is punched out A photo-sensitive trnsistor detects the presence of light Photo-sensitive mteril triggers the gte Bllot Reding Input: pper with hole in it Out: numer the llot supervisor cn record Bllots The 34 vote recording mchine
Encoders c 2 3 o d 4 o e 5 o 2.. A 3-it encoder (7-to-3) (5 inputs shown) N sensors in row Wnt to distinguish which of the N sensors hs fired Wnt to represent the firing sensor numer in compct form N might e lrge Only one wire is on t ny time Silly to route N wires everywhere, etter to encode in log N wires Numer Representtions 37 Deciml numers re written in se 3 x + 7 x = 37 Just s esily use other ses Bse 2 - Binry Bse 8 - Octl Bse 6 Hexdeciml 2
Numer Representtions 37 Bse conversion vi repetitive division Divide y se, write reminder, move left with quotient Snity check with 37 nd Binry Representtion 37 = 32 + 4 + 2 6 2 5 2 4 2 3 2 2 2 2 64 32 6 8 4 2 3
Hexdeciml Representtion 25 6 6 37 deciml = (25) 6 Convention Bse 6 is written with leding x 37 = x25 Need extr digits!,, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Binry to hexdeciml is esy Divide into groups of 4, trnslte groupwise into hex digits Encoder Truth Tle c d o2 o o 2 o o c 3 o 2 d 4 A 3-it encoder with 4 inputs o2 = cd o = cd + cd o = cd + cd for simplicity 4
Bllot Reding Ok, we uilt first hlf of the mchine Need to disply the result Bllots The 34 voting mchine 7-Segment LED Decoder 4 inputs encoded in inry 8 outputs, ech driving n independent, rectngulr LED Cn disply numers Just simple logic circuit Write the truth tle 5
7-Segment LED Decoder 4 inputs encoded in inry 8 outputs, ech driving n independent, rectngulr LED Cn disply numers 7-Segment LED Decoder 4 inputs encoded in inry 8 outputs, ech driving n independent, rectngulr LED Cn disply numers 6
7 7-Segment Decoder Truth Tle o 5 i 2 o o 2 o 6 o 4 o 3 o i i i 3 o o o 2 o 3 o 4 o 5 o 6 Exercise: find the error(s) in this truth tle 7-Segment Decoder Truth Tle o 5 i 2 o o 2 o 6 o 4 o 3 o i i i 3 o o o 2 o 3 o 4 o 5 o 6
Bllot Reding Done! Bllots The 34 voting mchine Summry We cn now implement ny logic circuit Cn do it efficiently, using Krnugh mps to find the miniml terms required Cn use either NAND or NOR gtes to implement the logic circuit Cn use P- nd N-trnsistors to implement NAND or NOR gtes 8