1 Introduction

Photonic Crystals (PhCs) is a category of periodic optical nanostructures having different dielectric constants. As it is inevitable in the next generation of signal processing and communication networks to use optical waves and photons as a data carrier instead of electrons, new designs should be created with unique specifications. PhCs are one of the structures that have these superb abilities to control and guide the optical waves inside the structure. PhCs provide opportunities to overcome the drawbacks of micro electronic technology, such as the slow signal processing, the large size and the huge power consumption of the integrated circuits. Thus, PhCs are great candidates for optical networks, optical communications and applications of optical signal processing (Joannopoulos et al. 2011). Many PhCs based optical components have been reported such as: multiplexers (Rao et al. 2021; Fasihi and Bashiri 2020; Zhao et al. 2019), de-multiplexers (Mohammadi et al. 2019, 2021a; Masilamani and Punniakodi 2020; Radhouene et al. 2020; Mohammadi and Seifouri 2019; Kannaiyan et al. 2017), full adders (Mohammadi et al. 2021b; Naghizade and Saghaei 2021a; Maleki et al. 2021a, b; Goswami et al. 2021; Vali-Nasab et al. 2019), analog-to-digital converters (Naghizade and Saghaei 2021b; Shamsi and Moradi 2020; Geng and Zhao 2020), optical filters (Foroughifar et al. 2021), flip-flops (Zamanian-Dehkordi et al. 2018; Abbasi et al. 2012), comparators(Seraj et al. 2020; Feng et al. 2021; Cheng and Dadras Jeddi Pishkhani 2021; Zhu et al. 2019; Jile 2020), optical logic gates (Kumar and Sen 2020; Kotb and Guo 2020; Saranya and Anbazhagan 2020; Caballero et al. 2020; He et al. 2020; Mostafa et al. 2019a; Hussein et al. 2018a, b; Olyaee et al. 2018; Fu et al. 2013; Caballero and Neto 2021) and all-optical encoders (Makvandi et al. 2021; Rajasekar et al. 2020; Mehdizadeh et al. 2017; Chhipa et al. 2022; Haddadan and Soroosh 2019; Haddadan et al. 2020; Saranya and Shankar 2021; Latha et al. 2022a, b; Arunkumar et al. 2022; Fallahi et al. 2021; Khatib and Shahi 2020; Saranya and Rajesh 2020; Mostafa et al. 2019b). The encoder is a device with 2N input and N output ports. Encoders are generally used in communication systems like automatic health monitoring systems, war field, medical industry and electronics industry. PhCs are classified according to the dimensions of periodicity as one dimensional (1D) PhC, two dimensional (2D) PhC or three dimensional (3D) PhC. The reason behind preferring 2D PhC for designing a photonic device instead of 1D PhC is because of having a complete photonic band gap unlike the 1D PhC. Also, the 2D PhC simulation requires less memory and less computational resources compared with 3D PhC (Kannaiyan et al. 2017). To fabricate a 2D PhC structure, microfabrication techniques are utilized like electron-beam lithography and focused ion-beam etching methods (Olyaee et al. 2018). The 2D PhC structure can be a periodic array of air pores in a dielectric background, or a periodic array of dielectric rods in an air background. The arrangement can be in many forms, such as a hexagonal (triangular) lattice or a square lattice. A square lattice of dielectric rods is preferred over a triangular lattice of air pores because of the former’s simple nanostructure, accurate band gap calculations and weak propagation loss, and also because the light can be confined easily during propagation inside the structure (Kannaiyan et al. 2017). So, 2D PhC square lattices of dielectric rods are used in our proposed designs. According to the unique property of the photonic band gap (PBG), we can confine and guide the flow of light through the structure by introducing defects (Joannopoulos et al. 2011). There are many types of defects that can guide the propagation of light inside the structure. Point defects are introduced by removing one rod or by changing its radius, shape or dielectric constant in order to localize the light. Line defects are another type of defects which are introduced by removing a line or multiple lines of rods or by changing the dielectric constant or the radius of the line rods to form a waveguide through which the light is directed to the desired destination (Kannaiyan et al. 2017). The line defects take several structures to serve a designed function. For example, the line defects can take the form of Ring Resonators in which part of the signal propagates in clockwise (CW) direction and the other part propagates in counterclockwise (CCW) direction. According to the phase difference between the CW and CCW signals, the interference could be either constructive or destructive. Researchers proposed different designs for 4 × 2 PhC Encoders, using linear and non-linear materials, and using point defects, line defects, and/or ring resonators (Makvandi et al. 2021; Rajasekar et al. 2020; Mehdizadeh et al. 2017; Chhipa et al. 2022; Saranya and Shankar 2021; Latha et al. 2022a, b; Arunkumar et al. 2022; Fallahi et al. 2021; Khatib and Shahi 2020; Saranya and Rajesh 2020; Mostafa et al. 2019b), beside using cross-connected waveguides (Haddadan and Soroosh 2019), graphene stack in the center of a photonic crystal for approaching the encoding operation (Haddadan et al. 2020).

