1 Introduction

Photonic crystals (PCs) are structures whose refractive indexes are periodic in one, two or three dimensions [1, 2]. These periodic structures cause three types of PCs which includes: 1D, 2D or 3D PCs. Periodicity in the refractive index causes a photonic band gap (PBG) that is the basis of the PCs operation [3, 4]. Recently, PCs have attracted researcher attention because they can be used as light controller and waveguide [59]. Because of the optical communication importance for high-speed data transfer, it is necessary that investigations are done using optical integrated circuits. Optical logic gates are the basis of optical integrated circuits. PCs are proper structures for the optical logic gates and for optical integrated circuits designing. Recently, a lot of attempts are done for the design of optical logic gates based on PCs [1015].

In addition to the design of these optical logic gates, such as NOT, AND, OR, NAND, NOR and XOR, a lot of perusal and studies on the sequential combination of these logic circuits have been done. These attempts lead to the design of optical logic circuits such as demultiplexers and flip-flops and half-adder [1620]. In this paper, the acceptable minimum electric field that can be used as logic “1” is increased.

In the design of the optical logic gates based on PCs, the on input sources are defined as logic “1” and when they are off, the logic “0” will occur. On the other hand, when the input source is active, its electric field magnitude is defined as logic “1.” Thus, in the outputs the electric fields near the source electric field are assumed as logic “1” and if the electric field is close to zero it can be defined as logic “0.” The important operation of logic gates is to control the interval variation between the maximum electric field in “0” state, and minimum in “1” state which is defined as the undefined region, and the probability error in sensing of “1” and “0” will be decreased. The importance of the optical integrated circuits design is that some simple optical logic circuits and logic gates are the basis of the optical integrated circuits. Among these circuits are adders and subtracts. In this paper, we designed an optical half-adder by a good separation ability of logic “0” and “1” in output. To limit and conduct the light in defect lines, the wavelength for simulation should be in PBG range. Thus, the structure is simulated in \(1550\hbox {nm}\).

One of the properties of this half-adder is a distinct difference between logical 0 and 1 levels, and this results in reduction of detection error in output, simple structure and also output level increasing when the HA is in logic 1 state.

2 Principle and analysis

For studying the light propagation in PCs, the Maxwell’s equations were solved. These equations further explained the behavior of light in an environment consisting of two main equations, those of TE and transverse magnetic (TM) polarization. If there are no free charges or currents, also there are no sources of light these equations are [21]:

$$\begin{aligned}&\nabla \times \mathbf{E}=-\frac{\partial B}{\partial t},\quad \nabla . \mathbf{B}=0 \end{aligned}$$
(1)
$$\begin{aligned}&\nabla \times \mathbf{H}=\frac{\partial D}{\partial t},\quad \nabla .\mathbf{D}=0 \end{aligned}$$
(2)
$$\begin{aligned}&{} \mathbf{D}=\varepsilon _0 \varepsilon _r \mathbf{E},\quad \mathbf{B}=\mu _0 \mu _r \mathbf{H} \end{aligned}$$
(3)

Which in the above relationships H and E are magnetic and electric fields, also D and B are the displacement and magnetic induction fields. For most dielectric materials of interest, the relative magnetic permeability \(\upmu _\mathrm{r} \)is close to unity and we may set \(\vec {\hbox {B}}\left( {r,t} \right) = {\mu _0}\vec {\hbox {H}}\left( {r,t} \right) \). In the given relations, \(\varepsilon _\mathrm{r}\) and \(\varepsilon _0 \) are the relative permittivity and vacuum permittivity and \(\mu _0 \) is the vacuum permeability.

For solving the Maxwell’s equations, the answers \(E\left( {r,t} \right) =E\left( r \right) \hbox {e}^{-i\omega t}\) and \(H\left( {r,t} \right) =H\left( r \right) \hbox {e}^{-i\omega t}\) are assumed. As for the photonic band, the gaps are wider for the electric field in PCs, thus TE modes are calculated. Finally, the equation for TM polarization that is obtained by the combination of the proposed answers and the original Maxwell’s equations is as follows [22, 23]:

$$\begin{aligned} \nabla \times \left( {\frac{1}{\varepsilon \left( r \right) }\nabla \times \mathbf{H}\left( r \right) } \right) =\left( {\frac{\omega }{c}} \right) ^{2}{} \mathbf{H}\left( r \right) \end{aligned}$$
(4)

