## 2 Operating Principles  
Figure 1 illustrates the operating principles of the optical comparator for QPSK modulation. The proposed comparator is defined for a particular 8-bit code which consists of four successive QPSK symbols; the designed code is named as \"comparator code\" in this paper. The main purpose of the comparator is to calculate comparison results based on the comparator code. When an arbitrary 8-bit code is injected into the comparator, our scheme yields an optical symbol whose constellation reflects the Hamming distance between the arbitrary 8-bit code and the comparator code. In this context, the Hamming distance is derived as:  
\[d_{H}(\mathbf{x},\mathbf{y})=\sum_{k=0}^{n-1}|x_{k}-y_{k}|, \tag{1}\]  
where \(\mathbf{x}=x_{0},x_{1},\cdots,x_{n-1}\) and \(\mathbf{y}=y_{0},y_{1},\cdots,y_{n-1}\) are \(n\)-bit code words, and the Hamming distance provides the number of coefficients in which they differ.  
The proposed comparator is designed for four successive QPSK symbols, and their constellation is given in the form of a \(Gray\) code. In this code, two adjacent constellations differ in only one bit, and the most-significant-bit and least-significant-bit contribute to the quadrature and in-phase component in the complex plane. The proposed comparator requires three operational steps, as follows:  
1. **S/P conversion:** to convert serially-successive symbols into four parallel symbols.
2. **Phase shift:** to rotate the phases in each parallel symbol; the amounts of the phase rotation are determined according to the comparator code to convert their original constellations into a first quadrant in each QPSK symbol, which corresponds to a \"00\" constellation in \(Gray\) code.
3. **Optical coupling:** to yield a complex symbol from four parallel symbols optically.  
As an example, an optical comparator designed for a \"00 11 00 11\" code (e.g., a \"00 11 00 11\" comparator) is considered. According to the design concept, in the comparator, four phase-rotations  
Figure 1: Operating principles of the optical comparator for an 8-bit quadrature phase-shift keying (QPSK) signal. In this figure, the comparator is designed for a “00 11 00 11” code to set their phase shifts at \((0,\pi,0,\pi)\), and the working example is illustrated when a “11 00 11 00” signal is input. It is shown that the Hamming distance of \(d_{H}(00\,11\,00\,11,11\,00\,11\,00)\) corresponds to the distance of both constellations.  
for each QPSK symbol are set at 0, \(\pi\), 0, and \(\pi\), respectively. By the phase rotations, every constellation in \"00 11 00 11\" code will be converted into a \"00\" constellation. When a \"00 11 00 11\" signal is injected into the comparator, the comparator generates the coupled symbol whose constellation is located at the vector sum of four \"00\" constellations in the complex plane; the constellation is named as _\"base constellation\"_ in this paper. On the other hand, when a \"11 00 11 00\" signal is assumed, the set of the (0, \(\pi\), 0, \(\pi\)) phase-shift contributes to rotate their constellations from (11, 00, 11, 00) to (11, 11, 11). As a result, the coupled symbol has a constellation corresponding to the vector sum of four \"11\" constellations. In this constellation, the distance from the base constellation coincides with the Hamming distance of \(d_{H}(11001100,00110011)=8\), because the difference vectors in each symbol, which are based on each symbol of the comparator code, can be surely aligned in a direction inclined by a \(\pi/4\) angle with respect to the horizontal axis in the complex plane. Therefore, the comparator provides the constellation having the comparison result against an arbitrary 8-bit code.