In this work, we propose two new designs for 4 × 2 PhC encoders. Our proposed designs have simple structures that can be fabricated easily. They do not contain any non-linear material. Also, the proposed structures are designed using only silicon, which is the most commonly used material in optical integrated circuits. Our designs have small footprints, reasonable contrast ratios and good response times.

This paper is organized as follow: Sect. 2 discusses the general design steps for PhCs devices. Section 3 describes the design of the first proposed encoder (ENC_1), its working principles and its simulation results. Section 4 describes the design of the second proposed encoder (ENC_2), its working principles and its simulation results. Finally, Sect. 5 presents the conclusion including a comparison between the proposed designs and recent previously published ones.

2 General design steps

To design a PhC device, you can follow the next steps (summarized in Fig. 1).

Fig. 1
figure 1

Flow chart describing the steps to design a photonic crystal device

First, choose the guiding mechanism that is proper to the application (Self collimation/Nonlinear Kerr effect/Interference technique, etc.). As clarified in ref. (Goswami et al. 2021), self-collimation method requires a splitter and a reflector. The split/reflected beams propagate only in specified directions. The contrast ratio of cascading devices based on this method is significantly low because of using a part of the split beam as an input signal to other sections at the same circuit. This affects the intensity of the beams at the output ports. Nonlinear Kerr effect technique is based on using a non-linear material whose refractive index changes with the intensity of the input signal. Examples of non linear materials which can exhibit kerr effect Polystyrene (PS), Nonlinear optical polymers (NLO) (Maksymov and Garví 2010) and index silicon oxynitride (SiON) (Piccoli et al. 2022). Thus, a high input power is required in this technique. Also, power consumption and response time are usually large in non-linear designs compared to linear designs. Moreover, this technique usually produces narrow operating frequency bandwidth. The Interference technique depends on the interference phenomenon of light to get the proper logic at the output ports. In this technique, the input signals should be launched in-phase. The input signals interact with each other and according to their phase difference either a constructive or a destructive interference is produced, which corresponds to logic ‘1’ or logic ‘0’, respectively. The phase difference is controlled by the lengths of the waveguides. The output waveguides lead the light to the output ports (Hussein et al. 2018b). The phase difference is directly proportional to the path difference via the wave vector. Changing the length of the waveguide will change the path difference, hence change the phase difference as shown in the following equation:

$$\Delta \emptyset = \frac{{2\varvec{\pi} \Delta \varvec{x}}}{\varvec{\lambda}}$$

where \(\Delta x\) is the path difference between the two waves. \(\Delta \varnothing\) is the phase difference between two waves (Newburgh 2005).

Second, choose the materials of the rods and the background according to the technique selected in the previous step. The commonly used material in building a photonic structure based on interference effect is silicon. Germanium and other materials like GaAs and AlGaAs are also used but in a narrow range. The material of background is air in most designs (Caballero and Neto 2021).

Third, calculate the parameters suitable for the intended operating wavelength. For example, in this work we use wavelength λ = 1550 nm which lies in the C-band, that ranges from 1530 to 1565 nm, to be suitable for telecommunication application. For a lattice constant a = 1000 nm, the central λ inside the PBG equals 2672 nm that is not within the range of our PBG shown in Fig. 2. So, for a 1550 nm central wavelength, we must use a lattice constant of 580 nm according to Eq. (1). Then, the rods’ radius can be calculated according to this lattice constant (Vali-Nasab et al. 2019).

$$\frac{{{\omega a}}}{{2{\pi c}}} = \frac{{{\text{a}}_{1} }}{{{\uplambda }_{1} }} = \frac{{{\text{a}}_{2} }}{{{\uplambda }_{2} }}$$
(1)
Fig. 2
figure 2

The PhC Band Gap of ENC_1 is between 0.57348 and 0.811565 1/um

Fourth, choose the defect structures to guide the flow of light inside the structure according to the function of the device. Finally, adjust all design parameters to achieve the optimum performance of the device.

3 First proposed encoder (ENC_1)

The following section describes the proposed encoder (ENC_1) simple design. The structure contains rectangular ring resonators and linear waveguides without any modifications in the rod size.

3.1 ENC_1 design working principles

The proposed structure of the encoder ENC_1 is based on a 2D PhC square lattice silicon rods immersed in air background. The refractive index (n) of the dielectric rods is 3.46, the lattice constant (a) is 580 nm and the radius of the rods is 0.15a, which is 87 nm. The PBG shown in Fig. 2, is obtained using the plane wave expansion (PWE) method (Johnson and Joannopoulos 2001). As shown, the PBG is located between 0.573 and 0.812 μm−1 of the normalized frequency, which is equivalent to the wavelength interval of 1232–1744 nm. We chose 1550 nm to be the operating wavelength as it is commonly used in optical communication applications. Generally, a 4 × 2 encoder consists of two OR gates and a buffer as shown in Fig. 3. The encoder contains four inputs I0, I1, I2 and I3 and two outputs O0 and O1. The two OR gates are connected to each other by the common input I3.

Fig. 3
figure 3

The logic circuit of 4 × 2 ENCODERs

First, we propose the structure of the OR gate. It consists of 23 × 17 silicon rods in air containing a rectangular ring resonator with two arms as input waveguides (WA, WB) and one output waveguide (WC) as shown in Fig. 4. The upper and lower arms of the resonator are identical in length to achieve the constructive interference that accomplishes the OR gate operation.

Fig. 4
figure 4

The OR gate structure

Second, we describe the structure of the 4 × 2 Encoder, ENC_1, as shown in Fig. 5. The proposed structure contains 23 × 28 Si rods in air substrate. The buffer structure is created by removing 23 horizontal Si rods to form a waveguide. ENC_1 contains two rectangular ring resonators with a common arm as depicted in Fig. 5, and we removed one rod from the waveguide W3 to enhance coupling in the resonators. The footprint of the proposed ENC_1 is about 204.8 μm2. The design parameters are summarized in Table 1.

Fig. 5
figure 5

The proposed structure of All-Optical 4 × 2 ENC_1

Table 1 The values of all parameters of ENC_1 and ENC_2

3.2 ENC_1 simulation results and discussion

