Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions notes/2023-10-19.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kernelspec:
---


# Why did we learn the plubming commands?
# Why did we learn the plumbing commands?

You will not typically use them on a day to day basis, but they are a good way to see what happens at the interim steps and make sure that you have the right understanding of what git does.

Expand Down Expand Up @@ -1061,4 +1061,4 @@ save your command history to `2023-10-19-log.txt` and put that file in your KWL

```{note}
due to scheduling issues this will be late today
```
```
71 changes: 71 additions & 0 deletions resources/understanding-logic-gates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Understanding Logic Gates

## What are logic gates?

Logic gates are used in digital circuits to preform logical functions in most electronics used today.

There are many types of logic gates, the four main gates we will look at are AND, OR, XOR, and NAND.

To understand how each one operates we can use truth tables to provide a better visual understanding.

Note: truth tables use 0's and 1's as input to get its output.

### AND Gate

AND gates use the logic of if input A and input B are both value 1 then the output is 1. So if either of input A or B are value 0 then the output is 0.

Truth Table:
| A | B | A AND B |
| --- | --- | :---: |
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |

### OR Gate

OR gates use the logic of if input A or input B are value 1 then the output is 1. So if one of the inputs are 1 then the output; regardless of the other input, is also 1.

Truth Table:
| A | B | A OR B |
| --- | --- | :---: |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |

### XOR Gate

XOR gates use the logic of if either input A or input B are value 1 then the output is 1 but if both are the same value then the output is 0. So if one of the inputs are a 1 then the output is 1, if both inputs are the same value then the output is 0.

Truth Table:
| A | B | A XOR B |
| --- | --- | :---: |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |

### NAND Gate

NAND gates use the logic of if the inverse of input A has a value of 1 or if both input A and B are 0 then the output will be 1; otherwise, if the inverse of input A is 0 and input B is 1 then the output is 0.

Truth Table:
| A | B | A NAND B |
| --- | --- | :---: |
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |

## Some Practice to learn the logic operations better

A great way to understand and familiarize yourself with logic operators is to write functions for each logic gate in a program that take input A and B as parameters and return the output.

#### Challenge

In your Inclass repo, create a program that contains each logic gate as a function and post your experience to the [discussions page](https://github.com/introcompsys/discussion-fa23-community/discussions).

## External resources

- [Online Logic Simulator](https://lodev.org/logicemu/)