# Practical use of Gold Codes

Started by September 25, 2007
```Hi all,

I'm planning to use Gold Codes in a DSSS Modem. The question is:

The input data is complex but a gold code is not complex. When
spreading the complex data, do you simply set the imag part of the
gold code to 0 and do a complex multiplication with the complex input
data and again the same when despreading the data?

Thanks for any suggestions,
Jaco

```
```Jaco Naude wrote:
> Hi all,
>
> I'm planning to use Gold Codes in a DSSS Modem. The question is:
>
> The input data is complex but a gold code is not complex. When
> spreading the complex data, do you simply set the imag part of the
> gold code to 0 and do a complex multiplication with the complex input
> data and again the same when despreading the data?
>
> Thanks for any suggestions,
> Jaco
>

In general a complex spreading code is built from two different PN
sequences.

John
```
```One example is in TS25.713-720:
"All uplink physical channels shall be scrambled with a complex-valued
scrambling code"
See page 21, "Finally, the complex-valued long scrambling sequence Clong,
n, is defined as:"
Of course, who says it's WCDMA...

Suggestion? Read the small print :)

-mn
```
```
Jaco Naude wrote:

> Hi all,
>
> I'm planning to use Gold Codes in a DSSS Modem.

Why Gold codes? What are you trying to accomplish by that?

> The question is:
>
> The input data is complex but a gold code is not complex. When
> spreading the complex data, do you simply set the imag part of the
> gold code to 0 and do a complex multiplication with the complex input
> data and again the same when despreading the data?

So you don't know how to multiply a complex number by a real number or what?

DSP and Mixed Signal Design Consultant
http://www.abvolt.com
```
```Vladimir Vassilevsky wrote:
>
>
> Jaco Naude wrote:
>
>> Hi all,
>>
>> I'm planning to use Gold Codes in a DSSS Modem.
>
> Why Gold codes? What are you trying to accomplish by that?
>
>> The question is:
>>
>> The input data is complex but a gold code is not complex. When
>> spreading the complex data, do you simply set the imag part of the
>> gold code to 0 and do a complex multiplication with the complex input
>> data and again the same when despreading the data?

Yes, but there's a shortcut.

> So you don't know how to multiply a complex number by a real number or
> what?

It sure looks that way. Some people get so overwhelmed by new stuff that
they forget the old.

The centipede was happy; quite! until the toad, in fun,
Said "Pray, which leg comes after which?"
Which threw his soul in such a pitch
He lay distracted in a ditch, considering how to run.

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```>> Why Gold codes? What are you trying to accomplish by that?

I am trying to create a simple DSSS Modem, similar to the that
described in http://www.altera.com/literature/fs/fs14_dsss.pdf
The type of spreading sequence does not matter. Gold codes are the
easiest to implement on a Xilinx FPGA using the SLR16 macro.

>> So you don't know how to multiply a complex number by a real number or what?

I know that the complex spreading sequence has c_r and c_i codewords.
c_r is a gold code obviously, but is c_i = 0 or is it another gold
code? That was the question really. I know how to multiply a real
number with a complex number.

John thanks for the answer. However Jerry said yes to my initial
thoughts that c_i = 0. Thanks for that as well. Maybe it is dependent
on the application? However it does not look like this is the place to
find that out.

Thanks for the replies.
Jaco

```
```There was a typo in my 3G specs reference.
It's here (link below) and shows how to implement the short and long codes
for WCDMA.
-mn

http://www.3gpp.org/ftp/Specs/html-info/25213.htm

```
```Jaco Naude wrote:

>   ... Jerry said yes to my initial
> thoughts that c_i = 0. Thanks for that as well. Maybe it is dependent
> on the application? However it does not look like this is the place to
> find that out.

I wasn't addressing Gold codes or the question you intended, but only

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```On Sep 25, 2:31 pm, Jaco Naude <naude.j...@gmail.com> wrote:
> >> Why Gold codes? What are you trying to accomplish by that?
>
> I am trying to create a simple DSSS Modem, similar to the that
> described inhttp://www.altera.com/literature/fs/fs14_dsss.pdf
> The type of spreading sequence does not matter. Gold codes are the
> easiest to implement on a Xilinx FPGA using the SLR16 macro.
>
> >> So you don't know how to multiply a complex number by a real number or what?
>
> I know that the complex spreading sequence has c_r and c_i codewords.
> c_r is a gold code obviously, but is c_i = 0 or is it another gold
> code? That was the question really. I know how to multiply a real
> number with a complex number.
>
> John thanks for the answer. However Jerry said yes to my initial
> thoughts that c_i = 0. Thanks for that as well. Maybe it is dependent
> on the application? However it does not look like this is the place to
> find that out.
>
> Thanks for the replies.
> Jaco

Even if the imaginary spreading code is zero at the transmitter, which
as I said before is not the typical case, you will not want to
complex received signal is in general scaled and rotated by the
code used in transmit. The resulting peaks will look like Aexp(j*phi)
and -Aexp(j*phi) where phi is the phase shift seen in the channel and
A is related to channel gain and transmit power.

John

```
```On Sep 25, 2:31 pm, Jaco Naude <naude.j...@gmail.com> wrote:
> >> Why Gold codes? What are you trying to accomplish by that?
>
> I am trying to create a simple DSSS Modem, similar to the that
> described inhttp://www.altera.com/literature/fs/fs14_dsss.pdf
> The type of spreading sequence does not matter. Gold codes are the
> easiest to implement on a Xilinx FPGA using the SLR16 macro.
>
> >> So you don't know how to multiply a complex number by a real number or what?
>
> I know that the complex spreading sequence has c_r and c_i codewords.
> c_r is a gold code obviously, but is c_i = 0 or is it another gold
> code? That was the question really. I know how to multiply a real
> number with a complex number.
>
> John thanks for the answer. However Jerry said yes to my initial
> thoughts that c_i = 0. Thanks for that as well. Maybe it is dependent
> on the application? However it does not look like this is the place to
> find that out.
>
> Thanks for the replies.
> Jaco

Even if the imaginary spreading code is zero at the transmitter, which
as I said before is not the typical case, you will not want to