Logic Gates: Basic Circuits and Truth Tables | 逻辑门:基本电路与真值表

📚 Logic Gates: Basic Circuits and Truth Tables | 逻辑门:基本电路与真值表

Logic gates are the fundamental building blocks of digital circuits. They take one or more binary inputs and produce a single binary output based on a defined logical operation. In A-Level Computer Science, understanding logic gates, their symbols, truth tables, and how they combine into circuits is essential.

逻辑门是数字电路的基本构件。它们接收一个或多个二进制输入,并根据定义好的逻辑运算产生一个二进制输出。在 A-Level 计算机科学中,理解逻辑门、其符号、真值表以及它们如何组合成电路是至关重要的。


1. Why Logic Gates Matter | 为什么逻辑门很重要

Every digital device, from a simple calculator to a modern CPU, relies on logic gates to process data. These gates operate on binary values: 1 (true / high voltage) and 0 (false / low voltage). By combining thousands of gates, engineers can build complex systems such as adders, multiplexers, and memory units.

从简单的计算器到现代的 CPU,每一个数字设备都依赖逻辑门来处理数据。这些门基于二进制值工作:1(真/高电压)和 0(假/低电压)。通过组合成千上万个门,工程师可以构建诸如加法器、多路选择器和存储单元等复杂系统。

In the CIE syllabus, you are expected to recognise the standard symbols, construct truth tables, derive Boolean expressions, and interpret combined circuits.

在 CIE 教学大纲中,你需要识别标准符号、构建真值表、推导布尔表达式,并解释组合电路。


2. Basic Gates: AND, OR, NOT | 基本门:与门、或门、非门

AND gate produces an output of 1 only when all of its inputs are 1. Its Boolean expression is written as A · B (or simply AB).

与门(AND) 仅当其所有输入均为 1 时,输出才为 1。其布尔表达式写作 A · B(或简写为 AB)。

  • English: A AND B = A · B; output = 1 only if A = 1 and B = 1.
  • 中文:A AND B = A · B;只有当 A = 1 且 B = 1 时,输出才为 1。

OR gate produces an output of 1 when at least one input is 1. Its Boolean expression is written as A + B.

或门(OR) 当至少一个输入为 1 时,输出为 1。其布尔表达式写作 A + B。

  • English: A OR B = A + B; output = 1 if A = 1 or B = 1 (or both).
  • 中文:A OR B = A + B;只要 A = 1 或 B = 1(或两者均为 1),输出即为 1。

NOT gate (inverter) flips the input: output is the opposite of the input. Its Boolean expression is written as Ā (or Ā, or NOT A).

非门(NOT)(反相器)将输入取反:输出是输入的反值。其布尔表达式写作 Ā(或 Ā,或 NOT A)。

  • English: NOT A = Ā; output = 1 if A = 0, and output = 0 if A = 1.
  • 中文:NOT A = Ā;若 A = 0,则输出 1;若 A = 1,则输出 0。

These three gates are sufficient to build any possible logical circuit, but other gates are used for convenience and efficiency.

这三个门足以构建任何逻辑电路,但为了便利和高效,还会使用其他门。


3. Universal Gates: NAND and NOR | 通用门:与非门和或非门

NAND gate is an AND gate followed by a NOT gate. Its output is the inverse of the AND output. Boolean expression: A NAND B = NOT (A · B), often written as A ↑ B or (A·B) with an overline.

与非门(NAND) 是与门后接非门。其输出是与门输出的反相。布尔表达式:A NAND B = NOT (A · B),常写作 A ↑ B 或 (A·B) 上方加横线。

  • English: NAND output = 0 only when both inputs are 1; otherwise output = 1.
  • 中文:与非门输出仅在两个输入都为 1 时为 0;其他情况输出均为 1。

NOR gate is an OR gate followed by a NOT gate. Boolean expression: A NOR B = NOT (A + B), written as A ↓ B or (A+B) with an overline.

或非门(NOR) 是或门后接非门。布尔表达式:A NOR B = NOT (A + B),写作 A ↓ B 或 (A+B) 上方加横线。

  • English: NOR output = 1 only when both inputs are 0; otherwise output = 0.
  • 中文:或非门输出仅在两个输入都为 0 时为 1;其他情况输出均为 0。

NAND and NOR are called universal gates because you can construct AND, OR, and NOT gates using only NAND gates (or only NOR gates). This property is important for circuit simplification and chip manufacturing.

