Learn: Logic Gates
Lesson 1 of 1
1. 1
Computers are capable of dizzying feats, but they’re built from humble origins. At the lowest level, computers run on electric currents limited to two states: power or no power. There are many way…
2. 2
Logic gates have certain rules that determine what the outputs are with respect to the inputs a and b. When we are analyzing a logic gate, we can visualize all of the possible outputs by making a _…
3. 3
Our first gate is the NAND gate. This gate receives two inputs and only returns current if the inputs are both off. Here’s the truth table: |a|b|output| |-|-|-| |0|0|1| |0|1|1| |1|0|1| |…
4. 4
Now that we’ve completed our NAND_gate(), we can use that function to build other gates. This time you’re starting from scratch, so lean on that truth table. Fortunately, our next gate, NOT only…
5. 5
Our next gate is the AND gate. This gate receives two inputs and only returns current if the inputs are both on. As in previous exercises, you’ll only be able to use gates you’ve previously bu…
6. 6
The next gate we are going to build is the OR gate. This gate receives two inputs and returns 1 if either one of the inputs is 1. To build your OR_gate(), you should use any combination of the g…
7. 7
Now, we are going to create what’s called an XOR gate, an exclusive or gate. This gate receives two inputs, a and b, and only returns a 1 if one of the inputs is 1, but not if both of the inputs …
8. 8
Congratulations! You’ve built out an impressive array of logic gates. The physical representations of these gates are most likely being used in the computer you’re using right now!
9. 9
Up until now, our logic circuits have produced the same output for a given input. What if we wanted to incorporate branching into our circuits? Branching is when the output is chosen by a third…
10. 10
The logic gate that was introduced in the last exercise is called a multiplexer. It takes in the inputs a and b and a selection bit s, and outputs either a or b, depending on what s is. Here is …
11. 11
If a multiplexer takes two inputs and channels it into one based on a selector bit, a demultiplexer performs the opposite function: it takes a single input and splits it into two outputs based on a…
12. 12
Good job! You’ve started with little bits, and you’ve built out an entire toolkit of logic gates you now can use to perform more complicated operations. You’re well on your way to creating an entir…

## What you'll create

Portfolio projects that showcase your new skills

## How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory