1 Introduction

Photonic crystals (PhCs) have proven to be a good option to reduce loss and increase speed and bandwidth of optical processing systems [1,2,3,4,5,6]. Two-dimensional photonic crystals (2D-PhCs) have been favored by photonics researchers for their simplicity of design and construction [7,8,9,10,11]. One of the most widely used methods of designing optical devices based on photonic crystal is wave interference [12,13,14]. In this method the optical device is constructed based on constructive and destructive interference phenomenon of optical beams. Many optical devices such as isolator, decoder, gates, adders, subtractors, comparators, convertors and multiplexer were made with this procedure [15,16,17,18,19,20,21,22,23,24,25]. The functional parameters of these optical devices including ON–OFF contrast ratio (CR), bit rate (BR), optical intensity (OI), fall, rise and delay times (Tr, Tf and Td) and total footprint (TFP) were evaluated. For example, Sankar-Rao et al. [26] proposed all optical linear 1 × 2 demultiplexer based on PhC structure using T-shaped waveguides. This structure was compact and offered high contrast ratio of 18.53 dB with less insertion losses of 0.017 dB. Sankar-Rao et al. [27] in another article demonstrated a new design of all optical D Flip-Flop using photonic crystal waveguides with low insertion losses of 0.087 dB.

Rathi et al. [28] proposed and demonstrated all optical one-bit magnitude comparator using a cubic lattice of silicon rods in 2D-PhC structure based on wave interference. Their proposed structural geometry was very small and simple. Also, the nonlinear material and optical switches were not used. Priya et al. [29] demonstrated scheme of a photonic crystal based all optical 3-input OR gate using optical waveguides. The FDTD simulation results of their device showed a good value of contrast ratio, insertion loss and response time, which were equal to 8.66 dB, 12 fs and 2.27 dB, respectively. In 2020, Sankar-Rao et al. [30] proposed all optical Feynman and Toffoli reversible logic gates based on 2D-PhC waveguides and beams interference procedure. The contrast ratio of the Feynman and Toffoli reversible logic gates were obtained as 12.4 dB and 32.5 dB for, respectively.

All optical comparators (AOCMPs) are substantial logic devices required for creating all optical digital systems used in communication coding and cryptography. In recent years, several works have been proposed for designing AOCMP based on 2D-PhCs which have two input ports and three output ports [31,32,33,34,35]. In this matter, Fakouri-Farid et al. [31] proposed the first structure for realizing a 1-bit AOCMP which was designed purely based on threshold switching method. Serajmohammadi et al. [32] in another paper proposed an AOCMP using nonlinear materials. The Td and TFP of the structure were about 6 ps and 2399 μm2, respectively. Jile [33] presented another AOCMP based on the interference effect and phase shift keying technique (PSK) with high switching speed and low time delay. The BR, CR, and Tr of the optical structure were reported as 1.25 Tb/S, 6.53 dB and 0.6 ps, respectively. In 2020, another optical comparator was designed using the interference effect by Seraj et al. [36], which had two output ports to display a comparison of two input bits. Recently, another similar structure for the 1-bit AOCMP has been proposed by Parandin et al. [37], which has a simple structure with a TFP of 60 μm2. In this paper, an all optical structure based on linear photonic crystal (LPhC) is presented for realizing a 1-bit AOCMP. This comparator, like the structures introduced in the sources [36, 37], consists of two input ports and two output ports that can be used to improve power consumption, size, time delay and contrast ratio. The functionality of the proposed 1-bit AOCMP is based on constructive and destructive interference principle of optical beams and phase shift keying technique [17, 33]. In the next section, the proposed design for 1-bit AOCMP is described. In Sect. 3, the performance of proposed optical LPhC structure is examined and simulated using FDTD procedure based on Yee’s Algorithm, and finally, Sect. 4 concludes this research.

2 The proposed all optical 1-bit comparator

