# Design of Universal Code Generator for Multi-Constellation Multi-Frequency GNSS Receiver
## 2 Introduction to GNSS Spread Spectrum Codes
### Spread Spectrum Code Generation Methods Based on LFSR
#### 2.2.4 Interleaved Z4-Linear (IZ4) Ranging Code  
In August 2023, India publicly released the Interface Control Document (ICD) for the L1 frequency SPS space signal. As depicted in Figure 7, the code generator structure employed by India is based on the IZ4 scheme. It comprises two 55-bit shift registers, namely R0 and R1, along with a 5-bit shift register denoted as C. The initial value of the register is determined by the input PRN number. The spread spectrum code is generated using the following method [6].  
The feedback value of register R0 is determined by the following feedback polynomial:  
\[R0(54)=R0(50)\oplus R0(45)\oplus R0(40)\oplus R0(20)\oplus R0(10)\oplus R0(5) \oplus R0(0) \tag{1}\]  
In the above equation, the term on the right represents the value of Register R0 at time t, while the term on the left corresponds to the feedback value received by the register at time (t + 1). Initially, at t = 0, all registers are initialized, and subsequently, the registers are shifted at each time interval.  
For Register R1, the feedback value is obtained by output value R1A of Shift Register R0 and the calculated value R1B of the feedback tap of Register R1. The R0 output, denoted as R1A, is composed of three sub-components: \(\sigma_{2A}\), \(\sigma_{2B}\), and \(\sigma_{2C}\). The resulting modulo-2 sum of R1A and R1B is fed back to the 54 th bit of Register R1, denoted as R1(54). The equation below outlines the calculations required to generate the feedback value for Register R1:  
\[\sigma_{2A}=[R0(50)\oplus R0(45)\oplus R0(40)]\ AND\ [R0(20)\oplus R0(10) \oplus R0(5)\oplus R0(0)] \tag{2}\]  
\[\sigma_{2B}=([R0(50)\oplus R0(45)]\ AND\ R0(40))\oplus([R0(20)\oplus R0(10)] \ AND\ [R0(5)\oplus R0(0)]) \tag{3}\]  
\[\sigma_{2C}=[R0(50)\ AND\ R0(45)]\oplus[R0(20)\ AND\ R0(10)]\oplus[R0(5)\ AND\ R0(0)] \tag{4}\]  
\[\sigma_{2}=\sigma_{2A}\oplus\sigma_{2B}\oplus\sigma_{2C} \tag{5}\]  
\[R1A=\sigma_{2}\oplus[R0(40)\oplus R0(35)\oplus R0(30)\oplus R0(25)\oplus R0( 15)\oplus R0(0)] \tag{6}\]  
\[R1B=R1(50)\oplus R1(45)\oplus R1(40)\oplus R1(20)\oplus R1(10)\oplus R1(5) \oplus R1(0) \tag{7}\]  
\[R1(54)=R1A\oplus R1B \tag{8}\]  
All quantities in Equations (2)-(7) are in-register values corresponding to time t. For Equation (8), the quantity on the left side of the equation represents the value of Register R1 at time (t + 1), the 55 th register, i.e., R1(54), which is obtained by modulo-2 summing the values of the right variables R1A and R1B at time t. At time t = 0, all registers are initialized and the registers are shifted at each time period.  
The IZ4 spread spectrum code is obtained by performing a modulo-2 sum between the first bit of R1, denoted as R1(0), and the first bit of the 5-bit cyclic shift register known as the C register. The C register undergoes a cycle of 10,230 shifts, during which its first bit is directly fed back to the fifth bit. The generator for this process is illustrated in Figure 7.  
Figure 6: Schematic Diagram of the QZSS L6D/L6E Code Generator.  
The signal spread spectrum code generator is considered as a more complex component within the existing satellite navigation signal generator structure. However, the generation of only the IZ4 signal leads to a relatively lower utilization rate of the hardware structure. Therefore, improvements are required in its structure to enhance the utilization of its hardware resources. Additionally, leveraging this register in combination with other GNSS signals will support the generation of spread spectrum codes for all GNSS signals, further optimizing the hardware utilization.