mirror of
https://github.com/TrudeEH/web.git
synced 2025-12-06 16:33:37 +00:00
123 lines
1.3 KiB
Markdown
123 lines
1.3 KiB
Markdown
---
|
|
title: Logic Gates
|
|
description:
|
|
draft: false
|
|
tags:
|
|
- electronics
|
|
- computer-science
|
|
author: TrudeEH
|
|
showToc: true
|
|
---
|
|
|
|
## NOT
|
|
|
|
Invert the input.
|
|

|
|
|
|
### Truth Table
|
|
|
|
|**Input**|**Output**|
|
|
|---|---|
|
|
|0|1|
|
|
|1|0|
|
|
|
|
## AND
|
|
|
|
Output `1` only when both inputs are `1`.
|
|

|
|
|
|
### Truth Table
|
|
|
|
|A|**B**|**Output**|
|
|
|---|---|---|
|
|
|0|0|0|
|
|
|0|1|0|
|
|
|1|0|0|
|
|
|1|1|1|
|
|
|
|
## OR
|
|
|
|
Output `1` if at least one input is `1`.
|
|

|
|
|
|
### Truth Table
|
|
|
|
|A|**B**|**Output**|
|
|
|---|---|---|
|
|
|0|0|0|
|
|
|0|1|1|
|
|
|1|0|1|
|
|
|1|1|1|
|
|
|
|
## NAND
|
|
|
|
An `AND` gate followed by a `NOT` gate.
|
|

|
|
|
|
### Truth Table
|
|
|
|
|A|**B**|**Output**|
|
|
|---|---|---|
|
|
|0|0|1|
|
|
|0|1|1|
|
|
|1|0|1|
|
|
|1|1|0|
|
|
|
|
## NOR
|
|
|
|
An `OR` gate followed by a `NOT` gate.
|
|

|
|
|
|
### Truth Table
|
|
|
|
|A|**B**|**Output**|
|
|
|---|---|---|
|
|
|0|0|1|
|
|
|0|1|0|
|
|
|1|0|0|
|
|
|1|1|0|
|
|
|
|
## XOR
|
|
|
|
Either input is `1`, exclusively.
|
|

|
|

|
|
|
|
### Truth Table
|
|
|
|
|A|**B**|**Output**|
|
|
|---|---|---|
|
|
|0|0|0|
|
|
|0|1|1|
|
|
|1|0|1|
|
|
|1|1|0|
|
|
|
|
## XNOR
|
|
|
|
Inverted `XOR`.
|
|

|
|
|
|
### Truth Table
|
|
|
|
|A|**B**|**Output**|
|
|
|---|---|---|
|
|
|0|0|1|
|
|
|0|1|0|
|
|
|1|0|0|
|
|
|1|1|1|
|
|
|
|
## Implementation Examples
|
|
|
|
### NOT
|
|
|
|

|
|
|
|
### AND
|
|
|
|

|
|

|
|
|
|
### OR
|
|
|
|

|