In this paper, in a unique work, the structure of NOT / XOR multifunctional all-optical logic gates is provided using interference effects in 2D photonic crystal structures for use in photonic integrated circuits of next generation. The applicability of the structure has been analyzed by modifying the output waveguide to optimize it and finally examining its performance by placing several structures together for using in optical integrated circuits. In both basic and optimized structures, the contrast ratio, response time, and data transfer rate were measured 36 dB, 0.176 ps and 5.68 Tbit/s, respectively. Appropriate output results along the very small size of about 75.78 µm2, these circuits make the logic very proper for use in optical integrated circuits. For this purpose, in a more complete work, an all-optimal 4×2 Encoder has been designed using optimized structure. In this structure, the contrast ratio is about 13.2 dB, the response time is 0.168 ps and the data transfer rate is 6 Tbit/s. The results of this NOT/XOR basic and optimized all-optical logic gate structure as well as 4×2 Encoder indicate the high flexibility and applicability of these designs for use in structures in this field for use in optical integrated circuits. In this paper, the Plane Wave Expansion method is used to obtain and analyze the photonic band gap range and the Finite-difference time-domain is used to analyze and simulate the designed structures.