The plane wave expansion (PWE) method is used to obtain the band structure when there is no defect in the structure. The band structure shows the range of frequencies that can be passed or reflected from the structure called the PBG. The frequencies that are reflected from the structure are important and the source frequencies should be in this range [2426].

In calculating the electric field distribution, the finite-difference time-domain (FDTD) method is used [27]. In this simulation, the electric field distribution in the defected lines and that of the transmitted electric field to the output are calculated and depicted for different wavelengths in the PBG range.

3 The proposed structure for optical half-adder

The logical half-adder is a circuit that sums two bits. Figure 1 depicts the operation of the half-adder.

Fig. 1
figure 1

Block diagram (a) and accuracy table (b) of a half-adder

In a half-adder, two input bits are summed and two S and C outputs are generated. The S output is the sum of two inputs and C is the carried output. Figure 1a shows the block diagram and Fig. 1b depicts the accuracy table for half-adder. The proposed structure of the optical half-adder is a photonic crystal waveguide with triangular lattice. The dielectric rods in air with lattice constant of \(a=640\) nm and radius of rod with \(r=0.18a\) are used for this structure.

The PWE is used for obtaining the band structure. Figure 2 shows the normalized band structure for the structure. As mentioned before, the band structure is obtained for the TE mode. The calculated band structure depicts that the main PBG is situated in the range of \(\frac{a}{\lambda }=0.3-0.48\), that the wavelength equivalent of this range is \(\lambda =1.33-2.13\,\upmu \hbox {m}\). The selected wavelength of the sources should be in the PBG range, therefore \(\lambda =1550\) nm is used for this simulation. In this case, the light can be guided in line defects.

Fig. 2
figure 2

Calculated band structure for proposed structure

Fig. 3
figure 3

Develop defects for creating optical half-adder

Fig. 4
figure 4

Electric field distribution for different inputs. a \(A=0, B=1\), b \(A=1, B=0\) and c \(A= B=1\)

4 Simulation results and discussion

To create an optical half-adder, two inputs A and B and two outputs S and C should be created. Where S is the two input summation and C is the carry bit. Two optical sources with 1550 nm wavelength are used as inputs. The defect lines relating the inputs and outputs for creating half-adder are shown in Fig. 3.

The defect lines are selected to intercross each other. The radius of the three rods are reduced to \(0.5 \times r\) in their crossing, where r is other radius of rods. These rods act as scatterers, that can control and conduct electric field in their output routes. When the two input sources are off (\(A=B=0\)) there is no electric field distributions in the outputs, then S and C will be in “0” logical state.

If one input is “0” and the other is “1” (\(A=0,B=1\) or \(A=1,B=0)\), the electric field in output S will be significant but output C will have a low electric field and in this case, the output S will be equal to “1” and C equal to “0” logic. When \(A=B=1\), the condition in output will be inverted. It means that electric field distribution in output S is very low and logic state will be “0.” The output electric field in C output in this case will be significant and its logic state will be “1.” Figure 4 depicts the electric field distribution for different inputs.

Table 1 illustrates the electric field distribution and their equivalent logic for the three different inputs. Table 1 shows that the results of the proposed structure conforms to a half-adder operation.

Table 1 Input and output values for the optical half-adder
Fig. 5
figure 5

Electric field distribution for wavelengths near 1550 nm for different inputs: a \(A=0,B=1\), b \(A=1,B=0\) and c \(A=B=1\)

Fig. 6
figure 6

Electric field distribution for different inputs: a \(A=0,B=1\), b \(A=1,B=0\) and c \(A=B=1\)

Because there exists path loss caused by reflection and propagation of light to the undesired output that is set to logic “0” state, thus the desired output value that must be in logic “1” state is decreased due to these losses. A part of these losses is emerged in output of logic state “0” as shown in the Fig. 5.

In this simulation, the variation of the electric field is calculated and depicted for wavelengths near 1550 nm. The figures of this simulation are shown in Fig. 5.

The results show that for unequal inputs, the outputs are a little different. This difference is because in the structure there is no perfect symmetry for two defect lines.

