## 2 Procedures for Constructing a Composite Maximal-Length Sequence (CMLS) and the Codec Design
Figure 2 shows two correlation functions, \(\theta=C_{(1,1)}(21)\odot\text{T}^{m}\ [C_{(1,1)}(21)]\) and \(\theta=C_{(1,1)}(21)\odot\text{T}^{m}\ [\underline{C}_{(1,1)}(21)]\), where \(\underline{C}_{(1,1)}(21)\) is the complementary CMLS that describes that chips \"1\" and \"0\" are in the inverse positions of \(C_{(1,1)}(21)\). In this figure, it can be observed that the CMLS has a good correlation property, as the autocorrelation value is large while the cross-correlation values remain relatively small. To design the codecs of the CMLS codes, arrayed waveguide grating (AWG) was employed. AWG acts as a de-multiplexer that routes each of the input wavelengths to a specific output port. Figure 3 shows the encoder of \(C_{(1,1)}(21)\), which consists of a \(3\times 3\) and a \(7\times 7\) AWG. The encoder input is a light source with a bandwidth that ranges from \(\lambda_{1}\) to \(\lambda_{21}\), including \(21\) wavelengths. One of the basic codes for constructing \(C_{(1,1)}(21)\) is \(M_{1}\ (3)=(110)\), which is represented as the optical signal of (\(\lambda_{1}\lambda_{2}0\)). These two wavelengths, \(\lambda_{1}\) and \(\lambda_{2}\), are obtained at the first and the second output of the \(3\times 3\) AWG. As shown in Figure 1, before generating \(C_{(1,1)}(21)\), an extended vector that includes seven duplicates of  
Figure 1: Construction of a composite maximal-length sequence (CMLS) with a length of \(21\) based on two maximal-length sequence (MLS) codes with a length of \(3\) and \(7\). Figure 2: The correlation values and the complementary correlation values of CMLS \(C_{(1,1)}(21)\). \(M_{1}\) (3) is required. The signal of each duplicate in the extended vector is obtained by employing the wavelength routing property of AWG known as the free-spectral range (FSR). For an \(M\times M\) AWG, if the signal of the light source enters the 1 st input port, the wavelengths shown at the \(i\)-th output port are \(\lambda_{i}\), \(\lambda_{i+M}\), \(\lambda_{i+2M}\)..., where \(i+kM\) is less than or equal to the maximum wavelength number. Therefore, the second duplicate of \(M_{1}\) (3) is represented as the signal of (\(\lambda_{4}\lambda_{5}0\)), while the third is (\(\lambda_{7}\lambda_{8}0\)), and the remaining duplicates have similar wavelength distributions. The other code basis, \(M_{1}\) (7) = (1110010), is composed of four wavelengths in its signal representation (\(\lambda_{1}\lambda_{2}\lambda_{3}00\lambda_{6}0\)). Similarly, the signal component of the extended vector of \(M_{1}\) (7) is obtained from the wavelengths appearing at 1 st, 2 nd, 3 rd, and 5 th outputs of the \(7\times 7\) AWG. The wavelength components at each AWG's outputs are combined and sent to a module-2 adder for generating the final CMLS. Using optical wavelength signals to represent the chip distribution in a code sequence is known as spectral-amplitude-coding (SAC), which has been used a lot in optical access and switching networks due to its system simplicity. In addition to \(C_{(1,1)}(21)\), other CMLS codes in the same code set can be generated from the shared encoder, as AWG has the cyclic-shift property for wavelength distributing. Such a property can also be found in the chip distributions of CMLSs and MLSs. An arbitrary CMLS \(C_{(i,j)}(21)\) can be obtained by passing the light source signal to the \(i\)-th input of the \(3\times 3\) AWG and the \(j\)-th input of the \(7\times 7\) AWG without modifying any connections and components at the grating's output ports. Figure 4 depicts the decoder of \(C_{(1,1)}(21)\) with a \(21\times 21\) AWG. The received signal is directed to the 1 st input port. The wavelength signals sent to the upper multiplexer match the positions of chip \"1\" in \(C_{(1,1)}(21)\), while the ones sent to the lower multiplexer match the positions of chip \"0\". The optical signals at each multiplexer's output are converted to an electrical current by a photodetector. After the lower current is subtracted from the upper, the subtraction result is passed to a threshed device.