## 3 Modeling
This meticulously defined arrangement explicitly outlines the input optical powers for the XOR2 function [8; 18]:  
\[P_{in,~{}CR-SOA_{3}}(t) = P_{\rm C}(t)~{}~{}+~{}~{}0.5~{}P_{\rm CW} \tag{8}\] \[P_{in,~{}CR-SOA_{4}}(t) = P_{\rm D}(t)~{}~{}+~{}~{}0.5~{}P_{\rm CW} \tag{9}\]  
The overall integrated gain of each CR-SOA is then calculated as follows [8; 9; 13; 18]:  
\[G_{CR-SOA_{i}}(t)~{}~{}=~{}~{}exp\left[h_{AR}(t)~{}~{}+~{}~{}h_{CH}(t)~{}~{}+~{ }~{}h_{SHB}(t)~{}\right] \tag{10}\]  
The following expressions represent the phase shift imposed on the CW beams in each CR-SOA [9; 10; 11; 12]:  
\[\Phi_{CR-SOA_{i}}(t)~{}~{}=~{}~{}-~{}0.5~{}~{}(\alpha~{}h_{AR}(t)~{}~{}+~{}~{ }\alpha_{CH}~{}h_{CH}(t)) \tag{11}\]  
The XOR output power is then determined by the interferometric formula shown below [8; 18]:  
\[P_{XOR1,~{}2}(t)=~{}~{}0.25~{}P_{\rm CW}\left( \begin{array}{cc}G_{CR-SOA_{1, 3}}(t)~{}~{}+~{}~{}G_{CR-SOA_{2,~{}4}}(t)~{}~{}-~{}2\sqrt{G_{CR-SOA_{1,3}}(t)~ {}G_{CR-SOA_{2,~{}4}}(t)}\\ cos\left[\Phi_{CR-SOA_{1,3}}(t)~{}~{}-~{}~{}\Phi_{CR-SOA_{2,~{}4}}(t)\right] \end{array} \right) \tag{12}\]  
The output power from XOR1 is meticulously combined with half of the CW beam power, channeling it into CR-SOA5 of CR-SOAs-MZI3. Simultaneously, the output power from XOR2, in conjunction with the remaining half of the CW beam, is seamlessly integrated and introduced into CR-SOA6 of CR-SOAs-MZI3. Subsequently, the even parity generator's output power (Pe) at port 10 is calculated based on the interferometric formula provided below:  
\[P_{e}(t)=~{}~{}0.25~{}P_{\rm CW}\left( \begin{array}{cc}G_{CR-SOA_{5}}(t)~{}~ {}+~{}~{}G_{CR-SOA_{6}}(t)~{}~{}-~{}2\sqrt{G_{CR-SOA_{5}}(t)~{}G_{CR-SOA_{6}}(t )}\\ cos\left[\Phi_{CR-SOA_{5}}(t)~{}~{}-~{}\Phi_{CR-SOA_{6}}(t)\right]\end{array} \right) \tag{13}\]  
To create the odd parity generator, the output power Pe is carefully blended with half of the CW beam power, guiding it into CR-SOA7 of CR-SOAs-MZI4. Simultaneously, the CLK beam, combined with the remaining half of the CW beam, is seamlessly integrated and introduced into CR-SOA8 of CR-SOAs-MZI4 (refer to Figure 3). Subsequently, the output power (Po) from the odd parity generator at port 13 is determined using the provided interferometric formula:  
\[P_{o}(t)=~{}~{}0.25~{}P_{\rm CW}\left( \begin{array}{cc}G_{CR-SOA_{7}}(t)~{}~ {}+~{}~{}G_{CR-SOA_{8}}(t)~{}~{}-~{}2\sqrt{G_{CR-SOA_{7}}(t)~{}G_{CR-SOA_{8}}(t )}\\ cos\left[\Phi_{CR-SOA_{7}}(t)~{}~{}-~{}\Phi_{CR-SOA_{8}}(t)\right]\end{array} \right) \tag{14}\]  
In Wolfram Mathematica(r) 11.0 we applied the Adams numerical technique to solve time-dependent Equations (1)-(14) accurately. The assessment of output operations relies on the quality factor (QF), expressed as QF = (P\({}_{1}\) - P\({}_{0}\))/(\(\sigma_{1}\) + \(\sigma_{0}\)), where P\({}_{1,0}\) represents the mean peak powers, and \(\sigma_{1,0}\) corresponds to the standard noise deviations of the output logical '1's and '0's. Achieving a minimum QF value of 6 is not only crucial for ensuring satisfactory performance but is also imperative to keep the relevant bit error rate [23] below 10\({}^{-9}\), aligning with established benchmarks in the field [8; 18]. The QF's versatility, predictive capability, ease of interpretation, and widespread acceptance make it a preferred and valuable metric for evaluating the performance of logic gates, particularly in optical communication systems [24].