与非门和或非门被称为通用门,因为仅使用与非门(或仅使用或非门)就可以构建与门、或门和非门。这种特性对于电路简化和芯片制造非常重要。


4. Exclusive Gates: XOR and XNOR | 异或门和同或门

XOR (exclusive OR) gate outputs 1 when the inputs are different. Boolean expression: A XOR B = A ⊕ B (or A·B̄ + Ā·B).

异或门(XOR) 当输入不同时输出 1。布尔表达式:A XOR B = A ⊕ B(或 A·B̄ + Ā·B)。

  • English: XOR output = 1 if exactly one input is 1.
  • 中文:异或门输出在恰好一个输入为 1 时等于 1。

XNOR (exclusive NOR) gate outputs 1 when the inputs are the same. Boolean expression: A XNOR B = NOT (A ⊕ B), often written as A ⊙ B.

同或门(XNOR) 当输入相同时输出 1。布尔表达式:A XNOR B = NOT (A ⊕ B),常写作 A ⊙ B。

  • English: XNOR output = 1 if both inputs are equal.
  • 中文:同或门输出在输入相等时为 1。

XOR gates are widely used in arithmetic circuits, particularly for addition (half adders and full adders).

异或门广泛用于算术电路,特别是加法操作(半加器和全加器)。


5. Truth Tables for All Basic Gates | 所有基本门的真值表

A truth table lists every possible combination of inputs and the corresponding output. For two inputs, there are 4 combinations. For n inputs, there are 2ⁿ combinations.

真值表列出所有可能的输入组合及对应的输出。对于两个输入,有 4 种组合。对于 n 个输入,有 2ⁿ 种组合。

A B AND OR NAND NOR XOR XNOR
0 0 0 0 1 1 0 1
0 1 0 1 1 0 1 0
1 0 0 1 1 0 1 0
1 1 1 1 0 0 0 1

For the NOT gate (single input):

对于非门(单输入):

A NOT A
0 1
1 0

6. Circuit Symbols | 电路符号

You must be able to recognise and draw the standard IEC (International Electrotechnical Commission) symbols for logic gates. These are used in CIE examinations.

你必须能够识别和绘制逻辑门的标准 IEC(国际电工委员会)符号。CIE 考试中使用这些符号。

  • AND gate: a D-shaped body with two inputs and one output.
  • 中文:与门:D 形主体,两个输入和一个输出。
  • OR gate: a curved-body shape with a concave input side.
  • 中文:或门:弯曲的主体形状,输入侧呈凹形。
  • NOT gate: a triangle with a small circle (bubble) at the output.
  • 中文:非门:一个三角形,输出端带一个小圆圈(气泡)。
  • NAND gate: an AND gate with a bubble at the output.
  • 中文:与非门:与门输出端加一个气泡。
  • NOR gate: an OR gate with a bubble at the output.
  • 中文:或非门:或门输出端加一个气泡。
  • XOR gate: an OR gate with an extra curved line on the input side.
  • 中文:异或门:或门输入侧多一条曲线。
  • XNOR gate: an XOR gate with a bubble at the output.
  • 中文:同或门:异或门输出端加一个气泡。

Note: In some questions you may also see the older rectangular symbols. Make sure you use the symbols taught in your syllabus to avoid losing marks.

注意:某些题目中也可能出现较旧的矩形符号。请务必使用你教学大纲中教授的符号,以免失分。


7. Combined Logic Circuits | 组合逻辑电路

A combined logic circuit uses multiple gates connected together to perform a more complex function. To analyse a circuit, you should label intermediate outputs and work step by step.

组合逻辑电路使用多个门连接起来实现更复杂的功能。分析电路时,应标出中间输出并逐步推导。

Example: Given a circuit with inputs A and B going into an AND gate, and input C going through a NOT gate; the outputs of these two gates feed into an OR gate. The final output X can be written as:

示例:一个电路,A 和 B 输入与门,C 经过非门;这两个门的输出再输入或门。最终输出 X 可写为:

X = (A · B) + C̄

To write the truth table, first list all combinations of A, B, C (8 rows). Then compute the AND output, then the NOT output, and finally the OR output.

要写出真值表,先列出 A、B、C 的所有组合(8 行),然后计算与门输出、非门输出,最后计算或门输出。