The fundamental LPhC structure which is going to be used for designing the 1-bit AOCMP is 31 × 33 cubic lattice of silicon (Si) rods immersed in air where the lattice constant is 590 nm. Also, the refractive index and the radius of the rods at operating wavelength of 1550 nm are about 3.46 and 119 nm, respectively. These optimal values are obtained by repeated simulations using the BandSOLVE and FullWAVE tools of RSoft CAD Layout. The simulation process is based on numerical methods of finite difference time domain (FDTD) and plane wave expansion (PWE), which are explained in the next section on how to obtain these optimal values. The proposed AOCMP was designed using seven optical waveguides (labeled OWG1 to OWG7) with appropriate lengths and junctions in the aforementioned structure. Because the creation of optical waveguides with different lengths causes a phase difference of π radians (180 degrees) at the point of collision between the optical waves coming from input ports. For this purpose, as shown in Fig. 1, the OWG1, OWG2 and OWG3 (L shaped) waveguides were created by removing 28, 17 and 15 rods in X and Z directions, and OWG6 waveguide was created by removing 5 rods in Z direction. Similarly, each of the waveguides OWG4, OWG5, and OWG7 are constructed by removing 10 rods in the X direction within the basic structure of proposed scheme. In order for the light waves to reach port O1, we have created three point defects with a radius of 59.5 nm at the junction of waveguides OWG1 and OWG6. The optimized structural parameters of the suggested 1-bit AOCMP are summarized in Table 1. The total foot print (TFP) of the structure is approximated by NX × NZ × a2, where NX and NZ are the number of rods at the X and Z directions, respectively, and a is the lattice constant. So, the TFP of the device is around 356 μm2. The TM band structure of the mentioned LPhC structure with aforementioned values is presented in Fig. 2. As shown in this figure, the desired forbidden frequencies, PBG, are located at 0.282 < a/λ < 0.417 for transverse magnetic (TM) polarization mode where a and λ are the lattice constant of the proposed LPhC fundamental structure and free space wavelength, respectively. By choosing a = 590 nm, this PBG will be at 1415 nm < λ < 2092 nm, which is suitable for designing the desired AOCMP and completely covers the third window of optical communication in TM mode.

Fig. 1
figure 1

Optical structure designed to realize an all optical 1-bit comparator

Table 1 The optimized structural parameters of suggested all optical 1-bit comparator
Fig. 2
figure 2

The TE/TM band structure of suggested AOCMP

The final structure of the AOCMP consists of two input ports X, Y, one reference port (REF) and two output ports O2, O1, as shown in Fig. 1, and compares the two input bits according to the following Table 2. The REF port is used as a bias port in this logic structure to compare the two input bits correctly.

Table 2 Truth table for the suggested 1-bit AOCMP

Based on PSK, we used 180 and 0 phase degrees of input signals for logic 0 and 1, respectively. If a large part of the light waves reach the output ports, their logic value is one, but if a small part of the light waves reach the output ports, their logical value is zero.

3 Results and discussion

The functionality of the proposed 1-bit AOCMP was analyzed and simulated with three optical pulses at the input ports. Because the proposed AOCMP was made of linear materials, the power of these light waves is very low (0.001 W/μm2) at a central wavelength of 1550 nm. The FDTD method has been used for calculating the optical wave propagation throughout the proposed AOCMP, in which the incident electric field (Ey) was considered parallel to the y-axis and the propagation plane was the xz plane. In this procedure, Maxwell’s equations (\(\nabla \times E\left( {r,t} \right) = - \mu \frac{\partial }{\partial t}H\left( {r,t} \right), \nabla \times H\left( {r,t} \right) = \varepsilon \left( r \right)\frac{\partial }{\partial t}E\left( {r,t} \right)\)) can be discretized in terms of position and time using Yee’s Algorithm and written as follows [38, 39]:

