Abstract:
A method and apparatus for determining the state, at any time in the past, relative to a present state, of a linear feedback shift register comprises determining a an inverse transition matrix which, if multiplied by the current state in modulo-2 arithmetic, yields the state one step into the past; and multiplying in modulo-2 arithmetic the present state of the linear feedback shift register by the inverse transition matrix N times to obtain the state N steps into the past.

Description:
FIELD OF THE INVENTION 
     This invention relates to linear feedback shift registers (LFSR&#39;s), and more particularly to methods and apparatus for rapidly determining the state of an LFSR at any point in the past relative to a current state, and to synchronizing the LFSR&#39;s in base and mobile stations in a CDMA communication system. 
     BACKGROUND OF THE INVENTION 
     LFSR&#39;s are used in many applications for generating pseudorandom numbers, which in turn may be used for such purposes as encryption, or synchronization of data transmissions. 
     A well known such use is in the CDMA (Code Division Multiple Access) scheme employed in the IS-95 standard for cellular telephone transmission. Both the base station and the mobile stations employ a 42-bit LFSR to generate a periodic code with period 2 42  -1 bits (known to those in the cellular telephone art as &#34;the Long Code&#34;). For a base station to communicate with a mobile station, their Long Codes must be synchronized. Due to range uncertainty (which affects transmission time) and randomized delays introduced to avoid multiple user traffic collisions, at a given time a mobile station&#39;s Long Code and a base station&#39;s Long Code may be different, and thus require synchronization in order to communicate. (Typically, the base station&#39;s code is ahead of the mobile station&#39;s code.) 
     Synchronization requires a &#34;searcher&#34; in the base station to determine the number of shifts (bit offsets) by which the base station&#39;s LFSR leads the mobile station&#39;s LFSR. The two LFSRs must then be syunchronized. The base station&#39;s LFSR cannot simply be backward-shifted to accomplish this, because the feedback mechanisms are not susceptible of reversal. 
     One conventional method for accomplishing synchronization in the case where the mobile station&#39;s LFSR is ahead of the base station&#39;s is to run the base station&#39;s LFSR forward at a clock rate many times (typically, 48 times) higher than normal until it has advanced to the desired state. 
     In the case where the base station&#39;s LFSR leads the mobile station&#39;s LFSR, the base station&#39;s LFSR is simply stopped until the mobile LFSR &#34;catches up&#34; to it. These conventional methods have the disadvantage of requiring extra hardware for the high-speed forward shift, and the disadvantage of wasting time while the LFSR is stopped. 
     Another conventional method is to store the base station LFSR output over a sufficient number of bits (typically, 1400) to enable matching with the mobile station&#39;s current bit pattern. The obvious drawback is that 1400 flip-flops are required, with their resultant increase in cost and power consumption. 
     Yet another conventional method is to use a mirror-image LFSR in addition to the main LFSR with feedback mechanisms such that it shifts backward through the reverse of the sequence through which the main LFSR shifts forward. This has the obvious drawback of necessitating a great deal of additional circuitry. 
     While most conventional solutions are hardware-based, some recent algorithms have been posited for determining future states of LFSR&#39;s by mathematical methods susceptible of implementation in software or firmware. See the work of Arthur H. M. Ross, Ph.D., at Internet web page http://www.cdj.org/a --  ross/LFSR.html (date unknown), or the work of M. Serra at http:/www.csr.uvic.ca/home/mserra/CApaper/node4.html (Jun. 24, 1996). These algorithms, however, are not able to determine past states of LFSRs. 
     Accordingly, there exists a need for a method of determining a past state of a LFSR that does not require significant additional hardware and that does not cause the waste of significant amounts of time. 
     It is thus an object of the present invention to provide a method of resetting a LFSR that eliminates the drawbacks of conventional CDMA systems. 
     It is a further object of the present invention to provide a method for resetting a LFSR that has fixed overhead for shifting backward or forward independent of shift length. 
     It is a further object of the present invention to provide a practical method of performing very large shifts, which are impractical in conventional systems. 
     It is a further object of the present invention to provide a method of resetting a LFSR that may be easily embedded in firmware in an application-specific integrated circuit (ASIC) and ideally in parallel operation where multiple shift positions are needed, as in multi-user detection. 
     These and other objects of the invention will become apparent to those skilled in the art from the following description thereof. 
     SUMMARY OF THE INVENTION 
     In accordance with the teachings of the present invention, these and other objects may be accomplished by the present systems and methods of generating spreading codes which are resistant to the effects of time delays in CDMA systems. An embodiment of the present invention includes a method of determining an inverse transition matrix which when used to multiply in modulo-2 arithmetic the current state of an LFSR yields the previous state of the LFSR, and multiplying the state of the LFSR by the inverse transition matrix in modulo-2 arithmetic once for each desired backward shift of the LFSR, and loading the state thus determined back into the LFSR. Another embodiment of the invention uses apparatus to determine the inverse transition matrix, to multiply the LFSR contents by the inverse transition matrix one for each backward shift required, and to load the result back into the LFSR. 
     The invention will next be described in connection with certain exemplary embodiments; however, it should be clear to those skilled in the art that various modifications, additions and subtractions can be made without departing from the spirit or scope of the claims. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The invention will be more clearly understood by reference to the following detailed description of an exemplary embodiment in conjunction with the accompanying drawings, in which: 
     FIG. 1 depicts a generic 5-bit LFSR. 
     FIG. 2 depicts a Type I LFSR of arbitrary length. 
     FIG. 3 depicts a Type II LFSR of arbitrary length. 
     FIG. 4 illustrates the transition matrix for the LFSR of FIG. 2. 
     FIG. 5 illustrates the transition matrix for the LFSR of FIG. 3. 
     FIG. 6 illustrates the inverse transition matrix for the LFSR of FIG. 2. 
     FIG. 7 illustrates the inverse transition matrix for the LFSR of FIG. 3. 
     FIG. 8 illustrates the transition matrix for a 42-bit CDMA LFSR. 
     FIG. 9 illustrates the inverse transition matrix for a 42-bit CDMA LFSR. 
     FIG. 10 depicts a basic operation of modulo-2 matrix multiplication. 
    
    
     DESCRIPTION OF THE INVENTION 
     A preferred embodiment of the present invention is associated with the 42-bit LFSR employed for producing the Long Code used for synchronizing data transmission between a base station and a mobile station in an IS-95 CDMA cellular communications system. 
     To service a mobile user, the base station&#39;s LFSR must be set to the same value as the mobile user&#39;s. A searcher algorithm in the base station determines the amount of time difference between the two LFSR&#39;s. Time alignment of the base station Long Code generator LFSR includes resetting the binary value stored in the shift register to a value of a previous or future time, according to the searcher results. 
     An example of an embodiment of the present invention will now be considered using a five-bit LFSR, an example of which is shown in FIG. 1. Those in the art will recognize this as a Type I, or Galois, LFSR since the exclusive OR is located in a series path (as opposed to a Type II, or Fibonacci, LFSR which would have the exclusive OR in the feedback paths). Although the ensuing discussion applies to the Type I LFSR, the principles apply equally to the Type II LFSR. 
     The state transition equations for the LFSR of FIG. 1 are 
     z 1  &#39;=z 5   
     z 2  &#39;=z 1   
     z 3  &#39;=(z 2  XOR z 5 ) 
     z 4  &#39;=z 3   
     z 5  &#39;=z 4   
     where z i  is the present state of cell i and z i  &#39; is the state after clocking the shift register one time. In matrix form, this can be expressed as: 
     
         [z.sub.1 &#39;, z.sub.2 &#39;, z.sub.3 &#39;, z.sub.4 &#39;, z.sub.5 &#39;].sup.T =A X [z.sub.1, z.sub.2, z.sub.3, z.sub.4, z.sub.5 ].sup.T 
    
     where all operations are carried out in modulo 2 arithmetic, T indicates transpose and A is the transition matrix: ##EQU1## Because of the modulo-2 arithmetic that must be employed, the inverse transition matrix can not be determined from the transition matrix by the conventional means used in decimal arithmetic for determining an inverse matrix. This becomes evident by taking a conventional inverse transition matrix, multiplying it by the transition matrix, and finding that the result is not the identity matrix. 
     The inverse transition matrix can be determined empirically by determining what is necessary to transit the LFSR back by one shift. For the LFSR of FIG. 1, the inverse transition matrix is: ##EQU2## Obtaining the next state of the LFSR using the transition matrix could be written as: ##EQU3## Similarly, obtaining the previous state (one clock pulse ago) can now be written as: ##EQU4## Block jumps (jumps of more than one clock pulse) may easily be obtained by raising the transition matrix to a power equal to the desired number of clock pulses prior to performing the multiplication. That is: ##EQU5## yields the state of the LFSR N clock pulses in the future, while ##EQU6## yields the state of the LFSR N clock pulses in the past. 
     It will now be shown how to find the inverse transition matrix for a Type I or Type II LFSR of arbitrary length &gt;2. 
     A Type I (Galois) LFSR of arbitrary length is shown in FIG. 2. A Type II (Fibonacci) LFSR of arbitrary length is shown in FIG. 3. Generally, the number of taps and tap positions are not the same for Galois and Fibonacci versions. The original state of each of the LFSR is the binary sequence {S k  } k  for k=1, . . . , N. The set of state transition equation for Type 1 (Galois) LFSR is in general, as follows: ##EQU7## where k, . . . , m are positive integers less than N, corresponding to tap positions in the Type 1 Galois LFSR. Note that &#34;+&#34; is the Exclusive--OR or modulo two operation The transition matrix representing these state transition equations is given in FIG. 4. 
     The set of state transition equations for Type 2 (Fibonacci) LFSR is in general, as follows: ##EQU8## where h, . . . , j are positive integers less than N. 
     The state transition matrix, G, for one step forward in the Galois LFSR is shown in FIG. 4. The N×N (where N is the number of positions in the LFSR) matrix has a subdiagonal of ones, and ones in the Nth column corresponding to tap positions. All other elements are zero. 
     The state transition matrix, F, for one step forward in the Fibonacci LFSR is shown in FIG. 5. The N×N matrix has a subdiagonal of ones, and ones in the first row corresponding to tap positions. All other elements are zero. 
     Determination of inverse transition matrix for generalized Type I: 
     The problem of determining G -1 , the inverse of the Galois transition matrix is equivalent to finding the permutations needed to reverse the corresponding state equations. 
     The matrix G maps the sequence {S k  } k  into the next step {S k   +  } k . 
     Substituting the S k   +   with the equivalent S k  terms, the one-step inverse transition matrix operations can be shown as follows: ##EQU9## 
     The first row of G -1  is all zeros except for a one in column 2 to map S 1  to the first position in the present state vector, on the right hand side. The second row of G -1  is all zeros except for a one in column 3 to map S 2  to the second position in the present state vector, on the right-hand side: 
     Row 1 of G -1  =[0 1 1 ,2 0 0 . . . 0] 
     Row 2 of G -1  =[0 0 1 2 ,3 0 . . . 0] 
     Row m of G -1  =[0 . . . 1 m ,m+  . . . ], for 1≦m ≦N 
     Row k of G -1  =[1 k ,1 0 . . . 1 k ,k+1 . . . 0], since S 1   +  =S N  and S N  +(S K  +S N )=S K   
     Row k+1 of G -1  =[0 . . . 1 k+1 ,k+2 . . . 0] 
     This is true for all k, for 1&lt;k&lt;N, where each k corresponds to a tap in the LFSR. 
     The resulting structure of the inverse transition matrix G -1 . for a Type I (Galois) LFSR is given in FIG. 6. Then, G -1  *G=N×N which is the identity matrix of rank N. The product is obtained using modulo 2 arithmetic. 
     Determination of inverse transition matrix for generalized Type II: 
     The problem of determining F -1 , the inverse of the Fibonacci transition matrix is equivalent to finding the permutations needed to reverse the corresponding state equations. 
     The matrix F maps the sequence {S k  } k  into the next step {S k   +  } k . 
     Substituting the S k   +   with the equivalent S k  terms, the one-step inverse transition matrix operations can be shown as follows: ##EQU10## 
     The first row of F -1  is all zeros except for a one in column 2 to map S 1  to the first position in the present state vector, on the right hand side. The second row of F -1  is all zeros except for a one in column 3 to map S 2  to the second position in the present state vector, on the right-hand side. 
     Row 1 of F -1  =[0 1 1 ,2 0 0 . . . 0] 
     Row 2 of F -1  =[0 0 1 2 ,3 0 . . . 0] 
     In general the pattern is 
     Row w of F -1  =[0 . . . 1 w ,w+1 . . . ], for 1≦w≦N, and 
     Row N of F -1  =[1 N ,1 0 . . . 1 N ,h . . . 1 N ,j . . . 0] 
     Row k+1 of G -1  =[0 . . . 1 k+1 ,k+2 . . . 0] for 1&lt;h&lt;j&lt;N 
     The resulting structure of the inverse transition matrix F -1  for a Type II (Fibonacci) LFSR is given in FIG. 7. Then, F -1  *F=I N ×N which is the identity matrix of rank N. The product is obtained using modulo 2 arithmetic. 
     Application to the IS-95 CDMA Long Code LFSR: 
     The forward transition matrix A for the IS-95 Long Code is given in FIG. 8. A -1 , the inverse of A for shifting backwards in time is shown in FIG. 9. By direct multiplication using modulo 2 arithmetic, A*A -1  =I 42 ×42, the identity matrix of rank 42. 
     Considering the one-step forward case, the shifting and XOR operation can be emulated as a matrix operation: 
     
         S.sub.1 =A×S.sub.0 
    
     where 
     S 1  =42-bit contents of LFSR after one clock period, 
     S 0  =initial contents of LFSR 
     A is the transition matrix of FIG. 8. 
     Similarly, the one-step backward case can be emulated by: 
     
         S.sub.-1 =A.sup.-1 ×S.sub.0. 
    
     The 42-bit contents of the LFSR can be shifted up to 2 42  -1 clock pulses in a single matrix operation. For example, had the value of 
     
         A.sup.7 =A*A*A*A*A*A*A 
    
     been precalculated and prestored, emulation of shifting 7 clock pulses into the future could be performed as: 
     
         S.sub.7 =A.sup.7 ×S.sub.0 
    
     It may be beneficial to precalculate and prestore such matrices, such as power-of-two numbers of shifts: 
     
         A.sup.2, A.sup.4, A.sup.8, A.sup.16, . . . A.sup.-2, A.sup.-4, A.sup.-8, A.sup.-16 
    
     A shift emulation of some arbitrary number of clock pulses can then be performed by a few well-chosen matrix operations in succession. While an example involving powers of two has been considered, it will be apparent to those skilled in the art that any power can be used and that matrices of arbitrary powers can be stored. 
     In a similar vein, with some hardware implementations of an LFSR, for shifts of fewer than 42 clock pulses it may be faster to actually shift the LFSR than to perform the matrix multiplies. In such cases, shifts by large numbers of clock pulses may be speeded up by calculating and prestoring values for multiples of 42 shifts: 
     
         A.sup.42, A.sup.84, A.sup.126, A.sup.168, . . . A.sup.-42, A.sup.-84, A.sup.-126, A.sup.-168 
    
     Shifting can then be emulated by matrix mathematics unless or until there are fewer than 42 forward shifts remaining to be performed, and they can then be performed by actual shifting. The number 42 has been chosen here since that is the number of bits in the LFSR under the IS-95 standard, but other numbers may be chosen and still fall within the scope of the invention. 
     The invention may be practiced in host hardware equipped with computational capability, such as a minicomputer or microcomputer, in which a program may be employed to determine the inverse transition matrix and to perform matrix multiplications with it so as to obtain past states of an LFSR. Firmware may also be employed, enabling practicing the invention in, for example, an ASIC (application-specific integrated circuit). 
     Modulo-2 matrix multiplication can be speeded up using parity checker hardware instead of actually performing a row-by-column multiplication. FIG. 10 depicts the multiplication of the PN vector by a row of a transition matrix. This process must be executed for each row of the transition matrix. In modulo-2 arithmetic, the process is equivalent to: 
     overlaying the row and PN vector; 
     ANDing the corresponding bits; and 
     summing the resultant 1&#39;s in modulo-2 addition. 
     In modulo-2 arithmetic, the latter step can yield a result of either zero or one, and zero if the number of 1&#39;s is even, and one if the number of 1&#39;s is odd. This determination of whether the number of 1&#39;s is even or odd is the function performed by a parity checker. If host hardware includes a parity checker it can be invoked to assist in the matrix multiply, saving 42 row-by-column multiplications each time. 
     It will thus be seen that the invention efficiently attains the objects set forth above, among those made apparent from the preceding description. In particular, the invention provides rapid determination of a past state of a linear feedback shift register without significant additional hardware. 
     It will be understood that changes may be made in the above construction and in the foregoing sequences of operation without departing from the scope of the invention. It is accordingly intended that all matter contained in the above description or shown in the accompanying drawings be interpreted as illustrative rather than in a limiting sense. 
     It is also to be understood that the following claims are intended to cover all of the generic and specific features of the invention as described herein, and all statements of the scope of the invention which, as a matter of language, might be said to fall therebetween.