A B C A · B X = (A·B) + C̄
0 0 0 0 1 1
0 0 1 0 0 0
0 1 0 0 1 1
0 1 1 0 0 0
1 0 0 0 1 1
1 0 1 0 0 0
1 1 0 1 1 1
1 1 1 1 0 1

8. Boolean Expression from a Circuit | 从电路推导布尔表达式

When given a logic circuit, you can derive its Boolean expression by identifying each gate and writing the output in terms of its inputs. Work from left to right, labelling each intermediate output.

给定逻辑电路时,可以通过识别每个门并用其输入写出输出来推导布尔表达式。从左到右依次标出每个中间输出。

For example, if a circuit has inputs P and Q entering a NAND gate, and the output enters a NOT gate, the final expression is:

例如,如果电路输入 P 和 Q 进入与非门,其输出再进入非门,则最终表达式为:

Y = NOT (P NAND Q) = (P · Q)

This is actually equivalent to an AND gate, because double inversion cancels out. Recognising such equivalences can help simplify expressions.

这实际上等价于一个与门,因为双重取反相互抵消。识别这种等价关系有助于简化表达式。

Common equivalences you should know:

你应该掌握的常见等价关系:

  • NOT(NOT A) = A
  • 中文:非(非 A)= A
  • A · 1 = A; A · 0 = 0
  • 中文:A · 1 = A;A · 0 = 0
  • A + 1 = 1; A + 0 = A
  • 中文:A + 1 = 1;A + 0 = A
  • A · A = A; A + A = A
  • 中文:A · A = A;A + A = A
  • A · Ā = 0; A + Ā = 1 (Complementation law)
  • 中文:A · Ā = 0;A + Ā = 1(互补律)
  • De Morgan’s laws: NOT(A · B) = NOT A + NOT B; NOT(A + B) = NOT A · NOT B
  • 中文:德摩根定律:非(A · B) = 非 A + 非 B;非(A + B) = 非 A · 非 B

9. Constructing Circuits from Boolean Expressions | 根据布尔表达式构建电路

To draw a circuit from a Boolean expression, identify the main operations and their order. Use brackets to determine precedence: expressions inside brackets should be built first.

要根据布尔表达式绘制电路,先确定主要运算及其顺序。使用括号判断优先级:括号内的表达式应优先构建。

Example: Draw a circuit for X = (A + B) · C̄.

示例:绘制 X = (A + B) · C̄ 的电路。

  1. Build OR gate with inputs A and B to produce A + B.
  2. 中文:用输入 A 和 B 构建或门,产生 A + B。
  3. Pass C through a NOT gate to produce C̄.
  4. 中文:将 C 通过非门产生 C̄。
  5. Feed the outputs of the OR gate and the NOT gate into an AND gate.
  6. 中文:将或门和非门的输出送入与门。

The final output is X. This process is systematic and works for any expression using basic gates.

最终输出为 X。这个过程是系统化的,适用于任何使用基本门的表达式。


10. Exam Tips and Common Mistakes | 考试技巧与常见错误

Here are some important tips to avoid losing marks in logic gate questions:

以下是一些避免在逻辑门题目中失分的重要提示:

  • Always write the truth table row by row in binary order (000, 001, 010, …).
  • 中文:始终按二进制顺序(000、001、010……)逐行写真值表。
  • Do not confuse NAND with NOR. NAND is the inverse of AND, NOR is the inverse of OR.
  • 中文:不要混淆与非门和或非门。与非门是与门的反向,或非门是或门的反向。
  • Remember that a bubble (small circle) always indicates inversion.
  • 中文:记住气泡(小圆圈)总是表示取反。
  • When deriving expressions, write down intermediate outputs clearly.
  • 中文:推导表达式时,清楚地写出中间输出。
  • Check that the number of rows in a truth table equals 2ⁿ for n inputs.
  • 中文:检查真值表的行数是否等于 2ⁿ,其中 n 是输入个数。
  • Use standard symbols; do not invent your own.
  • 中文:使用标准符号;不要自创符号。
  • Practise De Morgan’s laws until you can apply them quickly.
  • 中文:练习德摩根定律,直到你能快速应用。

By mastering these fundamentals, you will be well-prepared for logic gate questions in the CIE A-Level Computer Science examination.

掌握这些基础知识后,你将为 CIE A-Level 计算机科学考试中的逻辑门题目做好充分准备。

Published by TutorHao | Computer Science Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version