spreading codes in cdma

Embed Size (px)

Citation preview

  • 7/29/2019 spreading codes in cdma

    1/10

    D-1

    APPENDIX D

    Spreading Codes Used in CDMA

    In this appendix, we discuss Walsh codes, PN sequences, and Gold codes [19].

    D.1 Walsh Codes

    Walsh codes are used in direct sequence spread spectrum (DSSS) systems (such asIS-95, cdma2000, etc.). They are also used in frequency hopping spread spectrum(FHSS) systems to select the target frequency for the next hop (see Chapter 11).

    Walsh codes are orthogonal codes. As such, if two Walsh codes are correlated,the result is intelligible only if these two codes are the same. As a result, a Walsh-encoded signal appears as random noise to a CDMA-capable mobile terminal,unless that terminal uses the same code as the one used to encode the incomingsignal. We denote W(k, n) as Walsh code k in the n-length Walsh matrix, wherek 0, 1, , n 1.

    The CDMA system requires orthogonal codes for channel selection. SinceCDMA systems use the same frequency bands for all transmissions, only a differ-ent code can be used to select a channel.

    Orthogonal codes have the following characteristics:

    k 0

    N 1

    Wi(k)Wj(kn) 0, ij, n 0, 1, , N 1 (D.1)

    Equation D.1 implies that the cross-correlation of two different symbol shapes iszero for all time offsets, and

    k 0

    N

    1

    Wi(k)Wj(kn) 0, n 1, , N 1 (D.2)

    where:Wi(k) and Wj(k) the ith and jth orthogonal members of an orthogonal

    setN the length of set the symbol duration

    APP_D-P373580.indd 1APP_D-P373580.indd 1 5/4/07 1:23:52 AM5/4/07 1:23:52 AM

  • 7/29/2019 spreading codes in cdma

    2/10

    Equation D.2 implies that for all time offsets other than zero, each spreadingcode is orthogonal to itself. The orthogonality conditions in Equations D.1 andD.2 mean that different user signals can be separated at the receiver, even thoughthey use the same frequency channel and the same period.

    Walsh codes are generated using the Hadamard matrix with H1 [0], whereH1 is a 1 1 matrix and is an order 1. The Hadamard matrix is built by

    H2nHnHnHnHn (D.3)

    For example, the Hadamard matrix of order 2 and 4 will be:

    H20001 and

    H4

    0000

    0

    101

    0

    011

    0

    110

    From the corresponding Hadamard matrix, the Walsh codes are given by therows. We usually map the binary data to polar form so we can use real num-ber arithmetic when computing correlations. So 0s are mapped to 1s and 1s aremapped to 1s.

    This means the kth row of the H(n) Hadamard matrix is (see below for

    examples):

    H(0) 1

    W(0, 0) 1

    H(2) 11 11W(0, 2) 1, 1

    W(1, 2) 1, 1

    H41111

    11

    11

    11

    11

    11

    11

    W(0, 4) 1, 1, 1, 1

    W(1, 4) 1, 1, 1, 1

    W(2, 4) 1, 1, 1, 1

    W(3, 4) 1, 1, 1, 1

    D-2 Appendix D Spreading Codes Used in CDMA

    APP_D-P373580.indd 2APP_D-P373580.indd 2 5/4/07 1:23:53 AM5/4/07 1:23:53 AM

  • 7/29/2019 spreading codes in cdma

    3/10

    The basic set of Walsh codes is the set of four patterns 0000, 0101, 0011,0110. When the Walsh codes modulate the transmitter, bi-phase shift keying is used.Thus, 0 represents 0 phase shift and 1 represents 180 phase shift. The 64 orthogo-nal Walsh codes provide the basis for the CDMA modulation used in IS-95.

    Walsh codes form the basis for variable spreading codes with differentspreading factors. This property becomes useful when we want signals with differ-ent spreading factors to share the same frequency channel (such as in 3G systems).The codes that possess this property are called orthogonal variable spreading fac-tors (OVSF). To construct such codes, it is better to use a different approachthan matrix manipulation. Using a tree structure allows better visualization of therelation between different code lengths and the orthogonality between them (seeFigure D.1).

    For example, lets examine the codeword denoted W(1, 2) and the codeword

    denoted W(2, 4) to see if they are orthogonal. Since they are of different lengths,we repeat W(1, 2) to match the length ofW(2, 4). Hence, we get the followingtwo code words in polar form:

    W(1, 2)1 1 1 1W(2, 4)1 1 1 1

    Computing the orthogonality, we get

    (1 1) (1 1) (1 1) (1 1) 1 1 1 1 0

    Hence, W(1, 2) and W(2, 4) are orthogonal.The autocorrelation function of Walsh codes does not have good characteristics.

    It can have more than one peak, and therefore it is not possible for a receiver to detectthe beginning of the code word without an external synchronization scheme. Thecross-correlation can also be non-zero for a number of time shifts and unsynchro-

    nized users can interfere with each other. This is why Walsh codes can only be used in

    Appendix D Spreading Codes Used in CDMA D-3

    W(0, 0)

    W(0, 2)

    W(0, 4)

    W(0, 8)

    W(2, 4)

    W(1, 4)

    W(1, 2) W(3, 4)

    Figure D.1 OVSF tree.

    APP_D-P373580.indd 3APP_D-P373580.indd 3 5/4/07 1:23:54 AM5/4/07 1:23:54 AM

  • 7/29/2019 spreading codes in cdma

    4/10

    synchronous CDMA systems. Walsh codes do not have the best spreading behavior.They do not spread data as well as pseudo-noise (PN) sequences do because theirpower spectral density is concentrated in small numbers of discrete frequencies.

    D.2 PN Sequences

    As mentioned in Section D.1, the Walsh codes provide good orthogonality propertieswhen they are aligned in time. Their orthogonality may suffer when they are not alignedin time. Ideally, we would like to have sequences that are orthogonal for all time shifts.However, in practice the sequences that are approximately orthogonal are achievable.One class of sequences that satisfies this condition is the class of PN sequences.

    Various pseudorandom codes are generated using linear feedback shiftregister (LFSR). The generator polynomial governs all the characteristics of thegenerator. The feedback generator uses only the output bit to add several stagesof shift register. This is desirable for high speed hardware implementation aswell as software implementation. Shift-register sequences having the maximum

    possible period for an n-shift register are called maximal length sequences orm-sequences. A primitive generator polynomial always yields an m-sequence. Themaximum period of an n-stage shift register is T 2n 1. The m-sequenceshave three important properties (balance property, run-length property, and shift-and-add property), which are formulated as follows: TkuTiuTju, where u isan m-sequence. By combining two shifts of this sequence (relative shift i andj) weobtain the same m-sequence, yet with another relative shift.

    The periodic autocorrelation function Ra(k) is two-valued and is given by:

    Ra(k) 11T

    k ITk ITwhere:

    I an integerT period ofm-sequence

    The cross-correlation ofm-sequences is not as well behaved as autocorrelation.An m-sequence generating system with four shift registers is shown in

    Figure D.2. This can be expressed using the recursive relation:

    X1 X2 X3 X4

    Figure D.2 4-Stage shift register for generating m-sequences.

    D-4 Appendix D Spreading Codes Used in CDMA

    APP_D-P373580.indd 4APP_D-P373580.indd 4 5/4/07 1:23:55 AM5/4/07 1:23:55 AM

  • 7/29/2019 spreading codes in cdma

    5/10

    X1(i 1) X3(i) X4(i) (D.4)

    where i 0, 1, 2,

    Because m-sequences are periodic and shift registers cycle through everybinary value (with the exception of a zero vector), registers can be initialized toany state, with the exception of the zero vector.

    m-sequences are inexpensive to implement in hardware or software, and rel-atively low-order feedback shift registers can generate long sequences. A sequencegenerated using 20 shift registers is 220 1 samples long.

    The number ofm-sequences that can be generated by an n linear shift-registergenerator is given as:

    Np(n) 2n 1n i 1k Pi 1Pi (D.5)

    where:Np(n) number of PN sequences

    n number of shift registers in a generatorPi prime decomposition of 2

    n1

    In Table D.1, feedback connections (even numbers) are given for m-sequencesgenerated with a linear shift register generator (without image set).

    For every set [n, k, ,p] feedback taps listed in Table D.1, there exists animage set (reverse set) of feedback taps [n, n k, , n p] that generates anidentical sequence reversed in time.

    Appendix D Spreading Codes Used in CDMA D-5

    Table D.1 Feedback connections for m-sequences.

    n T 2n 1 Feedback taps for m-sequences No. of m-

    sequences

    2 3 [2, 1] 1

    3 7 [3, 1] 24 15 [4, 1] 2

    5 31 [5, 3]; [5, 4, 3, 2]; [5, 4, 2, 1] 6

    6 63 [6, 1]; [6, 5, 2, 1]; [6, 5, 3, 2] 4

    7 127 [7, 6, 4, 2]; [7, 6, 3, 1]; [7, 6, 5, 2];

    [7, 6, 5, 4, 2, 1]; [7, 5, 4, 3, 2, 1]

    18

    8 255 [8, 4, 3, 2]; [8, 6, 5, 3]; [8, 6, 5, 2];

    [8, 5, 3, 1]; [8, 6, 5, 1]; [8, 7, 6, 1];

    [8, 7, 6, 5, 2, 1]; [8, 6, 4, 3, 2, 1]

    16

    APP_D-P373580.indd 5APP_D-P373580.indd 5 5/4/07 1:23:55 AM5/4/07 1:23:55 AM

  • 7/29/2019 spreading codes in cdma

    6/10

    Example D.1

    Using the shift register shown in Figure D.3, generate an m-sequence (Table D.2)and demonstrate its properties. Sketch the autocorrelation function.The generated m-sequence has been plotted in Figure D.4.

    D-6 Appendix D Spreading Codes Used in CDMA

    X1 X2 X3

    Figure D.3 3-stage shift register for generating first m-sequence.

    1

    1

    T T T

    Time

    TC

    Figure D.4 7-chip first m-sequence.

    Table D.2 First m-sequence using 3-stage shift register.

    X1 X2 X3 Output

    Initial Stage 0 0 1 1

    Shift 1 1 0 0 0

    Shift 2 0 1 0 0

    Shift 3 1 0 1 1

    Shift 4 1 1 0 0

    Shift 5 1 1 1 1

    Shift 6 0 1 1 1

    Shift 7 0 0 1 1

    APP_D-P373580.indd 6APP_D-P373580.indd 6 5/4/07 1:23:56 AM5/4/07 1:23:56 AM

  • 7/29/2019 spreading codes in cdma

    7/10

    Appendix D Spreading Codes Used in CDMA D-7

    Table D.3 Second m-sequence using 3-stage shift register.

    X1

    X2

    X3 Output

    Initial State 0 0 1 1

    Shift 1 1 0 0 0

    Shift 2 1 1 0 0

    Shift 3 1 1 1 1

    Shift 4 0 1 1 1

    Shift 5 1 0 1 1

    Shift 6 0 1 0 0

    Shift 7 0 0 1 1

    The properties ofm-sequence in Figure D.4 are:

    Number of1s 4; number of 1s 3

    Run length 1 2

    Run length 2 1

    Run length 3 1

    Example D.2

    Since two m-sequences can be generated by the 3-stage shift register (see Table D.3),what is the location of the modulo-2 adder for the second m-sequence? Generatethe second m-sequence.

    Solution

    The location of modulo-2 adder for the second m-sequence is shown inFigure D.5.

    Properties ofm-sequence in Figure D.6 are:

    Number of1s 4; number of 1s 3Run length 1 2

    Run length 2 1

    Run length 3 1

    The autocorrelation for this m-sequence will be as shown in Figure D.7.

    X1 X2 X3

    Figure D.5 3-stage shift register for generating second m-sequence.

    APP_D-P373580.indd 7APP_D-P373580.indd 7 5/4/07 1:23:57 AM5/4/07 1:23:57 AM

  • 7/29/2019 spreading codes in cdma

    8/10

    1

    1

    T T T

    Time

    Figure D.6 7-chip second m-sequence.

    m-sequence 1

    (t= 0)

    m-sequence 2

    (t= kT)

    Gold sequence (k)

    Figure D.8 Generation of Gold sequence.

    D.3 Gold CodesThe family of PN sequences, called Gold sequences, are particularly popular fornonorthogonal CDMA systems. Gold sequences have only three cross-correlationpeaks, which tends to get less important as the length of the code increases.

    Gold codes are constructed from a modulo-2 addition of two maximum lengthsequences. The code sequences are added chip by chip by synchronous clocking.Because the m-sequences are of the same length, the two code generators maintainthe same phase relationship, and the codes generated (see Figure D.8) are of the

    same length as the two base codes, which are added together, but nonmaximal

    D-8 Appendix D Spreading Codes Used in CDMA

    1

    1/7

    0

    Figure D.7 Autocorrelation for m-sequence.

    APP_D-P373580.indd 8APP_D-P373580.indd 8 5/4/07 1:23:58 AM5/4/07 1:23:58 AM

  • 7/29/2019 spreading codes in cdma

    9/10

    (so the autocorrelation function will be worse than that of m-sequences). Everychange in phase position between two generated m-sequences causes a new sequenceto be generated.

    In addition to their advantage in generating large numbers of codes, theGold codes may be selected so that over a set of codes available from a givengenerator the autocorrelation and cross-correlation between the codes is uniformand bounded. When specially selected m-sequences, calledpreferredm-sequences,are used, the generated Gold codes have a three-valued cross-correlation.

    Preferred m-sequences are pairs ofm-sequences with specific three-valuedcross-correlation (see Table D.4). Preferred pairs for shift-register with a lengthequal to 4 I, where I is an integer, do not exist.

    Gold codes will permit multiple access on the channel. With two m-sequencesalone, we can generate 2n 1 Gold codes (a combination with 2n1 differentshift positions and 2 sequences).

    The use of Gold codes permits the transmission to be asynchronous. Thereceiver can synchronize using the autocorrelation property of the Gold code. Thefollowing are the properties of Gold codes:

    Period T equal to m-sequenceThree-valued cross-correlation function with values are {1, t(n),t(n) 2},

    where:

    t(n) 2(n1)/2 12(n2)/2 1 for odd nfor even nReferences

    1. Dinan, E., and Jabbari, B. Spreading codes for direct sequence CDMA and wideband CDMAcellular networks. IEEE Communications Magazine, October 1996, pp. 124136.

    2. Dixon, R. C. Spread Spectrum Systems with Commercial Applications. John Wiley &Sons, Inc., 1994.

    3. Gold, R. Optimal binary sequences for spread spectrum multiplexing. IEEE Transactionson Information Theory, October 1967, pp. 619621.

    4. Holmes, J. K. Coherent Spread Spectrum Systems. John Wiley & Sons, 1982.

    5. Proakis, J. G. Communication Systems Engineering. Prentice-Hall, 1994.

    Appendix D Spreading Codes Used in CDMA D-9

    Table D.4 Preferred m-sequences normalized cross-correlations.

    n Period (T) Normalized 3-valuecross-correlationsOdd 2n 1 1/T, [2(n1)/2 1]/T, [2(n1)/2 1]/T

    Even 2n 1 1/T, [2(n2)/2 1]/T, [2(n2)/2 1]/T

    APP_D-P373580.indd 9APP_D-P373580.indd 9 5/4/07 1:23:59 AM5/4/07 1:23:59 AM

  • 7/29/2019 spreading codes in cdma

    10/10

    6. Simon, M. K. Spread Spectrum Communications Handbook. McGraw-Hill. Inc., 1994.

    7. Sklar, B. Digital Communications. Prentice-Hall, 1988.

    8. Tachikawa, S.-T. Recent spreading codes for spread spectrum communication systems.Electronic and Communications in Japan, Part I, vol. 75, no. 6, 1992, pp. 4149.

    9. Viterbi, A. CDMA Principles of Spread Spectrum Communication. Reading, MA: Addison-Wesley, 1995.

    D-10 Appendix D Spreading Codes Used in CDMA

    APP_D-P373580.indd 10APP_D-P373580.indd 10 5/4/07 1:23:59 AM5/4/07 1:23:59 AM