$$\begin{aligned} E_{y} \left| {\begin{array}{*{20}c} {n + \frac{1}{2}} \\ {i - \frac{1}{2},k + \frac{1}{2}} \\ \end{array} } \right. & = \left( {\frac{2\Delta t}{{2\varepsilon + \sigma \Delta t}}} \right)\left( {\frac{{H_{x} \left| {\begin{array}{*{20}c} n \\ {i - \frac{1}{2},k + 1} \\ \end{array} - H_{x} \left| {\begin{array}{*{20}c} n \\ {i - \frac{1}{2},k} \\ \end{array} } \right.} \right.}}{\Delta z} - \frac{{H_{z} \left| {\begin{array}{*{20}c} n \\ {i,k + \frac{1}{2}} \\ \end{array} - H_{z} \left| {\begin{array}{*{20}c} n \\ {i - \frac{1}{2},k + \frac{1}{2}} \\ \end{array} } \right.} \right.}}{\Delta x}} \right) \\ & \quad + \left( {\frac{2\varepsilon - \sigma \Delta t}{{2\varepsilon + \sigma \Delta t}}} \right)E_{y} \left| {\begin{array}{*{20}c} {n - \frac{1}{2}} \\ {i - \frac{1}{2},k + \frac{1}{2}} \\ \end{array} } \right. \\ \end{aligned}$$
(1)
$$\begin{aligned} H_{x} \left| {\begin{array}{*{20}c} {n + 1} \\ {i - \frac{1}{2},k + 1} \\ \end{array} } \right. & = \left( {\frac{2\Delta t}{{2\mu + \rho \Delta t}}} \right)\left( {\frac{{E_{y} \left| {\begin{array}{*{20}c} {n + \frac{1}{2}} \\ {i - \frac{1}{2},k + \frac{3}{2}} \\ \end{array} - E_{y} \left| {\begin{array}{*{20}c} {n + \frac{1}{2}} \\ {i - \frac{1}{2},k + \frac{1}{2}} \\ \end{array} } \right.} \right.}}{\Delta z}} \right) \\ & \quad + \left( {\frac{2\mu - \rho \Delta t}{{2\mu + \rho \Delta t}}} \right)H_{x} \left| {\begin{array}{*{20}c} n \\ {i - \frac{1}{2},k + 1} \\ \end{array} } \right. \\ \end{aligned}$$
(2)
$$\begin{aligned} H_{z} \left| {\begin{array}{*{20}c} {n + 1} \\ {i,k + \frac{1}{2}} \\ \end{array} } \right. & = - \left( {\frac{2\Delta t}{{2\mu + \rho \Delta t}}} \right)\left( {\frac{{E_{y} \left| {\begin{array}{*{20}c} {n + \frac{1}{2}} \\ {i + \frac{1}{2},k + \frac{1}{2}} \\ \end{array} - E_{y} \left| {\begin{array}{*{20}c} {n + \frac{1}{2}} \\ {i - \frac{1}{2},k + \frac{1}{2}} \\ \end{array} } \right.} \right.}}{\Delta x}} \right) \\ & \quad + \left( {\frac{2\mu - \rho \Delta t}{{2\mu + \rho \Delta t}}} \right)H_{z} \left| {\begin{array}{*{20}c} n \\ {i,k + \frac{1}{2}} \\ \end{array} } \right. \\ \end{aligned}$$
(3)

where i and k present the discretized grid point in xz planes, respectively, index n, H, ε, μ, σ and ρ denote the discrete time step, magnetic field, permittivity, permeability, electric conductivity and equivalent magnetic conductivity, respectively. Δx, Δz and Δt are the spatial steps in the x and z directions and time interval, respectively, which are related by the following equation:

$$\Delta t \le \frac{1}{c}\sqrt {\left( {\frac{1}{\Delta x}} \right)^{2} + \left( {\frac{1}{\Delta z}} \right)^{2} }$$
(4)

The simulation process has the following four stages because, as mentioned, the proposed scheme has two input ports, during which the initial phase of the light waves of port REF is 180 degrees.

