Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Logicgates

  • Inicia sesión para ver los comentarios

Logicgates

  1. 1. Logic GatesTARUNGEHLOTS 1
  2. 2. Review of Boolean algebraJust like Boolean logicVariables can only be 1 or 0 Instead of true / false 2
  3. 3. Review of Boolean algebraNot is a horizontal bar above the number _ 0=1 _ 1=0Or is a plus 0+0 = 0 0+1 = 1 1+0 = 1 1+1 = 1And is multiplication 0*0 = 0 0*1 = 0 1*0 = 0 1*1 = 1 3
  4. 4. Review of Boolean algebra ___Example: translate (x+y+z)(xyz) to a Booleanlogic expression (x y z) ( x y z)We can define a Boolean function: F(x,y) = (x y) ( x y)And then write a “truth table” for it: x y F(x,y) 1 1 0 1 0 0 0 1 0 0 0 0 4
  5. 5. Quick survey I understand the basics of Boolean algebraa) Absolutely!b) More or lessc) Not reallyd) Boolean what? 5
  6. 6. Basic logic gatesNot x x x xy x xyzAnd y y z x x y x x+y+zOr y y z x xyNand y x x yNor y x x yXor y 6
  7. 7. Find the output of the following circuit x x+y y (x+y)y y y __Answer: (x+y)y Or (x y) y 7
  8. 8. Find the output of the following circuit x x xy xy y y ___ __Answer: xy Or ( x y) ≡ x y 8
  9. 9. Quick survey I understand how to figure out what a logic gate doesa) Absolutely!b) More or lessc) Not reallyd) Not at all 9
  10. 10. Write the circuits for the following Boolean algebraic expressions __a) x+y x x+y x y 10
  11. 11. Write the circuits for the following Boolean algebraic expressions _______b) (x+y)x x x+y x+y (x+y)x y 11
  12. 12. Writing xor using and/or/not p q (p q) ¬(p q) x y x y ____ 1 1 0 x y (x + y)(xy) 1 0 1 0 1 1 0 0 0x x+y (x+y)(xy)y xy xy 12
  13. 13. Quick survey I understand how to write a logic circuit for simple Boolean formulaa) Absolutely!b) More or lessc) Not reallyd) Not at all 13
  14. 14. Converting decimal numbers to binary53 = 32 + 16 + 4 + 1 = 25 + 24 + 22 + 20 = 1*25 + 1*24 + 0*23 + 1*22 + 0*21 + 1*20 = 110101 in binary = 00110101 as a full byte in binary211= 128 + 64 + 16 + 2 + 1 = 27 + 26 + 24 + 21 + 20 = 1*27 + 1*26 + 0*25 + 1*24 + 0*23 + 0*22 + 1*21 + 1*20 = 11010011 in binary 14
  15. 15. Converting binary numbers to decimalWhat is 10011010 in decimal?10011010 = 1*27 + 0*26 + 0*25 + 1*24 + 1*23 + 0*22 + 1*21 + 0*20 = 27 + 24 + 23 + 21 = 128 + 16 + 8 + 2 = 154What is 00101001 in decimal? 00101001 = 0*27 + 0*26 + 1*25 + 0*24 + 1*23 + 0*22 + 0*21 + 1*20 = 25 + 23 + 20 = 32 + 8 + 1 = 41 15
  16. 16. A bit of binary humor  Available for $15 at http://www.thinkgeek.com/ tshirts/frustrations/5aa9/ 16
  17. 17. Quick survey I understand the basics of converting numbers between decimal and binarya) Absolutely!b) More or lessc) Not reallyd) Not at all 17
  18. 18. How to add binary numbersConsider adding two 1-bit binary numbers x and y 0+0 = 0 0+1 = 1 x y Carry Sum 1+0 = 1 1+1 = 10 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0Carry is x AND ySum is x XOR yThe circuit to compute this is called a half-adder 18
  19. 19. The half-adder Sum = x XOR y Carry = x AND yx xy y Sum Sum Carry Carry 19
  20. 20. Using half addersWe can then use a half-adder to computethe sum of two Boolean numbers 1 0 0 1 1 0 0 +1 1 1 0 ? 0 1 0 20
  21. 21. Quick survey I understand half addersa) Absolutely!b) More or lessc) Not reallyd) Not at all 21
  22. 22. How to fix thisWe need to create an adder that can take acarry bit as an additional input x y c carry sum Inputs: x, y, carry in Outputs: sum, carry out 1 1 1 1 1This is called a full adder 1 1 0 1 0 Will add x and y with a half-adder 1 0 1 1 0 Will add the sum of that to the 1 0 0 0 1 carry in 0 1 1 1 0What about the carry out? 0 1 0 0 1 It’s 1 if either (or both): 0 0 1 0 1 x+y = 10 0 0 0 0 0 x+y = 01 and carry in = 1 22
  23. 23. The full adderThe “HA” boxes are half-adders c X HA S S s Y C C x X HA S c y Y C 23
  24. 24. The full adder The full circuitry of the full adderc sxy c 24
  25. 25. Adding bigger binary numbers Just chain full adders togetherx0 X HA S s0y0 Y Cx1 C X FA S s1y1 Y Cx2 C X FA S s2y2 Y Cx3 C X FA S s3y3 Y C c 25
  26. 26. Adding bigger binary numbersA half adder has 4 logic gatesA full adder has two half adders plus a OR gate Total of 9 logic gatesTo add n bit binary numbers, you need 1 HA andn-1 FAsTo add 32 bit binary numbers, you need 1 HAand 31 FAs Total of 4+9*31 = 283 logic gatesTo add 64 bit binary numbers, you need 1 HAand 63 FAs Total of 4+9*63 = 571 logic gates 26
  27. 27. Quick survey I understand (more or less) about adding binary numbers using logic gatesa) Absolutely!b) More or lessc) Not reallyd) Not at all 27
  28. 28. More about logic gatesTo implement a logic gate in hardware,you use a transistorTransistors are all enclosed in an “IC”, orintegrated circuitThe current Intel Pentium IV processorshave 55 million transistors! 28
  29. 29. Pentium math error 1 Intel’s Pentiums (60Mhz – 100 Mhz) had a floating point error Graph of z = y/x Intel reluctantly agreed to replace them in 1994Graph from http://kuhttp.cc.ukans.edu/cwis/units/IPPBR/pentium_fdiv/pentgrph.html 29
  30. 30. Pentium math error 2 Top 10 reasons to buy a Pentium:10 Your old PC is too accurate8.9999163362 Provides a good alibi when the IRS calls7.9999414610 Attracted by Intels new "You dont need to know whats inside" campaign6.9999831538 It redefines computing--and mathematics!5.9999835137 Youve always wondered what it would be like to be a plaintiff4.9999999021 Current paperweight not big enough3.9998245917 Takes concept of "floating point" to a new level2.9991523619 You always round off to the nearest hundred anyway1.9999103517 Got a great deal from the Jet Propulsion Laboratory0.9999999998 Itll probably work!! 30
  31. 31. Flip-flopsConsider the following circuit:What does it do? 31
  32. 32. MemoryA flip-flop holds a single bit of memory The bit “flip-flops” between the two NAND gatesIn reality, flip-flops are a bit morecomplicated Have 5 (or so) logic gates (transistors) per flip- flopConsider a 1 Gb memory chip 1 Gb = 8,589,934,592 bits of memory That’s about 43 million transistors!In reality, those transistors are split into 9ICs of about 5 million transistors each 32
  33. 33. Quick survey I felt I understood the material in this slide set…a) Very wellb) With some review, I’ll be goodc) Not reallyd) Not at all 33
  34. 34. Quick survey The pace of the lecture for this slide set was…a) Fastb) About rightc) A little slowd) Too slow 34

×