4.1 - Boolean Logic & Simple Logic Circuits
What logic gates are and how they work
Logic gates form the building blocks of computer circuits, allowing computers to make decisions and perform calculations using binary data. Binary data consists of just two values: 0 (representing false or off) and 1 (representing true or on). These gates take one or more binary inputs, process them according to specific rules, and produce a single binary output.
Key features of logic gates
- Inputs and outputs - Each gate receives binary inputs (0 or 1) and generates a binary output based on a fixed rule.
- Logic diagrams - These are drawings that use special symbols to represent gates and show how they connect in a circuit. Lines represent the flow of binary data between gates.
- Truth tables - These tables list every possible combination of inputs for a gate and show the corresponding output. They help predict how a gate or circuit will behave.
Logic gates apply rules from Boolean algebra, which is a type of maths that deals with true and false values using operators like NOT, AND, and OR.
Boolean operations and their role in logic gates
Boolean operations are the rules that logic gates follow to process binary data. There are three main operations used in basic logic gates: NOT, AND, and OR. Each operation defines how inputs are combined to produce an output.
The three main Boolean operations:
NOToperation - This reverses the input: true becomes false, and false becomes true (1 becomes 0, and 0 becomes 1).ANDoperation - This produces true (1) only if all inputs are true (1); otherwise, it gives false (0).ORoperation - This produces true (1) if at least one input is true (1); it gives false (0) only if all inputs are false (0).
The NOT gate
A NOT gate is the simplest type of logic gate. It takes just one input and produces one output that is always the opposite of the input. This gate represents the NOT Boolean operation, which inverts the binary value.
Symbol for a NOT gate
The symbol is a triangle pointing to a small circle, with an input line on the left and an output line on the right. The circle indicates inversion.
Truth table for a NOT gate
| Input | Output |
|---|---|
| 0 | 1 |
| 1 | 0 |
This table shows that whatever goes in comes out reversed. For instance, if the input is 0, the output is 1, and vice versa.
The AND gate
An AND gate takes two inputs and produces one output. It represents the AND Boolean operation, where the output is 1 only if both inputs are 1. If either input (or both) is 0, the output is 0.
Symbol for an AND gate
The symbol looks like a capital D shape: two input lines connect to the flat side, and one output line extends from the curved side.
Truth table for an AND gate
| Input A | Input B | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
The table demonstrates that both inputs must be 1 for the output to be 1. This is useful for situations where multiple conditions must all be true.
The OR gate
An OR gate also takes two inputs and produces one output. It follows the OR Boolean operation, where the output is 1 if at least one input is 1. The output is 0 only if both inputs are 0.
Symbol for an OR gate
The symbol is a crescent shape with a concave curve on the input side: two input lines connect to the curved side, and one output line comes from the pointed side.
Truth table for an OR gate
| Input A | Input B | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
This table shows that the output is 1 as long as one or both inputs are 1, making it ideal for "either/or" scenarios.