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?
15 / 27
BackNext

Flip before you compare

What if we could flip B before it reaches the AND gate?
Turn the 0 into a 1, so that AND can recognize it.

We do have a gate for that. The NOT gate flips a value.
0 becomes 1, 1 becomes 0.
Pass B through NOT first. B=0 becomes 1.
Now AND sees A=1 and NOT B=1. It fires. Correct.

Check every other case:
A=0 B=1: NOT B=0, AND outputs 0.
A=1 B=1: NOT B=0, AND outputs 0.
A=0 B=0: NOT B=1, AND outputs 0. All correct.

A AND (NOT B). Two gates. That's "is A bigger than B?"

Citations(2)↓
  1. 1. nand2tetris.org
  2. 2. charlespetzold.com
Citations(2)↓
  1. 1. nand2tetris.org
  2. 2. charlespetzold.com