To reduce the detection error, it is important that in logic state “1,” the output value be near the maximum values of input and also be near the minimum value of input in logic state “0.” In case that \(A = B = 0\), both output are exactly zero and there is not any error. In two cases that \(A = 0, B = 1\) and \(A = 1, B = 0\), it is expected the output in C and S be near to “0” and “1,” respectively. For example, in order to reduce error detection, the low level (zero level) is selected as 0.4 due to C values (0.32 and 0.34). The output values of S are also 0.71 and 0.9 and the value “0.6” can be selected as high level in this case. When \(A = B = 0\), the output value of C that must be set in logic state “1,” is 0.72 and the S value is 0.22 that is near to level zero logically. The proposed optical half-adder can be used in some wavelengths vicinity of 1550 nm.

Fig. 7
figure 7

Electric field distribution for input \(A=0,B=1\) for different \(\Delta n\): a \(\Delta n=2.2\), b \(\Delta n=2.4\) and c \(\Delta n=2.6\)

Fig. 8
figure 8

Electric field distribution for input \(A=1,B=0\) for different \(\Delta n\): a \(n=2.2\), b \(n=2.4\) and c \(n=2.6\)

Fig. 9
figure 9

Electric field distribution for input \(A = B = 1\) for different \(\Delta n\): a \(\Delta n=2.2\), b \(\Delta n=2.4\) and c \(\Delta n=2.6\)

The results in Fig. 6 show that in wavelengths near 1480 nm, the half-adder can work well. But in these wavelengths, the electric field distribution in “1” logic state was a little reduced and the electric field distribution in “0” logic state was increased. In this case, the structure can be used as a half-adder, when the level of electric field for logical “0” and “1” is defined close to each other. But the probability of error increased in this case.

For better performance of half-adder, the S value must be high in case \(A\ne B\) and the value of C must also be in low level. In case \(A=B\), these states are changed inversely. Due to Fig. 6, this structure can be used as HA in wavelength band between 1470 and 1500 nm, and also from 1540 to 1570 nm. It is noticeable that the best performance is when the outputs are high in logic state “1” and are low in state “0” and this occurs in wavelength near 1550 nm.

For perception, the variation of the background and rods refractive index differences, electric field distribution were calculated for three values of \(\Delta n\). Where \(\Delta n\) is the difference of the background and the rods refractive index.

Figure 7 shows the variation of the electric field for three different values of refractive index, when the input is \(A=0~ \hbox {and} B=1\). The results express that the action of the optical half-adder is better in small values of \(\Delta n\). In bigger values of \(\Delta n\), the S output will be reduced and the C output will increase and the operation of the half-adder will be wasted.

Figure 8 depicts the output electric field for three different values of refractive index, when input is \(A=1 ~ \hbox {and} B=0\). Results show that in bigger values of \(\Delta n\), the S output will be reduced and the C output will increase. But the rate of this change is slow and the difference between the outputs are big enough that the operation of the half-adder will be acceptable.

Figure 9 was obtained for inputs \(A = B = 1\). The figure depicts that in all values of \(\Delta n\) the S output is big and C output is small and the structure acts as a half-adder in 1550 nm. But in higher \(\Delta n\) the wavelength bandwidth is larger and the difference between the outputs is bigger. As the input results shows unequal performance, this implies that a better replication occurred for smaller \(\Delta n\). But in this case \(A = B = 1\), although in small \(\Delta n\) the operation of half-adder is well; but in higher \(\Delta n\), the outputs will have desirable answers in higher range of wavelengths. Therefore the structure will have best operation if the interaction between the different refractive indices, wavelength and outputs is made in three entrances. By comparing the previous three images, one can say that at a wavelength of 1550 nm if the difference in refractive index is 2.2, one of the best states for the structure of the half-adder will happen.

5 Conclusion

This work proposed a new structure for all optical half-adder based on photonic crystals. To limit and conduct the light, our approach is to create defect lines and change the radius of some rods. The simulation results showed that the proposed structure can be used as half-adder in wavelengths ranged by 1480–1500 nm and 1540–1570 nm. PWE method is used to calculate the frequency band structure of the proposed lattice and for electric field distribution the FDTD method is applied in waveguide paths. The benefits of the proposed half-adder are distinct difference between logical “0” and “1” levels, its simplicity and small structure.