1 Introduction

High-speed processing is one of the excellent characteristics of photonics-based devices. Thus, professional optical systems require doing all the communication steps without using electrical signals in the optical domain. Signal processing is one of the important steps in optical systems and networks. All-optical logic devices are essential for realizing all-optical signal processing (Rahmani and Mehdizadeh 2018; Saghaei et al. 2017; Sharifi et al. 2016). One of the optical signal processes' high-tech devices is an optical full-adder because there exists a full-adder in every fundamental mathematical operator (Cheraghi et al. 2018; Jiang et al. 2015; Kowsari and Saghaei 2018; Liu and Ouyang 2008; Maleki et al. 2020; Sani et al. 2020; Vali-Nasab et al. 2019). A full-adder contains three input ports and two output ports; thus, three binary numbers are added together, and two binary numbers are obtained at the outputs called Sum and Carry. A photonic crystal (PhC) may have one or more photonic band gaps (PBGs) in particular wavelength ranges, which makes it capable of directing the light propagation inside a waveguide (Alipour-Banaei and Mehdizadeh 2013; Hosseinzadeh Sani et al. 2020a, b; Mehdizadeh et al. 2017b; Naghizade and Saghaei 2021). PhCs ring resonators (PCRRs) provide excellent functionality to design and realize numerous optical devices with very small footprints and low fabrication cost. Therefore, they are more popular among researchers. Resonant modes of a PCRR depend on several key parameters such as rod radius, dielectric constant, and position of the PhC unit cells (Biswas et al. 2020; Farmani et al. 2020; Mansouri-Birjandi et al. 2016; Naghizade et al. 2018; Naghizade and Sattari-Esfahlan 2017; Tavousi et al. 2017). By changing every parameter, the blue or redshift occurs at resonant modes. Every PCRR has a resonant mode, acting as an optical pass-band or stop-band filter. So far, a large number of PhC-based devices such as optical filters (Alipour-Banaei et al. 2014; Foroughifar et al. 2021; Guo et al. 2019; Naghizade and Saghaei 2020a; Rakhshani and Mansouri-Birjandi 2013), logic gates (Andalib and Granpayeh 2009; Hussein et al. 2018; Parandin et al. 2018b; Younis et al. 2014), encoders and decoders (Moniem 2016; Naghizade and Khoshsima 2018; Parandin et al. 2018a), comparators (Fakouri-Farid and Andalib 2018; Jile 2020), adders and subtractors (Alipour-Banaei and Seif-Dargahi 2017; Hosseinzadeh Sani et al. 2020a; Karkhanehchi et al. 2017; Moradi 2019; Naghizade and Saghaei 2020b), registers (Martinez-Dorantes et al. 2017; Pahari and Guchhait 2012), and memories (Alexoudi et al. 2020; Kuramochi et al. 2014; Uda et al. 2018), optical fibers (Aliee et al. 2020; Diouf et al. 2017; Ghanbari et al. 2017, 2018; Saghaei 2017; Saghaei et al. 2016a, b, 2015), demultiplexers (Mehdizadeh and Soroosh 2016; Saghaei et al. 2011; Saghaei and Seyfe 2008; Talebzadeh et al. 2017; Wen et al. 2012), sensors (Alden Mostaan and Saghaei 2021; Hosseinzadeh Sani et al. 2020b; Tabrizi et al. 2021; Tavakoli et al. 2019), PhC fibers (Ebnali-Heidari et al. 2014; Raei et al. 2018; Saghaei 2018; Saghaei and Ghanbari 2017; Saghaei and Van 2019), switches (Alipour-Banaei et al. 2015; Chen et al. 2006; Mehdizadeh et al. 2017a), interferometers (Gu et al. 2007; Saghaei et al. 2019), as well as all-optical clocked sequential circuits including flip-flops (Kumar et al. 2010; Sethi and Roy 2014), synchronous and asynchronous counters (Kaur and Kaler 2014; Poustie et al. 2000) have been designed and fabricated. New functionality is created using high nonlinear dielectric rods in the resonator, and switching applications can be achieved. Recently all-optical half-adders and full-adders were designed using linear and nonlinear effects, self-collimated beam, and coupled waveguides techniques in PhC structures (Ghadrdan and Mansouri-Birjandi 2013; Jiang et al. 2015; Neisy et al. 2018). In this paper, we present an all-optical full-adder using two X-shaped PCRRs. The plane wave expansion (PWE) and finite-difference time-domain (FDTD) methods are used to analyze the optical behavior of the proposed structure (Johnson and Joannopoulos 2001; Qiu 2002) The paper is organized as follows. The full-adder's physical structure and the numerical results achieved by the PWE method are presented in Sect. 2. Section 3 describes the light propagation inside the full-adder using the numerical FDTD method, and the paper is closed by the conclusion in Sect. 4.

