Fredkin gate

From Wikipedia, the free encyclopedia

The Fredkin gate is computational circuit suitable for reversible computing, invented by Ed Fredkin. It is universal, which means that any logical or arithmetic operation can be constructed entirely of Fredkin gates.

The basic Fredkin gate is a controlled swap gate that maps three inputs (C, I1, I2) onto three outputs (C, O1, O2). The C input is mapped directly to the C output. If C=0, no swap is performed; I1 maps to O1, and I2 maps to O2. Otherwise, the two outputs are swapped so that I1 maps to O2, and I2 maps to O1. It is easy to see that this circuit is reversible, i.e., "undoes itself" when run backwards. A generalized n x n Fredkin gate passes its first n-2 inputs to the corresponding outputs, and swaps its last two outputs if and only if the first n-2 inputs are all 1.

INPUT OUTPUT
 0   0   0   0   0   0 
0 0 1 0 0 1
0 1 0 0 1 0
0 1 1 0 1 1
1 0 0 1 0 0
1 0 1 1 1 0
1 1 0 1 0 1
1 1 1 1 1 1

The Fredkin gate is the reversible 3-bit gate that swaps the last two bits if the first bit is 1. Its truthtable is shown to the right.

It has the useful property that the numbers of 0s and 1s are conserved throughout, which in the billiard ball model means the same number of balls are output as input. This corresponds nicely to the conservation of mass in physics, and helps to show that the model is not wasteful.

[edit] Example

Here is a diagram of a 3-bit adder implemented using Fredkin gates. The three inputs are A, B and C, supplemented by the constant T and F. In the diagram, the leftmost input (before the colon) swaps the two rightmost inputs if it is true.

Image: Fredkin_Full_Adder.PNG

[edit] See also

Languages