0% found this document useful (0 votes)
123 views

Gold Code Generator Using LFSRs - GaussianWaves

This document discusses the generation of Gold codes using linear feedback shift registers (LFSRs). Gold codes are suitable for multi-user spread spectrum applications as they allow a large number of codes with good correlation properties to be generated simply. The document describes how to generate Gold codes by XORing two preferred maximal linear shift register sequences (m-sequences) of the same length, maintaining their phase relationship. It provides an example implementation of a 127-bit Gold code generator and analyzes the correlation properties of the generated codes.

Uploaded by

hadeer.h
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views

Gold Code Generator Using LFSRs - GaussianWaves

This document discusses the generation of Gold codes using linear feedback shift registers (LFSRs). Gold codes are suitable for multi-user spread spectrum applications as they allow a large number of codes with good correlation properties to be generated simply. The document describes how to generate Gold codes by XORing two preferred maximal linear shift register sequences (m-sequences) of the same length, maintaining their phase relationship. It provides an example implementation of a 127-bit Gold code generator and analyzes the correlation properties of the generated codes.

Uploaded by

hadeer.h
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

LATEST ARTICLES < HTTPS://WWW.GAUSSIANWAVES.

COM/CATEGORY/LATEST-
ARTICLES/>
SIGNAL PROCESSING < HTTPS://WWW.GAUSSIANWAVES.COM/CATEGORY/SIGNAL-
PROCESSING/>
SPREAD SPECTRUM < HTTPS://WWW.GAUSSIANWAVES.COM/CATEGORY/SPREAD-
SPECTRUM/>

Gold code generator using LFSRs


By Mathuranathan < https://www.gaussianwaves.com/author/mathuranathan/>

June 9, 2015 < https://www.gaussianwaves.com/2015/06/gold-code-generator/>

No Comments < https://www.gaussianwaves.com/2015/06/gold-code-generator/#respond>

Focus of this article is to discuss the details of Gold code generator using preferred pair m-
sequences, implemented using linear feedback shift registers (LFSR). Finally we plot and
investigate correlation properties of the generated Gold codes.

Introduction
In a multi-user environment (like spread spectrum, CDMA ) large number of codes with
good correlation properties, is a necessity. Gold codes are suited for this application, since
a large number of codes with controlled correlation can be generated by a simple time shift
of two preferred m-sequences.

Gold sequences belong to the category of product codes where two m-sequences <
https://www.gaussianwaves.com/2018/09/maximum-length-sequences-m-sequences/>
of same length are XOR’ed to produce a Gold sequence. The two m-sequence must
maintain the same phase relationship till all the additions are performed. A slight change of
phase even in one of the m-sequences, produces a different Gold sequence altogether. Gold
codes are non-maximal and therefore they have poor auto-correlation property when
compared to that of the underlying m-sequences.

This site uses cookies responsibly. Learn more in our privacy policy <
https://www.gaussianwaves.com/privacy-policy> .

Cookie settings ACCEPT


This article is part of the book
● Wireless Communication Systems in Matlab (second edition) <
https://www.gaussianwaves.com/buy-books/> , ISBN: 979-8648350779 available
in ebook (PDF) format < https://www.gaussianwaves.com/buy-books/> and
Paperback (hardcopy) format < https://amzn.to/3eOYeNu> .

A typical implementation of Gold code generator is shown in Figure 1. Here, the two
linear feedback shift registers (LFSR), each of length , are configured to generate two
different m-sequences. As we cannot start the LFSRs with all zero values, there need to be
some values in the LFSRs. These initial values are controlled by ‘seed 1‘ and ‘seed 2‘. The
phase of the m-sequence loaded into an LFSR can be controlled by shifting the initial seed
(initial value of the shift registers in the LFSR) there by providing an option to generate a
new Gold sequence.

< https://www.gaussianwaves.com/buy-books/>

Figure 1: Generation of Gold Code using LFSR