2 Physical structure

Figure 1 shows the schematic view of a typical full-adder and its truth table. We observe that a full-adder has been designed by combining two optical half-adders and an OR logic gate. Each half-adder consists of two input ports of A and B, and two output ports of S and C that S and C stand for Sum and Carry, respectively. The first half-adder output of S has been connected to the first input port of the second half-adder. C ports of optical half-adders are the OR gate's inputs and form the Carry of the final full adder and the S port of the second half-adder is also the Sum port of the full-adder. Besides, A, B, and Cin are the three input ports of the full-adder.

Fig. 1
figure 1

Illustration of a the full-adder circuit consisting of two half-adders and an OR logic gate, three input ports of A, B, and Cin, and two output ports of Sum and Carry, b the truth table of full-adder for all states

In this study, we aim to design an all-optical full-adder in a rod-based PhC. The fundamental PhC structure used to design the proposed structure consists of dielectric rods with hexagonal lattice geometry. The refractive index and radius of dielectric rods are assumed to be 3.46 and 0.2a, where a is the lattice constant of the PhC structure. Using the PWE method, the photonic band diagram of the fundamental structure has been calculated and shown in Fig. 2. It shows a wide PBG region at 0.27 < a/λ < 0.45 for TM polarization mode, which is equal to 1333 nm < λ < 2222 nm for a = 600 nm. In addition to linear rods, an X-shaped PhC resonator (X-PCR) can be designed using several nonlinear dielectric rods in a specific location and direction. For this purpose, we have replaced a number of nonlinear rods with linear dielectric rods in X-PCR.

Fig. 2
figure 2

Photonic band diagram of the fundamental rod-based PhC for the TM polarization mode

Nonlinear rods are made of doped glass whose linear refractive index and nonlinear Kerr coefficient are 1.4 and 10–14 m2/W, respectively. Figure 3 demonstrates the X-PCR, where nonlinear rods are shown in dark green. As seen in the figure, the proposed resonator consists of one input port and three output ports.

Fig. 3
figure 3

The schematic view of X-shaped PhC resonator composed of linear and nonlinear rods

An optical beam is launched in the bus waveguide and dropped to one of the nonlinear resonators' output ports depending on the input power. The time-domain light propagation inside X-PCR for two different optical powers are shown in Fig. 4a, b. As shown in the figure, when the light power of 1 W/μm2 enters the PhC structure, it exits the first output port (O1) by creating a resonance mode in the X-PCR because the resonance mode is equal to the center wavelength of the input signal for this amount of optical power. When the optical power is 2 W/μm2, resonance mode does not occur, and the optical beam continues to its direct path inside the bus waveguide and goes out from the second output port (O2).

Fig. 4
figure 4

Light propagation inside the X-PCR for different input powers of a P = 1 W/μm2 and b P = 2 W/μm2

Fig. 5
figure 5

The proposed all-optical full-adder consisting of eight waveguides and two ring resonators