CASE 1 (X = Y): When the initial phase (IP) of the optical signals launched into the optical structure of the proposed 1-bit AOCMP through X and Y ports is 180 degrees (i.e., X = Y = 0 and REF = 0). It means that the phase difference between X and Y ports is 0 radians. Therefore, the optical beams inside OWG2 and OWG3 waveguides have destructive interference at their junction and destroy each other and a small part of them go to port O2. In the other part of the structure, a large portion of the optical waves coming from REF port will be travel toward O1 by the OWG1 and OWG7 waveguides and the point defects located at their junction. Figure 3a depicts the field distribution in waveguide paths for this case of optical comparator. Also, Fig. 3b shows the normalized power at O1 and O2 which are 62% and 10%, respectively. As a result, the logic levels of ports O1 and O2 are 1 and 0, respectively (i.e., O2 = 0 and O1 = 1), which means that X is equal to Y.

Fig. 3
figure 3

a Field distribution inside waveguide paths and b time response diagram of the proposed 1-bit AOCMP when the IP of the optical signals launched into the optical structure through X and Y ports is 180 degrees (i.e., X = Y = 0)

CASE 2 (X < Y): When the IP of the optical signals launched into the structure of the proposed 1-bit AOCMP through X and Y are 180 and 0 degrees, respectively. (i.e., X = 0 and Y = 1 and REF = 0). It means that the phase difference between X and Y ports is π radians. Therefore, the optical beams inside OWG2 and OWG3 waveguides have a constructive interference at their junction and amplify each other and the resulting light waves move inside the OWG4 waveguide. Then, these waves are divided into two parts, some of them go to port O2 and the other part is directed to the OWG5 waveguide.

The REF port light waves inside the OWG1 waveguide have a destructive interference with the light waves inside the OWG5 waveguide at their junction and destroy each other. Therefore, a small part of these waves is transmitted to port O1. Figure 4a depicts the field distribution in waveguide paths for this case of optical comparator. Also, Fig. 4b shows the normalized power at O1 and O2 which are 10% and 246%, respectively. As a result, the logic levels of ports O1 and O2 are 0 and 1, respectively (i.e., O2 = 1 and O1 = 0), which means that X is smaller than Y.

Fig. 4
figure 4

a Field distribution inside waveguide paths and b time response diagram of the proposed 1-bit AOCMP when the IP of the optical signals launched into the optical structure through X and Y are 180 and 0 degrees, respectively. (i.e., X = 0 and Y = 1)

CASE 3 (X > Y): When the IP of the optical signals launched into the structure of the proposed 1-bit AOCMP through X and Y are 0 and 180 degrees, respectively. (i.e., X = 1 and Y = 0 and REF = 0). As in case 2, the phase difference between X and Y ports is π radians. Therefore, the optical beams inside OWG2 and OWG3 waveguides have a constructive interference at their junction and amplify each other and the resulting light waves move inside the OWG4 waveguide. Then, these waves are divided into two parts, some of them go to port O2 and the other part is directed to the OWG5 waveguide. In this case, the REF port light waves inside the OWG1 waveguide have a constructive interference with the light waves inside the OWG5 waveguide at their junction and amplify each other and the resulting light waves move to the O1 port. Figure 5a depicts the Field distribution in waveguide paths for this case of optical comparator. Also, Fig. 5b shows the normalized power at O1 and O2 which are 149% and 139%, respectively. As a result, the logic levels of ports O1 and O2 are 1 and 1, respectively (i.e., O2 = 1 and O1 = 1), which means that X is larger than Y.

Fig. 5
figure 5

a Field distribution inside waveguide paths and b time response diagram of the proposed 1-bit AOCMP when the IP of the optical signals launched into the optical structure through X and Y are 0 and 180 degrees, respectively. (i.e., X = 1 and Y = 0)

