Communication Technology

 

 

 

Gold Code

 

A Gold code is not one sequence but a family of them, and the family is built so that any two members look almost nothing like each other. That property is what lets many transmitters share one frequency, and it is why every LTE and NR scrambler is built on one.

What is a Gold Code ?

Gold Code is named after Robert Gold. It refers to a special set of binary Random (Pseudo Random) sequence in which the correlation among member sequences is very small. Due to this property (small correlation), this is widely used for various wireless communication system as a scrambling code.

Two numbers describe a Gold code family, and both come from one parameter. Start with shift registers of n stages. Every m-sequence they produce has period N = 2n - 1, and that is the length of each sequence in the family. The family itself holds 2n + 1 sequences. For n = 5 that means 33 different sequences, each 31 bits long.

That count is the reason Gold codes exist. Shift registers of a given length produce only a handful of distinct m-sequences, and a cellular system needs one sequence per cell or per user. Gold codes take two m-sequences and manufacture a large family from them, which matches what a real system needs far better.

One condition comes with the construction. The two m-sequences cannot be any two of the right length. They have to form what the literature calls a preferred pair. Preferred pairs exist only when n is odd, or when n leaves a remainder of 2 on division by 4. That is why you meet Gold codes built on 5, 7, 10 or 31 stages and never on 8 or 12.

  • A Gold code is a family, not a single sequence : naming one Gold code without saying which member is like naming a street without a number.
  • Length is 2n - 1 and the family size is 2n + 1 : both follow from the register length alone, so choosing n fixes how many users the code can separate.
  • The two m-sequences must be a preferred pair : an arbitrary pair of the right length gives a family with no bound on its cross-correlation. That bound is the one thing the construction is for.

How is it generated ?

We can generate a Gold Code in a very simple method using m-Sequence. If you pick a two m-sequence circuit with the same number of taps and combine the two circuit by XOR, it generate Gold Sequence.

Following is one example of Gold Sequence Generator Circuit.

 

Two five stage m-sequence shift register generators with different feedback taps, their outputs joined by an XOR to produce the Gold sequence

Figure 1. Two m-sequence generators, five registers each, with their outputs joined by a single XOR. The two feedback paths are different, which is what makes the two m-sequences different, and the XOR at the right produces the Gold sequence.

Read the drawing from the left. Each row is a linear feedback shift register: a chain of D registers, with some stage outputs fed back through XOR adders into the first register. That feedback pattern is the entire definition of an m-sequence, and the two rows here use different patterns. The top row closes its loop through one adder and the bottom row through three.

Only the XOR on the right belongs to the Gold construction. Everything to the left of it is two ordinary m-sequence generators running side by side, which is why the description above calls the method a simple one. The Gold part is one gate.

That circuit produces one sequence, and the family comes from changing where the second register starts. Hold the first chain at a fixed initial state, load the second chain with a different value each time, and each loading gives a different member. The textbook description says the same thing with a cyclic shift. The family is a, b, and a XOR Tkb for every shift k from 0 to N - 1.

The drawing below sets that construction out as a block diagram, with the shift made explicit.

Building the Gold code family m-sequence a m-sequence b cyclic shift by k + a XOR (b shifted by k) k runs from 0 to N - 1, so the XOR produces N different sequences. Count a and b themselves as members too and the family holds N + 2, which is 2 to the power n, plus 1.

Figure 2. The family comes from one XOR and one shift. Each value of k gives a different member, and a and b join the family themselves, which is where the count 2n + 1 comes from.

  • The Gold part is a single XOR gate : everything before it is two m-sequence generators. A Gold generator therefore costs one gate more than the pair it is built from.
  • The family member is selected by an initial state : in hardware nobody shifts a sequence. Loading a different starting value into the second register picks a different shift, and therefore a different member.
  • The two feedback patterns must differ : identical patterns would give two copies of one m-sequence, and their XOR would be all zeros.

Why does cross-correlation matter ?