Figure 5 shows the proposed full-adder consisting of eight waveguides and two ring resonators at suitable places and directions inside the fundamental PhC structure. WG1, WG2, WG3, and WG4 waveguides and X-PCR1 form the first half adder. The first half adder's S and C ports are placed at the right side of WG3 and WG4. Also, WG4, WG5, WG6, and WG7, and X-PCR2 form the second half-adder. The right sides of WG6 and WG7 are the second half-adder C and S ports, respectively. WG3, WG6, and WG8 form the OR gate and WG8 works as the Carry port of the proposed full-adder. Also, the right side of the WG7 works as the Sum output port, and A, B, and C are defined as the input ports of the full-adder. Both X-PCRs work with the same propagating method where the optical beam is coupled into the drop waveguide when the bus waveguide's optical power is 1 W/μm2. However, it is not possible to couple light into other waveguides for optical power more than 1 W/μm2.

3 Simulation results

We employed the FDTD method to analyze and simulate the light propagation inside the proposed full-adder shown in Fig. 5, which contains three input ports. Therefore, according to the computation principle, we have 23 (2 N, N is the number of input ports) different input states. The optical power of the input ports is equal to 1 W/μm2. The simulation results are discussed as follows for all states of the input ports.

Case #1:

In this state, all the input ports are OFF (i.e., A = 0, B = 0, and C = 0); thus, there is no optical signal in the structure, and both output ports are OFF, and the amounts of Sum and Carry will be zero.

Case #2:

When A = 1, B = 0, and C = 0, the optical signal coming from input port A, travels close to X-PCR1 through WG1 and WG3. Since the optical power is less than 2 W/μm2, the optical signal will be dropped into WG4 using X-PCR1 and propagates to WG6. Again it is dropped into WG7 using X-PCR2 and travels toward Sum port. Thus, we have Sum = 1 and Carry = 0. The light propagation inside the proposed full-adder is shown in Fig. 6a. Figure 6b shows that for this case, the normalized powers at Sum and Carry output ports are more than 85% and less than 5%, respectively. Also, time delay; the time that output of proposed full-adder needs to achive a stable state is about 2.5 ps.

Fig. 6
figure 6

Illustration of a light propagation and b output powers of the proposed full-adder for Case #2

Case #3:

When A = 0, B = 1, and C = 0, the optical signal coming from input port B, travels close to X-PCR1 through WG2 and WG3. Since the optical power is less than 2 W/μm2, the optical signal will be dropped into WG4 and propagates to WG6, it is dropped into WG7 using X-PCR2 and travels toward the Sum output port, thus, we have Sum = 1 and Carry = 0. The light propagation inside the structure is shown in Fig. 7a. Figure 7b shows that for this case, the normalized powers at Sum and Carry are more than 85% and less than 5%, respectively. Also, the time delay is about 2.5 ps.

Fig. 7
figure 7

Illustration of a light propagation and b output powers of the proposed full-adder for Case #3

Case #4:

When A = 0, B = 0, and C = 1, the optical signal coming from input port C, travels close to X-PCR2 through WG5 and WG6. Since the optical power is less than 2 W/μm2, the optical signal will be dropped into WG7 and travels toward the Sum output port; thus, we have Sum = 1 and Carry = 0. The light propagation inside the structure is shown in Fig. 8a. Figure 8b shows that for this case, the normalized powers at Sum and Carry are more than 90% and less than 1%, respectively. Also, time delay is about 2.5 ps.

Fig. 8
figure 8

Illustration of a light propagation and b output powers of the proposed full-adder for Case #4

Case #5:

