🖥️
Intro to Computer Science (ICS3U/C)
  • An Introduction to Computer Science
  • Videos & Slides
  • Unit 1: In the Beginning
    • The History of Computers
    • Binary & Logic
      • Bits and Bytes (Binary)
      • Transistors (Changing Bits)
      • Logic Gates
        • Poster
        • Logic.ly
    • The Parts of a Computer
  • Unit 2: Intro to Code
    • How Do We Code?
      • Coding Conventions (Rules)
      • Commenting Code
    • What is HTML?
      • Hello World! (in HTML)
      • HTML Slideshow
    • Hello World!
    • Input / Output
      • The Console
      • Prompt, Alert, Confirm
    • Variables & Data
      • Strings (Text)
      • Numbers (Values)
        • Converting & Rounding
        • The Math Object
          • Random Numbers
      • Booleans
        • Truthiness
      • Arrays
  • Unit 3: Control Flow
    • Conditionals (if this, do that)
      • If...Else
        • Logical Operators
      • Switch / Case
      • Ternary Operators
    • Loops (Repeating Code)
      • For...Loop
      • While & Do/While Loops
    • Debugging
  • Unit 4: Functions
    • Functional Programming
    • User Defined Functions
      • Hoisting and Scope
    • Calling a JS Function
  • TL;DR
    • Programming Basics
    • Slideshows & Demos
    • Javascript Syntax Poster
  • Advanced Topics
    • Recursion
    • Structures & Algorithms
    • Mmm... Pi
  • External Links
    • Typing Club!
    • repl.it
    • Khan Academy
    • Geek Reading
    • ECOO CS Contest
Powered by GitBook
On this page
  1. Unit 1: In the Beginning
  2. Binary & Logic

Logic Gates

PreviousTransistors (Changing Bits)NextPoster

Last updated 6 years ago

Controlling electricity gives us the ability to make yes and no decisions or true and false. By combining two signals, we can give a single true or false answer, depending on the logic. The flow of electricity is controlled using gates (no, not named after Bill Gates - like a ).

The simplest gate, this item inverts or reverses the signal. Q=A‾Q= \overline AQ=A

Input (A)

Output (Q)

0

1

1

0

Only outputs true if both inputs are true. Q=A⋅B or A×BQ = A \cdot B \text{ or } A \times BQ=A⋅B or A×B

A

B

Output (Q)

0

0

0

0

1

0

1

0

0

1

1

1

Any gate with a dot is an inverted gate. Q=A⋅B‾ or A×B‾Q = \overline{A \cdot B} \text{ or } \overline{A \times B}Q=A⋅B or A×B​ This is the NOT AND gate:

A

B

Output (Q)

0

0

1

0

1

1

1

0

1

1

1

0

One or the other or both! Q=A+BQ = A+BQ=A+B

A

B

Output (Q)

0

0

0

0

1

1

1

0

1

1

1

1

Very simply NOT OR. Q=A+B‾Q = \overline{A+B}Q=A+B​

A

B

Output (Q)

0

0

1

0

1

0

1

0

0

1

1

0

Exclusive OR meaning only one is true, not both. Q=A⨁BQ = A \bigoplus BQ=A⨁B

A

B

Output (Q)

0

0

0

0

1

1

1

0

1

1

1

0

Exclusively NOT OR. If both inputs are the same, output true. Q=A⨁B‾Q = \overline{A \bigoplus B}Q=A⨁B​

A

B

Output (Q)

0

0

1

0

1

0

1

0

0

1

1

1

A

B

AND

NAND

OR

NOR

XOR

XNOR

0

1

0

1

0

1

0

1

0

1

0

1

1

0

1

0

1

0

0

1

1

0

1

0

1

0

1

0

1

0

0

1

Individually:

The two "universal" gates are NOR and NAND - it is said that you can create all the other logic gates with a combination of just these two.

There are available about logic gates. If I had to pick a favourite, my current is , although she talks incredibly fast and you might need to slow it down or rewind.

tons of videos
this one
gate
Standard Logic Gate Symbols