## 2 Principle of Operation
When the input signal is in phase with the target, there will be no pulse indicating logic \"0\" generated at the output of the BPF. Conversely, when the input signal is out of phase with the target, a pulse indicating logic \"1\" will be generated. Figure 3 shows the schematic diagram of the constellation transformation and corresponding bit sequence mapping during bit-recognition. The primary phases of signal processing include DI, XPM, and coupling. The original BPSK signal is first converted into the AMI pattern after the DI. Then, the AMI pattern is reloaded to the phase-modulated signal leveraging the XPM effect. The two reloaded signals are coupled to obtain the bit-recognition result. According to the bit-recognition result, when the adjacent bit phase difference of the input BPSK signal and the target are the same, which means both are \(\pi\) or 0, the output of the coupler is logic \"0\". Otherwise, when the adjacent bit phase difference of the input BPSK signal and the target are different, the output of the coupler is logic \"1\". Next, the bit-recognition result passes through an EDFA and a NOT gate. If the input signal is in phase with the target, there is a pulse indicating logic \"1\" generated after the NOT gate; otherwise, no pulse indicating logic \"0\" is generated after the NOT gate. Finally, a recirculating loop integrating an AND gate and a regenerator with (\(n+1\)) bits delay is connected to recognize the target with variable length. This is the same as that in [7], so we will not go into detail here. The procedure of searching targets {\(\pi\), 0, \(\pi\), \(\pi\)} and {0, \(\pi\), 0, 0} in the input data {0, \(\pi\), 0, \(\pi\), \(\pi\), \(\pi\), 0, \(\pi\), 0, 0} is shown in Figure 4. Here, we assume that the time for signals to pass through optical fibers and other components is ignored. In the first loop, the input BPSK data are first repeated four times via the storage loop with a duration of \(10T\). The repeated data are fed into the DI, where the current bit coherently interferes with the previous bit. Meanwhile, the first BPSK target with a length of \(10T\) coherently interferes with the  
Figure 3: Schematic diagram of the constellation transformation and corresponding bit sequence mapping during bit-recognition. previous target bit. During the first loop, two optical switches are open, so the output of the DI will not enter the NOLM, and the other components in the system have no output. In the second loop, the input BPSK data coherently interferes with the previous bit. If these two bits have the same phase, the output power is high, which is denoted by logic \"1\". Otherwise, the output power is low, which is denoted by logic \"0\". Thus, the output of the right DI is {1, 0, 0, 0, 1, 1, 0, 0, 0, 1}. Similarly, the second BPSK target coherently interferes with the first BPSK target bit, and the output of the left DI is {0, 0, 0, 0, 0, 0, 0, 0}. Assuming the initial phase of the local CW is 0, after passing through the isolator and coupler, the phase of the clockwise carrier remains the same, while the counterclockwise carrier introduces a phase shift of \(j\). Then, the phase of the reloaded target in the clockwise direction is {0, 0, 0, 0, 0, 0, 0, 0, 0}, and the phase of the reloaded data in the counterclockwise direction is {3\(\pi\)/2, \(\pi\)/2, \(\pi\)/2, \(\pi\)/2, 3\(\pi\)/2, \(\pi\)/2, \(\pi\)/2, \(\pi\)/2, \(\pi\)/2, 3\(\pi\)/2]. Subsequently, the signals in both directions pass through the coupler, and the counterclockwise carrier introduces another phase shift of \(j\). After the isolator and the BPF, the signal at \(\lambda_{\text{CW}}\) is filtered out. Next, the output of the BPF is fed into the NOT gate, and the output is {0, 1, 1, 1, 0, 0, 1, 1, 1, 0}. The output of the NOT gate enters the recirculating loop together with an initializing pulse of \(10T\) in length. The output of the AND gate is {0, 1, 1, 1, 0, 0, 1, 1, 1, 0}, which indicates the number and position of the first two bits of the targets in the input BPSK data.