📚 IGCSE Computer Science: The Six Logic Gates Explained | 六种逻辑门的功能详解
Logic gates are the fundamental building blocks of all digital electronic circuits. In IGCSE Computer Science, you need to know how six specific gates behave and how to represent their behaviour using truth tables and logic expressions.
逻辑门是所有数字电子电路的基本构件。在IGCSE计算机科学课程中,你需要掌握六种特定逻辑门的行为方式,并学会用真值表和逻辑表达式表示它们。
1. What Is a Logic Gate? | 什么是逻辑门?
A logic gate takes one or more binary inputs, labelled 0 or 1, and produces a single binary output. The output is determined by a fixed rule that depends on the type of gate.
逻辑门接收一个或多个二进制输入(0或1),并根据该逻辑门的固定规则产生一个二进制输出。
In CIE IGCSE, inputs are usually labelled A and B, and the output is labelled Q. A ‘0’ represents a low voltage, while a ‘1’ represents a high voltage.
在CIE IGCSE中,输入通常标记为A和B,输出标记为Q。’0’代表低电压,’1’代表高电压。
There are six logic gates in the syllabus: NOT, AND, OR, NAND, NOR and XOR. Each gate has its own symbol, truth table and logic expression.
大纲中要求掌握六种逻辑门:非门(NOT)、与门(AND)、或门(OR)、与非门(NAND)、或非门(NOR)和异或门(XOR)。每种门都有自己对应的符号、真值表和逻辑表达式。
2. Truth Tables and Binary States | 真值表与二进制状态
A truth table shows every possible combination of inputs and the corresponding output. For one input there are 2 possible rows; for two inputs there are 4 possible rows.
真值表列出所有可能的输入组合以及对应的输出。一个输入有2行可能情况;两个输入有4行可能情况。
To build a two-input truth table, list the binary numbers 00, 01, 10 and 11. This ensures every combination is included.
要构建双输入真值表,请按顺序列出二进制数00、01、10和11,这样就能覆盖所有可能的组合。
| A | B |
| 0 | 0 |
| 0 | 1 |
| 1 | 0 |
| 1 | 1 |
Remember that a gate with two inputs always has exactly 4 rows in its truth table. A gate with one input always has exactly 2 rows.
请记住:两个输入的逻辑门,其真值表一定有4行;一个输入的逻辑门,其真值表一定有2行。
3. NOT Gate | 非门
The NOT gate has one input A and one output Q. It inverts the input: if A is 0, Q is 1; if A is 1, Q is 0. It is also called an inverter.
非门有一个输入A和一个输出Q。它把输入取反:若A为0,则Q为1;若A为1,则Q为0。它也被称为反相器。
Q = NOT A
| A | Q |
| 0 | 1 |
| 1 | 0 |
The NOT gate is the simplest gate because it has no decision to make: it simply flips the signal.
非门是最简单的逻辑门,因为它不需要做任何判断,只是简单地把信号翻转。
4. AND Gate | 与门
The AND gate has two inputs, A and B, and one output Q. The output Q is 1 only when A is 1 AND B is 1. In every other case, Q is 0.
与门有两个输入A和B,以及一个输出Q。只有当A为1且B为1时,输出Q才为1;在其它任何情况下,Q都为0。
Q = A AND B
| A | B | Q |
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
A useful way to remember the AND gate is that it only produces a 1 when every input is 1. It is often described as “all or nothing”.
记住与门的一个好方法是:只有当所有输入都为1时,输出才为1。它经常被描述为“全都为1才为1”。
5. OR Gate | 或门
The OR gate has two inputs, A and B, and one output Q. The output Q is 1 when at least one input is 1. Therefore Q is 0 only when both A and B are 0.
或门有两个输入A和B,以及一个输出Q。只要有一个输入为1,输出Q就为1。因此只有当A和B都为0时,Q才为0。
Q = A OR B
| A | B | Q |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
A helpful way to remember the OR gate is that it produces a 1 whenever any input is 1. It only gives 0 when all inputs are 0.
记住或门的一个好方法是:只要任意一个输入为1,输出就为1;只有所有输入都为0时,输出才为0。
6. NAND Gate | 与非门
The NAND gate is the opposite of the AND gate. It behaves exactly like an AND gate followed by a NOT gate. The output Q is 0 only when both inputs are 1.
与非门是与门的相反版本。它的行为就像与门后面再接一个非门。只有当两个输入都为1时,输出Q才为0。
Q = A NAND B = NOT (A AND B)
| A | B | Q |
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
NAND is known as a “universal gate” because any other logic gate can be built using only NAND gates. You do not need to build them in the exam, but it helps to understand why NAND is important.
与非门被称为“通用门”,因为只使用与非门就可以构造出任何其它逻辑门。你不需要在考试中实际构造它们,但理解与非门为什么重要会很有帮助。
7. NOR Gate | 或非门
The NOR gate is the opposite of the OR gate. It behaves exactly like an OR gate followed by a NOT gate. The output Q is 1 only when both inputs are 0.
或非门是或门的相反版本。它的行为就像或门后面再接一个非门。只有当两个输入都为0时,输出Q才为1。
Q = A NOR B = NOT (A OR B)
| A | B | Q |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
NOR is also a universal gate. Its truth table is the exact inverse of the OR gate’s truth table.
或非门也是一种通用门。它的真值表正好是或门真值表的反相结果。
8. XOR Gate | 异或门
The XOR gate, short for exclusive OR, has two inputs A and B and one output Q. The output Q is 1 when the two inputs are different. If A and B are the same, Q is 0.
异或门(XOR)的完整名称是“ exclusive OR”。它有两个输入A和B以及一个输出Q。当两个输入不同时,输出Q为1;如果A和B相同,则Q为0。
Q = A XOR B
| A | B | Q |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
A simple way to remember XOR is “different gives 1, same gives 0”. It is often used in circuits where a comparison between two bits is needed.
记住异或门的一个简单方法是“不同则1,相同则0”。它常用于需要对两个二进制位进行比较的电路中。
9. Recognising Gate Symbols | 识别逻辑门符号
The symbols used in CIE IGCSE are based on the standard IEEE/ANSI shapes. You must be able to draw and recognise each one quickly.
CIE IGCSE使用的符号基于标准的IEEE/ANSI形状。你必须能够快速画出并识别每一种符号。
- NOT: a triangle pointing right with a small circle at the tip.
- 非门:一个指向右边的三角形,尖端带一个小圆圈。
- AND: a D-shaped block with a flat left side and a curved right side.
- 与门:一个D形块,左侧平直,右侧弯曲。
- OR: a curved shield shape with a concave left side.
- 或门:一个弯曲的盾形,左侧向内凹陷。
- NAND: the AND symbol with a small circle at the output.
- 与非门:与门符号,但在输出端加一个小圆圈。
- NOR: the OR symbol with a small circle at the output.
- 或非门:或门符号,但在输出端加一个小圆圈。
- XOR: the OR symbol with an extra curved line on the left input side.
- 异或门:或门符号,但在左侧输入边多一条弧线。
In an exam, always draw the circle clearly for NAND and NOR. If you forget the circle, the gate becomes an AND or OR gate and the whole truth table changes.
考试中画与非门和或非门时,一定要把小圆圈画清楚。如果漏掉了小圆圈,门就会变成与门或或门,整个真值表都会改变。
10. Combining Gates in Circuits | 组合门电路
Logic gates are rarely used alone. Exam questions often give a circuit diagram and ask you to complete its truth table or write a logic expression.
逻辑门很少单独使用。考试题通常会给出一个电路图,要求你补全真值表或写出逻辑表达式。
For example, suppose a circuit has inputs A and B that go into an AND gate, and the output of the AND gate goes into a NOT gate. The final output is Q = NOT (A AND B). This is exactly a NAND gate.
例如,假设一个电路有输入A和B,它们进入一个与门,然后与门的输出再进入一个非门。最终输出为Q = NOT (A AND B)。这实际上就是一个与非门。
To analyse a combination circuit, work step by step from inputs to outputs. Write the intermediate result after each gate before calculating the final output.
分析组合电路时,要从输入到输出逐步推导。在计算最终输出之前,先写出每个逻辑门之后的中间结果。
11. Logic Gate Exam Tips | 逻辑门考试技巧
Here are the most common mistakes students make in the IGCSE Computer Science logic gate questions.
以下是学生在IGCSE计算机科学逻辑门题目中最常犯的错误。
- Always include all rows in a truth table. Two-input gates need 00, 01, 10, 11.
- 一定要在真值表中包含所有行。两个输入的门必须包含00、01、10、11。
- Do not confuse NAND with NOR. NAND is NOT AND; NOR is NOT OR.
- 不要混淆与非门和或非门。与非门是“与门取反”;或非门是“或门取反”。
- Remember that XOR gives 1 for different inputs, not for one specific input.
- 记住异或门是“输入不同时输出1”,而不是针对某一个特定输入。
- When writing expressions, use the exact wording from the syllabus: NOT, AND, OR, NAND, NOR, XOR.
- 写逻辑表达式时,使用大纲中的标准写法:NOT、AND、OR、NAND、NOR、XOR。
- Check the final output column carefully. One wrong row can lose several marks.
- 仔细检查最后输出那一列。错一行就可能丢掉几分。
Practice by drawing each gate from memory, then writing its truth table and expression. Repetition is the best way to memorise all six gates.
可以通过默画每种逻辑门、写出真值表和表达式来练习。重复记忆是掌握六种逻辑门最好的方法。
12. Summary Table | 总结表
The table below summarises the behaviour of all six logic gates. It is a useful revision aid for the exam.
下表总结了六种逻辑门的行为,是备考时非常有用的复习工具。
| Gate | Expression | Output is 1 when… |
| NOT | Q = NOT A | A is 0 |
| AND | Q = A AND B | both A and B are 1 |
| OR | Q = A OR B | at least one input is 1 |
| NAND | Q = A NAND B | at least one input is 0 |
| NOR | Q = A NOR B | both inputs are 0 |
| XOR | Q = A XOR B | A and B are different |
Once you can complete the truth table for each gate without looking, you are ready for logic gate questions in the IGCSE Computer Science exam.
当你能够不看资料就写出每种逻辑门的真值表时,你就能从容应对IGCSE计算机科学考试中的逻辑门题目了。
Published by TutorHao | CS Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply