Field Guide · algorithm

Also known as: Gold code, Gold sequence

A Gold code is formed by XOR-ing two maximal-length sequences of the same length that are chosen as a “preferred pair,” yielding a large family of codes whose pairwise cross-correlation is low and tightly bounded.1 That property is exactly what a multi-user spread-spectrum system needs: each user (or satellite) gets its own Gold code, and the receiver separates them by correlation with minimal mutual interference.

m-sequence 1 (LFSR) m-sequence 2 (LFSR) XOR Gold code
A Gold code is the XOR of two preferred m-sequences; varying the relative phase of the second sequence generates the whole low-cross-correlation family.

How it works

Take two LFSR-generated m-sequences of length N = 2ⁿ−1, chosen so their cross-correlation takes only three values — a preferred pair. XOR the two sequences together. By shifting the second sequence by 0, 1, 2, … N−1 chips relative to the first before combining, you get N distinct Gold codes, and adding the two parent m-sequences themselves gives a family of N + 2 codes total.

The payoff is bounded cross-correlation. Any two codes in the family correlate to at most a small “three-valued” set of magnitudes — {−1, −t(n), t(n)−2} where t(n) ≈ 2^((n+2)/2) — far better and, crucially, more uniform than picking arbitrary m-sequences, whose mutual correlation can spike badly. Individual Gold codes are not maximal-length and have slightly worse autocorrelation sidelobes than a pure m-sequence, so there is a small trade of peak sharpness for a much larger, better-behaved family. For spreading many simultaneous users that trade is overwhelmingly worth it.

Relevance to SDR

The canonical use is GPS: every satellite transmits on the same 1575.42 MHz L1 carrier and is distinguished only by its 1023-chip Gold code (the PRN or C/A code), letting a GPS receiver — a CDMA receiver in disguise — acquire and separate satellites by correlation. Gold codes also serve as scrambling and spreading codes in cellular CDMA and other multi-access links. They sit in the same code family toolbox as Barker codes (short sync words) and Kasami codes (another low-cross-correlation family).

GopherTrunk’s land-mobile trunking targets do not use Gold codes, and the scanner implements no Gold-code correlator. The entry is here to explain how GNSS and CDMA build large sets of near-orthogonal spreading codes from the same LFSR machinery that also produces the scrambling sequences seen in digital voice protocols.

Sources

  1. Gold code — Wikipedia, for the preferred-pair XOR construction, family size, and the three-valued cross-correlation bound. 

See also