Note that there exists numerous choice of Gold sequences based on the m-sequence
configuration
This site uses of the LFSRs
cookies andLearn
responsibly. whatmore
is initially loaded
in our privacy into<the two LFSRs. Not all the
policy
https://www.gaussianwaves.com/privacy-policy>
Gold sequences possess good correlation properties. . In order to have a Gold code sequence
with three valued peak cross-correlation magnitudes, that is both bounded and uniform,
Cookie settings ACCEPT
the m-sequences generated by the two LFSRs need to be of preferred type.
Algebraic details on generating two preferred m-sequence for Gold code generation is
detailed in Gold’s work [1]. It warrants the need for searching the preferred pairs, instead,
the configurations given in Table 1 can be used for generating Gold codes that provide
optimal correlation properties (three valued correlation as mentioned in Reference [2]).
Following points must be noted when choosing the length of LFSR ( ) when generating
the Gold code.

● Three valued cross-correlation values occur when is odd or when .


● The peak cross-correlation magnitude achieves the minimum possible value only when
is odd ( ). Therefore, this is the best choice here.
● When , the m-sequences listed in table are still of preferred type (three
valued cross-correlation), but the lower bound is weaker when compared to the lower
bound when is odd.

< https://www.gaussianwaves.com/buy-books/>

Table 1: Preferred pairs of m-sequences

Hardware implementation
A sample hardware implementation for generating a length 127 Gold code – using the
preferred pairs ([7,3,2,1],[7,3]) is shown in Figure 2. Here each register in the LFSR is a
D-flip flop,all connected in cascaded fashion and operating at a given synchronous clock.
Changing the initial seed values into shift registers produces a different set of Gold codes.
Matlab code for implementing a Gold code generator is available in this book. <
This site uses cookies responsibly. Learn more in our privacy policy <
https://www.gaussianwaves.com/wireless-communication-systems-in-matlab/>
https://www.gaussianwaves.com/privacy-policy> .

Cookie settings ACCEPT


< https://www.gaussianwaves.com/buy-books/>

Figure 2: Length 127 – Gold sequence generator with odd n for the preferred pairs –
[7,3,2,1], [7,3]

Correlation properties
Figure 3 on this post < https://www.gaussianwaves.com/2018/09/maximum-length-
sequences-m-sequences/> shows the periodic cross-correlation of two m-sequences that
are not a preferred pair. Let’s take a preferred pair from the Table 1 for N = 31 having the
feedback connections – [2,3,4,5] and [2,5]. The correlation of two sequences can be
computed using the function given in section 12.2.1 of this book <
https://www.gaussianwaves.com/wireless-communication-systems-in-matlab/> .

< https://www.gaussianwaves.com/buy-books/>

Figure 3: Normalized cross-correlation of preferred pair m-sequences using the feedback


connections [2,3,4,5] and [2,5]
This site uses cookies responsibly. Learn more in our privacy policy <
https://www.gaussianwaves.com/privacy-policy> .

Cookie settings ACCEPT


< https://www.gaussianwaves.com/buy-books/>

Figure 4: Autocorrelation of Gold code sequence generated using the preferred pair feedback
connections [2,3,4,5] and [2,5]

The normalized cross-correlation of the chosen preferred pair and the auto-correlation of
the corresponding Gold code is shown in Figure 3 and Figure 4 respectively. The auto-
correlation and cross-correlation plots reveal that the Gold code sequence does not
possess the excellent auto-correlation property as that of individual m-sequences, but it
possess good cross-correlation properties in comparison with the individual m-sequences.

Rate this article: (1 votes, average: 5.00 out of 5)

References:
[1] Gold, R. (1967), Optimal binary sequences for spread spectrum multiplexing,
IEEE Transactions on Information Theory, 13 (4), pp. 619-621. <
https://ieeexplore.ieee.org/document/1054048>

[2] Sarwate D.V, Pursley, M.B., “Crosscorrelation Properties of Pseudorandom and


Related Sequences”, Proceedings of the IEEE, Volume 68, Issue 5, pp 593 – 619, May
1980. < https://ieeexplore.ieee.org/document/1455966>