A single m-sequence already has excellent autocorrelation. Line it up against a shifted copy of itself and the agreement collapses to almost nothing, which is what lets a receiver lock onto the right timing. Two different m-sequences of the same length are another matter.

Their cross-correlation is not controlled. For some pairs it stays small, and for others it is large enough that one transmitter's signal looks to the receiver like another transmitter's code. Assign m-sequences to users and the system has no guarantee it can keep them apart. A guarantee is exactly what a shared frequency needs.

Gold codes supply the guarantee. For a preferred pair, the cross-correlation between any two members of the family takes only three values, and all three are small compared with the sequence length. Write t(n) = 1 + 2m, where m is (n + 2) / 2 rounded down. The three values are then -1, -t(n) and t(n) - 2, whichever two members you compare.

The table below works those numbers out for the three register lengths you are most likely to meet.

n

Length 2n - 1

Family size 2n + 1

t(n)

Cross-correlation values

5

31

33

9

-1, -9, 7

7

127

129

17

-1, -17, 15

10

1023

1025

65

-1, -65, 63

Read the last row against the length beside it. The largest of the three values is 65, against a sequence length of 1023. So any two members correlate at roughly 6 per cent of full scale at worst, and that holds for every pair among the 1025 members. A receiver hunting one satellite among many relies on exactly that.

The trade is explicit, and it is worth naming. A Gold sequence has slightly worse autocorrelation than the pure m-sequence it came from. In exchange it gives a bounded cross-correlation across a family of 2n + 1 sequences. A system sharing one frequency cares far more about the second property, because interference between users is the limit it actually faces.

  • Autocorrelation finds timing, cross-correlation separates users : m-sequences are excellent at the first job and unreliable at the second, and a shared channel needs both.
  • Three values, and a bound that holds for the whole family : the guarantee applies to every pair of members, not to a lucky subset. That is what makes the family usable as an assignment list.
  • The bound grows only as the square root of the length : adding 2 to n roughly doubles t(n) and multiplies the length by four. The bound therefore shrinks against the length, so longer codes separate users better.

Where is it used ?

Two applications are worth knowing in detail, and between them they cover most of where an engineer meets a Gold code. One is the pseudo-random sequence that runs underneath the whole 3GPP physical layer. The other is the code that lets a receiver tell one satellite from another.

Common Application of this kind of Gold Code (Gold Sequence) is Scrambling procedure of Cellular Communication Channel Coding. Refer to LTE Physical Layer Sequence : Psuedo Random Sequence (Gold Sequence)

LTE and NR both build their pseudo-random sequence on a length-31 Gold code, and the two definitions match each other. Two 31 stage shift registers run in parallel. The first is loaded with a fixed initial state that never changes, and the second is loaded from a value the specification calls cinit. The first 1600 outputs are discarded before the sequence is used, which gives the two registers time to reach a well mixed state.

cinit is where the sequence becomes specific. Scrambling, reference signal generation and control channel processing all call the same generator and differ only in what they load into cinit. So one Gold code definition serves the whole physical layer, and the cell identity packed inside cinit is what stops neighbouring cells from scrambling identically.

GPS is the other example most engineers meet. The C/A code each satellite broadcasts is a Gold code built on 10 stage registers, so it runs 1023 chips long and comes from a family of 1025. Every satellite is assigned a different member, and a receiver separates satellites by correlating the incoming signal against each candidate in turn. The bounded cross-correlation in the table above is what makes that search reliable.

  • One generator, many uses, selected by cinit : the arithmetic never changes across the physical layer. Only the initial state does, and that is what ties a sequence to a cell, a slot or a channel.
  • The 1600 discarded outputs are not decoration : a shift register loaded with a sparse value produces a poor sequence at first. Discarding the run-in is what avoids that.
  • GPS makes the family size visible : 1025 members for 10 stage registers, and a receiver that has to pick the right one by trying them. The family size is the number of satellites the scheme could ever distinguish.