When A = 1, B = 1, and C = 0, the optical signals coming from input ports A (in WG1), and B (in WG2) are combined at WG3 and form a resultant signal with an optical power of 2 W/μm2. Therefore, X-PCR1 will not drop the optical beam from WG3 into WG4, and it travels toward Carry output port through WG3 and WG8. Indeed there is no optical beam inside WG6 and Sum output port. Thus, in this case, Sum = 0 and Carry = 1. The light propagation inside the structure is shown in Fig. 9a. Figure 9b shows that for this case, the normalized powers at Sum and Carry are more than 130% and less than 1%, respectively. Also, delay time is about 2.5 ps.

Fig. 9
figure 9

Illustration of a light propagation and b output powers of the proposed full-adder for Case #5

Case #6:

When A = 1, B = 0, and C = 1, the optical beam coming from input port A (in WG1), travels close to X-PCR1 through WG3. Since the optical power is less than 2 W/μm2, the optical signal will be dropped into WG4. The optical beam coming from input port C propagates in WG5 and is summed with the signal coming from WG4 at the input of WG6. Then the resultant signal is formed with an optical power of 2 W/μm2. This new signal propagates inside WG6. Since the optical power is 2 W/μm2, the X-PCR2 will not drop the optical beam from WG6 into WG7, and it travels toward Carry output port through WG8. Thus, in this case, we will have Sum = 0 and Carry = 1. The light propagation inside the structure is shown in Fig. 10a. Figure 10b shows that for this case, the normalized powers at Sum and Carry are less than 0.5% and more than 90%, respectively. Also, the delay is about 1.5 ps.

Fig. 10
figure 10

Illustration of a light propagation and b output powers of the proposed full-adder for Case #6

Case #7:

When A = 0, B = 1, and C = 1, the optical beam coming from input port B (in WG2), propagates in the vicinity of the X-PCR1 through WG3. Since the optical power is less than 2 W/μm2, the optical signal is dropped into WG4. Similar to Case #6, the optical beam coming from input port C propagates inside WG5 and is summed with the signal coming from WG4 at the input of WG6. Then the resultant signal is formed with an optical power of 2 W/μm2 and propagates inside WG6 and travels toward Carry output port through WG8. Thus Sum = 0 and Carry = 1. The light propagation inside the structure is shown in Fig. 11a. Figure 11b shows that for this case, the normalized powers at Sum and Carry are less than 0.5% and more than 90%, respectively. Also, the is about 1.5 ps.

Fig. 11
figure 11

Illustration of a light propagation and b output powers of the proposed full-adder for Case #7

Case #8:

When A = 1, B = 1, and C = 1, the optical signals coming from input ports A (in WG1) and B (in WG2) are combined at WG3 and form a resultant signal with an optical power of 2 W/μm2. Therefore, X-PCR1 does not drop the optical beam from WG3 into WG4, and it travels toward Carry output port through WG3 and WG8. The optical signal coming from input port C, travels close to X-PCR2 through WG5 and WG6. Since the optical power is less than 2 W/μm2, the optical signal will be dropped into WG7 and travels toward the Sum output port; thus, we have Sum = 1 and Carry = 1.

The light propagation inside the structure is shown in Fig. 12a. Figure 12b shows that for this case, the normalized powers at Sum and Carry are more than 95% and 130%, respectively. Also, the time delay is about 2.5 ps. The output results of all eight input states are summarized in Table 1, and it shows that the proposed structure is acting as an all-optical full-adder.

Fig. 12
figure 12

Illustration of a light propagation and b output powers of the proposed full-adder for Case #8

Table 1 The outputs of the proposed full-adder for all eight input states

4 Conclusion

In summary, we designed an all-optical full-adder based on nonlinear X-shaped PhC resonators in an area of 663 μm2. The presented structure consisted of eight waveguides (by removing several silicon rods), two nonlinear resonators, three input ports, and two output ports, all in a PhC microstructure composed of silicon rods in a hexagonal lattice. Eight different states for three input ports were simulated and discussed. The numerical results revealed that the proposed structure can be used as an all-optical full-adder with a maximum delay of about 2.5 ps. Thus, it is an appropriate device for high-speed data processing in optical integrated circuits.