Books by the author

This site uses cookies responsibly. Learn more in our privacy policy <
https://www.gaussianwaves.com/privacy-policy> .

Cookie settings ACCEPT


< < <
https://www.gaussianwaves.co https://www.gaussianwaves.co https://www.gaussianwave
m/wireless-communication- m/digital-modulations-using- m/digital-modulations-usin
systems-in-matlab/> python/> matlab-build-simulation-
Wireless Communication Digital Modulations using models-from-scratch/>
Systems in Matlab Python Digital Modulations using
Second Edition(PDF) < (PDF ebook) < Matlab
https://www.gaussianwaves.co https://www.gaussianwaves.co (PDF ebook) <
m/wireless-communication- m/digital-modulations-using- https://www.gaussianwave
systems-in-matlab/> python/> m/digital-modulations-usin
Note: There is a rating Note: There is a rating matlab-build-simulation-
embedded within this post, embedded within this post, models-from-scratch/>
please visit this post to rate it. please visit this post to rate it. Note: There is a rating embe
within this post, please visit
$14.99 – ADD TO CART $14.99 – ADD TO CART post to rate it.

$14.99 – ADD TO CAR

Hand-picked Best books on Communication Engineering < https://www.gaussianwaves.com/b


communication-engineering-books/>
Best books on Signal Processing < https://www.gaussianwaves.com/best-signal-processing-boo

Topics in this chapter


This site uses cookies responsibly. Learn more in our privacy policy <
https://www.gaussianwaves.com/privacy-policy> .

Cookie settings ACCEPT


Spread spectrum techniques < https://www.gaussianwaves.com/buy-books/>
● Introduction < https://www.gaussianwaves.com/2010/09/spread-spectrum-
communications-intro/>
● Code sequences < https://www.gaussianwaves.com/2010/09/spread-spectrum-
communications-intro/>
□ Sequence correlations < https://www.gaussianwaves.com/2010/09/spread-spectrum-
communications-intro/>
□ Maximum-length sequences (m-sequences) <
https://www.gaussianwaves.com/2018/09/maximum-length-sequences-m-sequences/>
□ Gold codes < https://www.gaussianwaves.com/2015/06/gold-code-generator/>
● Direct Sequence Spread Spectrum
□ Simulation of DSSS system
□ Performance of Direct Sequence Spread Spectrum over AWGN channel
□ Performance of Direct Sequence Spread spectrum in the presence of Jammer
● Frequency Hopping Spread Spectrum
□ Simulation model
□ Binary Frequency Shift Keying (BFSK)
□ Allocation of frequency channels
□ Frequency hopping generator
□ Fast and slow frequency hopping
□ Simulation code for BFSK-FHSS

By Mathuranathan
Mathuranathan Viswanathan < https://www.linkedin.com/in/mathuranathan/> ,
is an author @ gaussianwaves.com that has garnered worldwide readership. He is a
masters in communication engineering and has 12 years of technical expertise in
channel modeling and has worked in various technologies ranging from read channel,
OFDM, MIMO, 3GPP PHY layer, Data Science & Machine learning.

View Archive → < https://www.gaussianwaves.com/author/mathuranathan/>

← Construct autocorrelation Matrix < https://www.gaussianwaves.com/2015/05/auto-


in Matlab & Python correlation-matrix-in-matlab/>
This site uses cookies responsibly. Learn more in our privacy policy <
→ Simulate additive white < https://www.gaussianwaves.com/2015/06/how-to-
https://www.gaussianwaves.com/privacy-policy> .
Gaussian noise (AWGN) generate-awgn-noise-in-matlaboctave-without-using-in-
Cookie settings
channel ACCEPT
built-awgn-function/>
© 2021 GaussianWaves < https://www.gaussianwaves.com/> Up ↑

This site uses cookies responsibly. Learn more in our privacy policy <
https://www.gaussianwaves.com/privacy-policy> .

Cookie settings ACCEPT

You might also like