Loading slide

The Logic

  1. 01The Logic
  2. 02The connection
  3. 03Try it yourself
  4. 04What did you notice?
  5. 05Both must agree
  6. 06Either will do
  7. 07Here's an analogy to hammer home the point
  8. 08The inverter
  9. 09Gates talk to each other
  10. 10Three gates, one circuit
  11. 11Three rules
  12. 12Building logic
  13. 13A simple comparison
  14. 14Turn the rule into gates
  15. 15Flip before you compare
  16. 16Small rules stack up
  17. 17Take a breath
  18. 18What is 1+1?
  19. 19Addition, from scratch
  20. 20Two gates, that's it
  21. 21Memory
  22. 22Reinforce your understanding
  23. 23Question: AND gate
  24. 24Question: NOT gate
  25. 25Question: Binary addition
  26. 26Quiz: answer
  27. 27One switch
  28. 28Want to go deeper?
14 / 27
BackNext

Turn the rule into gates

The rule we need: turn the light on only when A is 1 and B is 0.

Let's try our gates and see if one already does this.

Start with AND. It only fires when both inputs are 1. So we feed it our winning case, A=1 and B=0. But B is 0, so the two inputs are not both 1. AND outputs 0. The light stays off. Wrong.

Try OR instead. It fires when either input is 1. With A=1 and B=0, it sees a 1, so it outputs 1. Correct, so far. But now flip the inputs: A=0, B=1. OR still sees a 1 and fires, lighting up even though B is the bigger one. Wrong too.

See the problem? AND wants both inputs to be 1. OR is happy with either. But our rule is pickier than both: it wants A to be 1 and B to be 0, specifically. No single gate does that.

Citations(2)↓
  1. 1. nand2tetris.org
  2. 2. dspace.mit.edu
Citations(2)↓
  1. 1. nand2tetris.org
  2. 2. dspace.mit.edu