The simulation of the OR gate of Fig. 4 is shown in Fig. 6. The simulation is performed using the Finite-Difference Time-Domain (FDTD) method (Rycroft 1996) by the free OptiFDTD 32-bit tool (https://www.optiwave.com/). The power transmission and the field distribution in the PhC structure are obtained using this simulator. As shown, in Fig. 6a, when an input signal is launched at the input port IA, the signal propagates through the waveguide WA until it couples through the rectangular ring resonator. Then, part of the signal propagates in the CW direction inside the rectangular ring resonator and the other part propagates in the CCW direction. These parts meet at the starting point of the output waveguide WC. Because of the small phase difference between the CW and CCW signals, a constructive interference is produced and the signal propagates through the output waveguide WC with logic value ‘1’ at the output port O. Similarly, when an input signal is launched at the input port IB, a signal of logic value ‘1’ is obtained at the output port O (Fig. 6b). But, when two signals are launched at IA and IB at the same time, due to the symmetric structure the two input signals have the same phase which produce a strong constructive interference giving logic value ‘1’ at the output port O (Fig. 6c). The normalized input and output power values of all-optical OR logic gate are listed in Table 2. The input source at each input port is set as Pin = 10 W/m.

Fig. 6
figure 6

The Optical field propagation for all-optical OR logic gate a I1 = 1, I2 = 0 b I1 = 0, I2 = 1 c I1 = 1, I2 = 1

Table 2 The truth table and the values of normalized output power for the proposed OR gate

The simulation results of the ENC_1 encoder of Fig. 5 is shown in Fig. 7 that shows the optical field propagation at the different combinations of the input signals.

Fig. 7
figure 7

The Optical field propagation for the proposed ENC_1 encoder a ONLY I0 is ON b ONLY I1 is ON c ONLY I3 is ON d ONLY I2 is ON

As shown in Fig. 7a, when only I0 is ON, the signal propagates inside the BUFFER waveguide W0. When only I1 is ON (Fig. 7b), the input signal propagates through waveguide W1 then part of it propagates through the resonator in the CW direction. The other part propagates in the CCW direction, leading to dominating constructive interference. The signal propagates through the output waveguide W4 until reaching the output port O0 with logic value ‘1’. When only the input I3 is ON (Fig. 7c), the signal simultaneously propagates through the two resonators such that one part propagates in the CW direction and the other in the CCW direction. Thus, a dominating constructive interference is produced and the output signal propagates through both output waveguides W4 and W5 with logic value ‘1’ at both output ports O0 and O1. When only input I2 is ON (Fig. 7d), the input signal propagates inside waveguide W2 until reaching the resonator where part of the wave propagates in the CW direction and the other part propagates in the CCW direction, leading to a dominating constructive Interference. The signal propagates through the output waveguide W5 till arriving to the output port O1 with logic value ‘1’. The values of the normalized output powers are indicated in Table 3.

Table 3 Truth table of the proposed 4 × 2 ENC_1

The important characteristic parameters such as the contrast ratio, the response time and the data rate are calculated for the ENC_1 encoder. The contrast ratio is calculated for the worst value of logic ‘1’ and that of logic ‘0’ and is defined as:

$$CR \left( {dB} \right) = 10 \log \frac{{P_{1} }}{{P_{0} }}$$
(2)

where P1 is the lowest normalized output power of logic ‘1’ and P0 is the highest normalized output power of logic ‘0’. As depicted in Table 3, the lowest value of logic ‘1’ is 0.42 Pin and the highest value of logic ‘0’ is 0.09. So, the contrast ration of ENC_1 is 6.69 dB. We consider the response time (RT) as the time taken by the device to reach 90% of its steady-state output value (Makvandi et al. 2021). According to Fig. 8, the response time for ENC_1 is 254 fs. The data rate is calculated as the reciprocal of the response time. Thus, it is 3.94 Tbps.

Fig. 8
figure 8

The output amplitude value vs time for proposed ENC_1 encoder a at output port O0 when ONLY I1 is ON b at output port O1 when ONLY I2 is ON c at each output port O0 and O1 when ONLY I3 is ON

4 Second proposed encoder (ENC_2)

In this design we used ring resonators instead of rectangular ring resonators, and we modified the location and the size of a few rods to enhance the encoder performance.

4.1 ENC_2 design working principles

The proposed structure is based on a 2D PhC square lattice 28 × 18 silicon rods immersed in air background. The refractive index (n) of the dielectric rods and the lattice constant (a) are chosen as those used in designing ENC_1 (3.46 and 580 nm, respectively). The radius of the rods (r) is 0.2a, which is equal to 116 nm. For this proposed structure, the band diagram is shown in Fig. 9, which depicted that the PBG is located between 0.643 and 0.807 μm−1of the normalized frequency, which is equivalent to the wavelength interval of 1239–1556 nm. As we did in ENC_1, we chose 1550 nm to be the operating wavelength as it is commonly used in optical communication applications.

Fig. 9
figure 9

The PhC Band Gap of ENC_2 is between 0.642777 and 0.806816 1/um

As in ENC_1 design, we propose the structure of the OR Gate separately, then we build the structure of the 4 × 2 Encoder by connecting two OR gates to each other by a common input (I3) as shown in Fig. 3. The OR gate consists of 18 × 17 of silicon rods embedded in air background, as shown in Fig. 10. The OR gate contains a square ring resonator and two input waveguides (WA, WB) connected to each other as L-shaped waveguides, then connected to a third waveguide (WC). WD is the output waveguide. The light guiding performance of the waveguides is improved by adding extra rods at the bends of the L-shaped waveguides to cancel the backward reflection at the bending parts of the waveguides(Mehdizadeh et al. 2017). There are extra two scattering rods (the green rods shown in Fig. 10) of radius = 0.1a at the entrance of WC to help directing the light through WC toward the resonator and reducing the light reflected to the input ports (the return loss). Also, there are four rods of 0.2a radius at the corners of the ring resonator to enhance its efficiency. There is a coupling rod (the red rods shown in Fig. 10) of radius 0.1a = 0.058 μm at the center of the resonator to improve the coupling (Saranya and Anbazhagan 2020). The input source at each input port is set as Pin = 10 W/m.

Fig. 10
figure 10

The proposed structure of OR gate

As depicted in Fig. 11, the proposed 4 × 2 ENC_2 consists of 18 X 28 silicon rods in air substrate with four inputs I0, I1, I2 and I3, two outputs O0 and O1 and two square ring resonators with common input waveguide (W3). The radius and location of the point defects are selected to enhance the device performance. All defects are made of the same material as the whole structure. This makes the fabrication of the device simpler. The footprint of this 4 × 2 encoder is 160.4 μm2. Table 1 contains all the used parameters.

Fig. 11
figure 11

The proposed structure of All-Optical 4 × 2 ENC_2

4.2 ENC_2 Simulation Results and Discussion

The simulation results of the OR gate of Fig. 10 is shown in Fig. 12. When an input signal is launched at the input port IA, the signal propagates through the waveguide WA until it reaches the waveguide WC then it couples through the square ring resonator. Part of the input signal propagates in the CW direction inside the resonator, and the other part propagates in the CCW direction. These parts meet each other at the entrance of the output waveguide WD with a dominating constructive interference due to the small phase difference between the CW and CCW signals. The output signal reaches the output port O with logic value ‘1’. Similarly, when an input signal is launched at the input port IB, a signal of logic value ‘1’ is obtained at the output port O. But when two signals are launched at IA and IB simultaneously, a constructive interference is produced because the two input signals have the same phase due to the symmetric structure, giving logic value ‘1’ at the output port O. Table 4 indicates the normalized input and output power values of the all-optical OR gate.

Fig. 12
figure 12

The Optical field propagation for the all-optical OR logic gate a I1 = 1, I2 = 0 b I1 = 0, I2 = 1 c I1 = 1, I2 = 1

Table 4 The truth table of the proposed OR gate

The Simulation results of the ENC_2 encoder of Fig. 11 is shown in Fig. 13, which shows the effect of the input signals each at a time. When only I0 is ON, the signal propagates inside the waveguide W0 until reaching the output port Q. When only I1 is ON, part of the signal propagates in the CW direction and the other part propagates in the CCW direction, leading to a dominating constructive interference. The signal propagates through the output waveguide (W5) with logic value ‘1’ at the output port O0. Similarly, when only the input I2 is ON, part of the signal propagates in the CW direction and the other part propagates in the CCW direction, leading to a dominating constructive interference and the signal propagates through the output waveguide (W7) with logic value ‘1’ at the output port O1. When only the input I3 is ON, the signal simultaneously propagates through the two resonators leading to propagating part of the signal in the CW direction and the other part propagates in the CCW direction, producing a dominating constructive interference and obtaining logic value ‘1’ at both output ports O1 and O2. The values of the normalized output powers are in Table 5.

Fig. 13
figure 13

The Optical field propagation for ENC_2 a ONLY I0 is ON b ONLY I1 is ON c ONLY I3 is ON d ONLY I2 is ON

Table 5 Truth table of the proposed ENC_2

According to the output power values in Table 5, the contrast ratio = 12.9 dB. As shown in Fig. 14, the response time of ENC_2 equals 163 fs and therefore the data rate equals 6.13 Tbps.

Fig. 14
figure 14

The output amplitude value vs time for proposed ENC_2 encoder a at output port O0 when ONLY I1 is ON b at output port O1 when ONLY I2 is ON c at each output port O0 and O1 when ONLY I3 is ON

The effects of adding scattering and coupling rods to ENC_2 are shown in Fig. 15. The scattering rods helps in directing the input signal toward the resonators and decreasing the return loss. The scattering rods produced approximately double the value of the normalized output power. The coupling rods enhanced the coupling through the resonators. The coupling rods have greatly effect on the normalized output power.

Fig. 15
figure 15

Impact of adding scattering and coupling rods on the normalized output power of ENC_2

5 Discussion

Table 6 contains a comparison between our two designs ENC_1 and ENC_2 and other recent works.

Table 6 Comparison table between our work and other published works

Encoder ENC_2 has better performance than encoder ENC_1. ENC_2 has better footprint and response time than ENC_1. Besides, the contrast ratio value of ENC_2 is almost double that of ENC_1. Comparing ENC_2 with the other recently published works, the encoder of reference (Mostafa et al. 2019b) is better in footprint and response time, but our ENC_2 contrast ratio is approximately double their value. Our response time of ENC_2 is better than almost all shown designs. The encoders of references (Makvandi et al. 2021) and (Khatib and Shahi 2020) are better in footprint than our ENC_2 but our response time is better than theirs. The encoders of references (Saranya and Shankar 2021) and (Arunkumar et al. 2022) have a better contrast ratio than ours, but our ENC_2 design is better in footprint and response time. The encoders of references (Chhipa et al. 2022) and (Fallahi et al. 2021) are better in footprint than ours, but our response time and contrast ratio are better than theirs. The encoder of reference (Saranya and Rajesh 2020) has a contrast ratio and a response time better than ours, but the footprint is large and the rods are chalcogenide glass. Our ENC_2 has better values of response time, footprint and contrast ratio than the encoders of references (Rajasekar et al. 2020; Latha et al. 2022a, b). In addition, ENC_2 has better response time and footprint than the encoder of reference (Mehdizadeh et al. 2017).

6 Conclusion

In this paper, we proposed two new designs of all-optical completely linear 4 × 2 ENCODER. The proposed structures were designed using a 2D PhC square lattice of Silicon rods in air. PWE and FDTD methods were applied for determining the PBG and for simulating the field distribution inside the proposed structures, respectively. The proposed structures were designed based on the optical interference technique. The operating wavelength of the proposed structures is 1550 nm which is suitable for various optical communication applications. The symmetric structure is one of the advantages of the proposed designs. Other advantages are the simplicity of the structure, and the use of the same material for all rods, which facilitates the fabrication process. All input signals of the proposed structure are expected to be in phase and of the same power value. So, employing this structure in cascaded optical devices can be considered less challenging than the other structures that use input signals of specific different phases or of specific different values of power. There is no need to use high input power excitation for diverting the incoming light to the output, because we did not use any non-linear material. The approximate values of the overall footprint, contrast ratio and response time for ENC_1 are 204.8 μm2, 6.69 dB and 254 fs, respectively. The approximate values of the overall footprint, contrast ratio and response time for ENC_2 are 160.4, 12.9 dB and 163 fs, respectively.