02_XOR

XOR

As there are a lot of important applications for the exclusive-or (XOR) operation it is dedicated an own blog post. Two of the most important are:

  • XOR operations are often used in a Linear Feedback Shift Registers (LFSR). LFSR are a crucial step in scrambler / descrambler respectively, which are used in transmitters / receivers

  • Part of an encryption algorithmus

  • Last but not least an important part of a halfadder.

The exclusive-or operation xor which is also termed as antivalence is denoted as A ⊕ B = Q. Its truth table is shown below

A

B

Q

0

0

0

0

1

1

1

0

1

1

1

0

xor symbol

CMOS XOR

xor cmos

Some Applications

Linear Feedback Shift Register (LSFR)

As described above XOR gates are used in Linear Feedback Shift Registers (LFSR). LFSR are often used for test pattern generation. The author selected a simple example of a 3-bit LFSR found in a white paper from Texas Instruments.

lfsr

For this example we need to take a big leap and enter the area of sequential circuits. These are circuits which make use of feedback. The chosen example generates pseudo-random test patterns according to the table below. The registers are feed with the seed value 111, after 8 clock cycles the patterns repeat again. Of course real test pattern generators have a much higher bit width.

CLK

FF1

FF2

FF3

0

1

1

1

1

0

1

1

2

0

0

1

3

1

0

0

4

1

0

0

5

0

1

0

6

1

0

0

7

1

1

0

8

1

1

1

Halfadder

In the next blogpost we dive deeper into the halfadder application. The halfadder essentialy consists of the two following particular equations for sum (making use of the XOR ) and carry (using a simple AND).

\[ \begin{array}{c} c = x \land y \\ s = x \oplus y \end{array} \]