Skip to content
BetterDL

Controlled inverter

Also called: XOR inverter, conditional inverter, programmable inverter

An XOR gate used as a switchable NOT: Y = B ⊕ M passes B unchanged when the control M = 0 and outputs B inverted when M = 1.

A controlled inverter is a single XOR gate with one input used as a control line M:

  • M = 0: Y = = B. The data passes straight through.
  • M = 1: Y = = . The data is inverted.

So XOR means "invert, if told to". The truth table shows it: the rows with M = 0 copy B, and the rows with M = 1 flip it.

It's the key part of an adder subtractor. Subtraction needs A + + 1, so each B bit passes through a controlled inverter before reaching its full adder. One control line drives every XOR at once, and the same line also sets the carry-in C0 for the +1. In an ALU, that line is the SUB signal decoded from the opcode.

The controlled inverter alone only produces the ones complement of B. Without the +1 from the carry-in, the result is one too small.

Why not another gate? XNOR inverts when M = 0, which is backwards for this job. AND forces the output to 0 when M = 0, and OR forces it to 1 when M = 1.

Y
000
011
101
110

Worked example

Example

Inverting a whole word

Four controlled inverters, one per bit, all sharing M. Take B = 0110.

BMY
  1. 1.

    M = 0: each XOR passes its bit, so the adder sees 0110.

  2. 2.

    M = 1: each XOR flips its bit, so the adder sees 1001.

  3. 3.

    1001 is the one's complement of B. The carry-in supplies the +1 that makes it −B.

Common mistakes

  • Using XNOR, which inverts when M = 0.

  • Forgetting that the inverters only produce the one's complement. C0 = 1 supplies the +1.

  • Putting the inverters on A instead of B when computing A − B.

Practice Controlled inverter

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Controlled inverter is taught in Adders and ALUs.