## 1 Introduction
Meanwhile, phase modulation formats like binary phase shift keying (BPSK) and quadrature phase shift keying (QPSK) are extensively utilized in commercial optical communication devices because of their benefits, including extended transmission distances and robust resistance to noise [10]. An all-optical flexi  
Figure 1: The principle and deployment of the optoelectronic firewall. OOK, BPSK, and polarization shift keying (PolSK) signals was developed in [11]. It can avoid phase-locking through all-optical format conversion and parallel structure. For higher-order phase-modulated signals, two all-optical pattern recognition systems based on format conversion [12] and parallel structure [13] were proposed to recognize QPSK symbols. To improve flexibility and scalability, a reconfigurable all-optical pattern-matching system for phase-modulated signals based on phase-sensitive amplification was proposed in [14]. Recently, a reconfigurable all-optical pattern recognition system was proposed for PSK and quadrature amplitude modulation (QAM) signals with two implementation architectures [15]. Although many works have studied the recognition of phase-modulated signals, there are still three issues that need to be addressed when an optoelectronic firewall is deployed in optical networks. First, frequency synchronization brought on by phase-locking leads to a complex system. Although the systems in [11; 13] achieve a phase-locking-free architecture, the parallel structure makes the system complex and bulky when recognizing long target sequences. Other works all require additional frequency synchronization or phase-locking devices to maintain a stable frequency or phase relationship between the input data and the target, which also increases the complexity of the whole system. Second, a single pattern recognition system cannot recognize more than one target each time. As network attacks become sophisticated and insidious, it is necessary to recognize more than one target with arbitrary length without cost and complexity increasing. Third, the previous systems cannot support the recognition of input signals with tunable frequency. They can only achieve pattern recognition of input signals with a specific frequency. In this paper, we propose a tunable all-optical pattern recognition system based on a nonlinear optical loop mirror (NOLM). The system mainly consists of two delay interferometers (DLs), the NOLM, a NOT gate, and the recirculating loop, including an AND gate and a regenerator. The significant contributions of our study span four aspects: (1) our proposed system is phase-locking free. Benefiting from the signal reloading and the symmetric design of NOLM, the generation and maintenance of a stable phase relationship between the input data and target are inherently guaranteed, thereby eliminating the need for additional phase-locking or signal carrier extraction; (2) the system can recognize two bit-flip BPSK targets at the same time. Due to differential encoding, the phase difference between adjacent bits of the BPSK signal is mapped into a two-level power-modulated signal through DI. Then, two bit-flip BPSK targets are reloaded as the same output signal. By recognizing the reloaded signal, the recognition results for the original two bit-flip BPSK targets can be obtained; (3) the system can process the input signal with tunable frequency. By adjusting the gain of EDFA and controlling the signal power entering NOLM, the phase shift resulting from the XPM effect for the input signal with tunable frequency is ensured to be either \(\pi\) or \(0\). Thus, our proposed system can process the input signal with different frequencies; (4) the system can be extended to support higher-order modulation formats. By substituting the DI with an all-optical format conversion that transforms QPSK signals into four-level pulse amplitude modulation (PAM4) signals, the proposed system can be extended to support the recognition of QPSK targets, which enhances its compatibility and configurability.