异或门如何构成给定的电路?

How can the XOR gate make the given circuit?

我正在尝试解决以下问题:

Which of the following logic circuits meets the condition described below?

[Condition] A light is turned on and off by using switches A and B located at the top and bottom of the stairs. The light can be turned on and off by using one switch, regardless of the status of the other switch

答案选项是:

答案sheet给出的答案是:d) XOR (How???)

看到给出的答案我很困惑。请帮助我理解它。

If switch B is 0:

Switch A is 0 -> Output is 0
Switch A is 1 -> Output is 1

If switch B is 1:

Switch A is 0 -> Output is 1
Switch A is 1 -> Output is 0

如您所见,我们可以只使用一个开关来控制输出,而不管另一个开关的状态如何。

使用 XOR 门,您可以在切换任何一个输入时切换输出状态

  • 如果两个开关都处于0状态,则输出为0,灯熄灭。现在打开一个开关,输出将为1(1 XOR 0 = 0 XOR 1 = 1),灯将被打开

  • 如果一个开关为0,一个为1,即灯处于ON状态。假设 A = 0 和 B = 1 不失一般性

    • 如果我们将 A 切换为 1,则灯会熄灭 (1 XOR 1 = 0)
    • 如果我们将 B 切换为 0,灯也会熄灭 (0 XOR 0 = 0)
  • 如果两个开关都处于 1 状态,则灯熄灭。切换任何开关都会打开灯