CASE 4 (X = Y): When the IP of the optical signals launched into the optical structure of the proposed 1-bit AOCMP through X and Y ports is 0 degrees (i.e., X = Y = 1 and REF = 0). As in case 1, the phase difference between X and Y ports is 0 radians. Therefore, the optical beams inside OWG2 and OWG3 waveguides have destructive interference at their junction and destroy each other and a small part of them go to port O2. In the other part of the structure, a large portion of the optical waves coming from REF port will be travel toward O1 by the OWG1 and OWG7 waveguides and the point defects located at their junction. Figure 6a depicts the field distribution in waveguide paths for this case of optical comparator. Also, Fig. 6b shows the normalized power at O1 and O2 which are 71% and 4%, respectively. As a result, the logic levels of ports O1 and O2 are 1 and 0, respectively (i.e., O2 = 0 and O1 = 1), which means that X is equal to Y. The obtained results of the proposed 1-bit AOCMP including initial phase (IP) and logic state (LS) of input ports, and the normalized intensity (NI) and logic state of output ports have been summarized in Table 3. This table indicates that the minimum and maximum values of the NI at ON and OFF states (P1 and P0) for output ports are 62% and 10%, respectively. Also, according to Figs. 3, 4, 5 and 6, the maximum Tr, Tf, Td and BR are about 0.15 ps, 0.05 ps, 0.45 ps and 2.22 Tb/S, respectively. The delay time (Td) is the time required for the output ports to reach their final level.

Fig. 6
figure 6

a Field distribution inside waveguide paths and b time response diagram of the proposed 1-bit AOCMP when the IP of the optical signals launched into the optical structure through X and Y ports is 0 degrees (i.e., X = Y = 1)

Table 3 Obtained results of the proposed 1-bit AOCMP

As described, these values (P1, P0, Tr, Tf, Td and BR) are optimal and are obtained by repeated simulation processes with optimal refractive index and radius of the rods. To obtain the optimal refractive index of the rods of the proposed 1-bit AOCMP, we performed four stages of the simulation process for different refractive indices and in each step we calculated the ON–OFF contrast ratio (CR) based on the following formula [40,41,42,43,44,45,46].

$${\text{CR}} = 10 \times \log \left( {P_{1} /P_{0} } \right)$$
(5)

After evaluating these values, the optimal refractive index value was 3.46, as shown in Fig. 7. In this figure, the horizontal axis is a different size for the refractive index of rods and the vertical axis is the ON–OFF contrast ratio of the proposed 1-bit AOCMP.

Fig. 7
figure 7

ON–OFF contrast ratio of the proposed 1-bit AOCMP, proportional to the changes in the refractive index of rods from 3.28 to 3.58

Also, to obtain the desired radius of the rods, we performed four steps of the simulation process for different radii and calculated the CR in each step. Figure 8 shows the CR of the proposed 1-bit AOCMP, proportional to the changes in the radius of rods from 112 to 124 nm. In this figure, the horizontal axis is a different size for the radius of rods and the vertical axis is the CR. As shown in the figure, the optimal value of the radius is 119 nm.

Fig. 8
figure 8

ON–OFF contrast ratio of the proposed 1-bit AOCMP, proportional to the changes in the radius of rods from 112 to 124 nm

Table 4 compares the designed 1-bit AOCMP with previous schemes. The proposed 1-bit AOCMP was smaller than previous comparators with three output ports and offered a higher switching speed. Also, it has less Td than them [31,32,33,34,35]. As shown in Table 4, the proposed 1-bit AOCMP has a higher CR than similar structures with two output ports [36, 37]. Also, this comparator based on LPhCs has a simpler structure than other designs, which has less point defect in its structure and made of completely linear materials [31,32,33,34,35,36,37].

Table 4 Comparison of the results of the suggested 1-bit AOCMP with the previous schemes

4 Conclusion

In this paper, an all optical structure based on LPhC was presented for realizing an AOCMP. As shown, the recommended 1-bit AOCMP consists of two input ports and two output ports that can be used to improve the power consumption, size, time delay and contrast ratio. The FDTD procedure based on Yee’s Algorithm was used to compute the propagation of optical waves in this structure. The CR, BR, Tr and Tf of the suggested the 1-bit AOCMP are about 7.92 dB, 2.22 Tb/S, 0.15 ps and 0.05 ps, respectively. Due to the simple structure of the proposed design and its desired results, this optical comparator (1-bit AOCMP) is suitable for use in all optical integrated circuits.