## 4 Results  
The performance of the proposed all-optical encoder and comparator using an CR-SOA-MZI at 120 Gb/s was evaluated with input signals A and B, successfully performing five distinct logic operations: \(\overline{\text{AB}}\), \(\overline{\text{AB}}\), AB (AND), \(\overline{\text{A}}\ \overline{\text{B}}\) (NOR), and AB + \(\overline{\text{A}}\ \overline{\text{B}}\) (XNOR). The output logic functions demonstrated exceptionally high QFs, with values of 17.56 for \(\overline{\text{AB}}\), 17.04 for \(\overline{\text{AB}}\), 19.05 for AB (AND), 10.95 for \(\overline{\text{A}}\ \overline{\text{B}}\) (NOR), and 8.33 for XNOR, as shown in Figure 3. These high QFs are attributed to the efficient XGM effects enabled by the CR-SOA-MZI configuration. The CR-SOA's nonlinearity ensures strong interactions between the signals, resulting in enhanced signal modulation and high-speed logic operations. However, the relatively lower QF of 8.33 for the XNOR operation can be explained by the increased complexity of combining two different logic gates (AND and NOR) to achieve the XNOR output. This operation involves a higher level of interaction and interference between signals, which can lead to slight distortions in the output signal. Additionally, the combined nature of the XNOR function may cause suboptimal signal reinforcement compared to individual logic operations, resulting in higher noise levels and less efficient modulation. As a result, this leads to a lower QF for the XNOR output. The eye diagrams for all the logic operations were open and clear, confirming the high signal integrity and minimal distortion across the outputs, except for the XNOR function, which exhibited some mild distortion. These results highlight the excellent performance and reliability of the CR-SOA-MZI configuration for most logic operations, with the XNOR operation showing a slight reduction in quality, which could be further optimized in future designs. The simulation results for various optical logic operations, including \(\overline{\text{AB}}\), \(\overline{\text{AB}}\), AB (AND), \(\overline{\text{A}}\ \overline{\text{B}}\) (NOR), and AB + \(\overline{\text{A}}\ \overline{\text{B}}\) (XNOR), in the CR-SOA-MZI configuration, reveal the crucial impact of the power of signal B (PB) on the overall performance of AOLGs. As shown in Figure 4, the data demonstrate a clear inverse relationship between the power of signal B and the QF of the output logic functions. At lower input powers, such as \(-\)10 dBm, the interaction between signals A and B is more effectively managed, leading to higher QFs. However, as the power of signal B increases, the CR-SOA experiences saturation, diminishing the XGM effect, which is essential for maintaining the logic operations' quality. In the \(\overline{\text{AB}}\) operation, for example, an initial QF of 24.12 is observed at -10 dBm, but this value decreases as signal B's power rises, indicating that the cross-gain modulation becomes less efficient at higher powers. Similar trends are seen in the \(\overline{\text{AB}}\) and AB operations, where the power of signal B plays a dominant role in the modulation process, and excessive power results in over-saturation, reducing modulation depth and signal clarity. Notably, the NOR operation (\(\overline{\text{A}}\ \overline{\text{B}}\)) exhibits extreme sensitivity to the power of signal B, with a significant drop in the QF reaching near zero at 4 dBm. This highlights the complex interactions between signals A and B within the SOA, where higher power levels lead to inefficient carrier density modulation and signal distortion. The XNOR operation, which combines both AND and NOR gates, also demonstrates a drastic reduction in the QF as signal B's power increases, indicating that multi-gate logic operations are particularly susceptible to degradation when signal B's power is excessive, leading to interference between the gates.