Glossary
Logic Gate | Building block of digital circuits that performs a logical operation on one or more binary inputs to produce a single binary output. |
Logic Circuit | Combination of interconnected logic gates that collectively perform a complex logical operation. |
AND | A logic gate that outputs 1 (true) only if all of its inputs are 1. Otherwise, it outputs 0. |
OR | A logic gate that outputs 1 if at least one of its inputs is 1. If all inputs are 0, it outputs 0. |
NOT | A logic gate that is the inverse of the AND gate. It outputs 0 only if all of its inputs are 1. Otherwise, it outputs 1. |
NAND | A logic gate that is the inverse of the AND gate. It outputs 0 only if all of its inputs are 1. Otherwise, it outputs 1. |
NOR | A logic gate that is the inverse of the OR gate. It outputs 1 only if all of its inputs are 0. Otherwise, it outputs 0. |
Universal Gate | A logic gate (NAND or NOR) capable of being used to construct any other logic gate (AND, OR, NOT) or logic circuit, making it "universal." |
Boolean Logic | A type of mathematics that works with only two values, TRUE (1) and FALSE (0). |
What is a Logic Gate?
A logic gate is a digital component that acts as a building block for a digital circuit that allows data to be manipulated using logical operations to give a single output. A single logic gates performs a particular logical operation and most of the time accepts two inputs and gives back one output.
At any given moment, every terminal is in one of the two Boolean states: FALSE, represented as 0; TRUE, represented as 1.
We can combine a number of logic gates into a logic circuit to perform complex logical operations.
Basic Logic Gates: AND, OR, NOT
The following logic gates are the simplest, each performing a specific logical operation to produce an output based on one or two inputs.
AND Gate
Outputs TRUE (1) only when both inputs are TRUE (1).
If either input is FALSE (0), the output will also be FALSE (0).
OR Gate
Outputs TRUE (1) if at least one input is TRUE (1).
The output is FALSE (0) only when both inputs are FALSE (0).
NOT Gate
Flips the input value.
If the input is TRUE (1), the output becomes FALSE (0), and vice versa.
What is a Logic Circuit?
A logic circuit is a group of connected logic gates designed to work together to perform a specific task. By combining different logic gates, we can create circuits that carry out more complex logical operations, like solving problems or controlling systems. At any moment, each part of the circuit is in one of two states: FALSE (0) or TRUE (1), based on Boolean logic.
Example: Security System Logic System
Consider a logic circuit with four components — three sensors (inputs) and a buzzer (output). The buzzer emits a sound when either of these conditions is met:
Both Sensor A AND Sensor B detect a breach (we can represent this using an AND gate).
OR (we can represent this using an OR gate)
Sensor C, indicating a stable system, is NOT off, (we can represent this as a NOT gate).
Your Turn: Pass O Level and Receive Certificate!
A student will receive an O Level certificate based on the following — they must be present for the exam and pass the exam or the student did not pass but was exempted because of special reasons. To clarify:
If the student passed the exam and was present, they get a certificate.
If the student did not pass but was present and exempted for special reasons, they still get a certificate!
Use the Logic Gate Simulator to represent the scenario. Which logic gates did you use?
Solution:
Wow, that was a bit of a head scratcher... right? This is what I came up with, although your solution could look a little bit different. Perhaps you used the 3-way AND gate to make it look neater?
Logic Circuit for the Half Adder
Do you recall when we did binary addition in Chapter 17?
A half adder is a digital circuit used to add two single-bit binary numbers. It has two inputs: A and B, the binary digits to be added, and two outputs: Sum and Carry:
The Sum output is the result of adding the two binary digits.
The Carry output represents any overflow that occurs when the sum is greater than 1, to explain, this occurrs when we A and B are both 1, therefore 1 + 1 is 1 Carry 1.
Here is how we can create a logic circuit for the half adder using basic gates:
The Sum of A and B is calculated using OR and NOT gates. The Sum will be 1 if one, and only one, of the inputs is 1. In other words, (A AND NOT B) OR (NOT A AND B).
The Carry is an AND gate, which outputs 1 only when both A and B are 1. In other words, A AND B.
Higher Order Logic Gates
Apart from AND, OR and NOT, there are other higher-order operators which are useful for certain cases. These are the NAND (NOT-AND), NOR (NOT-OR) and XOR (Exclusive OR), as illustrated below.
Notice how the similarity between the image for the AND operator and the NAND operator, with the NAND having a small circle to show that the AND value is inverted.
NAND Gate
Outputs TRUE (1) when at least one input is FALSE (1).
If all inputs are TRUE (0), then the output will be FALSE (0).
NOR Gate
Outputs TRUE (1) when all inputs are FALSE (0).
The output is FALSE (0) only at least one input is TRUE (1).
XOR Gate
If an odd number of inputs is TRUE (1), the output is also TRUE (1).
If an even number of inputs is TRUE (1), the output is FALSE (1).
We only manufacture NOR and NAND Gates
NOR and NAND gates are considered universal gates because they can be used to create any other logic gate, including AND, OR, NOT and XOR gates. This makes them extremely versatile and cost-effective for manufacturing. By using just these two "superhero" gates, we can design any digital circuit, reducing the need for a variety of different gates in production!
Hozzászólások