## 3 Encoder and Comparator
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Symbol** & **Definition** & **Value** & **Unit** \\ \hline N\({}_{\mathrm{tr}}\) & Transparency carrier density & \(10^{24}\) & m\({}^{-3}\) \\ L & Length of AR & 500 & \(\mu\)m \\ d & Thickness of AR & 0.3 & \(\mu\)m \\ w & Width of AR & 3 & \(\mu\)m \\ C\({}_{0}\) & Unsaturated power gain & 30 & dB \\ \(\omega_{0}\) & Central optical frequency & 193.55 & THz \\ N\({}_{\mathrm{SP}}\) & Spontaneous emission factor & 2 & - \\ B\({}_{0}\) & Optical bandwidth & 2 & nm \\ \hline \hline \end{tabular}
\end{table} 
Table 1: _Cont._Figure 2: Operation principle of the all-optical encoder and comparator using CR-SOA-MZIs. To numerically implement the \(\overline{\text{AB}}\) operation, the optical input powers fed into CR-SOA1 and CR-SOA2 of the CR-SOA-MZI1 can be represented as  
\[P_{in,\ CR-SOA_{1}}(t)\ =\ P_{\overline{A}}(t)\ +\ 0.5\,P_{B}(t) \tag{12}\]  
\[P_{in,\ CR-SOA_{2}}(t)\ =\ P_{CW}\ +\ 0.5\,P_{B}(t) \tag{13}\]  
Then, the output power for the \(\overline{\text{AB}}\) operation in the CR-SOA-MZI1 is expressed as [11]  
\[P_{\overline{AB}}(t)\ =\ 0.25\,P_{B}(t)\left(G_{CR-SOA_{1}}(t)\ +\ G_{CR-SOA_{2}}(t)\ - \ 2\sqrt{G_{CR-SOA_{1}}(t)\ G_{CR-SOA_{2}}(t)}\ cos\left[\Phi_{CR-SOA_{1}}(t)\ -\ \Phi_{CR-SOA_{2}}(t)\right]\right) \tag{14}\]  
To perform the \(\text{A}\overline{\text{B}}\) operation, the input optical powers applied to CR-SOA3 and CR-SOA4 in CR-SOA-MZI2 are defined as  
\[P_{in,\ CR-SOA_{3}}(t)\ =\ P_{A}(t)\ +\ 0.5\,P_{\overline{B}}(t) \tag{15}\]  
\[P_{in,\ CR-SOA_{4}}(t)\ =\ P_{CW}\ +\ 0.5\,P_{\overline{B}}(t) \tag{16}\]  
Consequently, the \(\text{A}\overline{\text{B}}\) output power of the CR-SOA-MZI2 is determined by  
\[P_{\overline{AB}}(t)\ =\ 0.25\,P_{\overline{B}}(t)\left(G_{CR-SOA_{3}}(t)\ +\ G_{CR-SOA_{4}}(t)\ - \ 2\sqrt{G_{CR-SOA_{3}}(t)\ G_{CR-SOA_{4}}(t)}\ cos\left[\Phi_{CR-SOA_{3}}(t)\ -\ \Phi_{CR-SOA_{4}}(t)\right]\right) \tag{17}\]  
For the AB (AND) operation, the optical power inputs directed into CR-SOA5 and CR-SOA6 of CR-SOA-MZI3 can be defined as  
\[P_{in,\ CR-SOA_{5}}(t)\ =\ P_{A}(t)\ +\ 0.5\,P_{B}(t) \tag{18}\]  
\[P_{in,\ CR-SOA_{6}}(t)\ =\ P_{CW}\ +\ 0.5\,P_{B}(t) \tag{19}\]  
Then, the output power for the AB (AND) operation at the CR-SOA-MZI3 is expressed as  
Figure 2:0  
To perform the \(\overline{\text{A}}\)\(\overline{\text{B}}\) (NOR) operation, the input optical powers fed into CR-SOA7 and CR-SOA8 of the CR-SOA-MZI4 are represented as  
Figure 2:1  
Figure 2:2  
Then, the \(\overline{\text{A}}\)\(\overline{\text{B}}\) (NOR) output power generated by the CR-SOA-MZI4 is determined as  
\begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline \multicolumn{2}{c}{**Input Signals**} & \multicolumn{3}{c}{**Output Encoder**} & \multicolumn{3}{c}{**Output Comparator**} \\ \hline
**A** & **B** & \(\overline{\text{AB}}\) & \(\overline{\text{AB}}\) & \(\overline{\text{AB}}\) & \(\overline{\text{AB}}\) & \(\overline{\text{AB}}\) & \(\overline{\text{AB}}\) & \(\overline{\text{AB}}\) & \(\overline{\text{AB}}\) & \(\overline{\text{AB}}\) \\ \hline
0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 \\
0 & 1 & 1Figure 2:3  
The XNOR output power is obtained by combining the results of the AB and \(\overline{\text{A}}\ \overline{\text{B}}\) operations, as expressed in [38]:  
Figure 2:4