Experiment No. 4 Objectives: All All

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

EXPERIMENT NO.

4
Objectives
Design of All Optical NOT, XOR/XNOR logic gates using the Micro-ring resonator
structures.
MATLAB CODE of OPTICAL NOT LOGIC GATE
clc;
clear all;
close all;
k1 = 0.25;
k2 = 0.25;
alpha = 0.0005.*10.^(-6);
Aeff = 0.25.*10.^(-12);
lembda = 1.55.*10.^(-9);
gamma = 0.0005;
R = 7.08.*10.^(-6);
n0 = abs(.00000020 + 0.000174i);
n2 =-abs(-6.9998e-016 -4.3554e-015i);
L = 2.*pi.*R;
D = sqrt(1-gamma);
x = D.*exp(-alpha.*L./4);
% Generation of continuous wave signal;
t = (-10:0.001:10).*10.^(-12);
z = (-10:0.001:10).*10.^(-12);
T0 = 1e-12;
%L = 2.*pi.*5.81e-6;
c = 3e-8;
T = t;
w = ((2.*pi)./T);
LD = 500.81e-6;
w0 = (2*pi./T0);
alpha = 0.08;
% ****************************** 0
*******************************************
x0 = sech(100.*T./T0).*exp((z));
X1 = sech(100.*T./T0).*exp((z));
X2 = zeros(1,20001);
neff1 = n0 + n2.*(((abs(X2)))./Aeff);
kn1 = ((2.*pi)./lembda).*neff1;
phi1 = (kn1.*L)./2;
et = (((D.*sqrt(1-k1)) - (D.*sqrt(1-
k2).*(x.^2).*(exp(j.*phi1).^2)))./(1-(sqrt(1-k1).*sqrt(1-
k2).*(x.^2).*(exp(j.*phi1).^2)))).*x0;
ed = ((-D.*sqrt(k1.*k2).*exp(j.*phi1))./(1-(sqrt(1-
k1).*sqrt(1-k2).*(x.^2).*(exp(j.*phi1).^2)))).*x0;
subplot(3,2,1);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (pico-second)');
ylabel('Input logic (X)');
axis([0 2 0 1]);
subplot(3,2,3);
plot(T./10.^(-12) + 1,abs(et));
xlabel('Time (pico-second)');
ylabel('Output at through port');
axis([0 2 0 1]);
subplot(3,2,5);
plot(T./10.^(-12) + 1,abs(ed));
xlabel('Time (pico-second)');
ylabel('Output at drop port');
axis([0 2 0 1]);
% *************************** 1
***********************
x0 = sech(100.*T./T0).*exp((z));
X1 = sech(100.*T./T0).*exp((z));
X2 = zeros(1,20001);
neff1 = n0 + n2.*(((abs(X1)))./Aeff);
kn1 = ((2.*pi)./lembda).*neff1;
phi1 = (kn1.*L)./2;
et = (((D.*sqrt(1-k1)) - (D.*sqrt(1-
k2).*(x.^2).*(exp(j.*phi1).^2)))./(1-(sqrt(1-k1).*sqrt(1-
k2).*(x.^2).*(exp(j.*phi1).^2)))).*x0;
ed = ((-D.*sqrt(k1.*k2).*exp(j.*phi1))./(1-(sqrt(1-
k1).*sqrt(1-k2).*(x.^2).*(exp(j.*phi1).^2)))).*x0;
subplot(3,2,2);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (pico-second)');
ylabel('Input logic (X)');
axis([0 2 0 1]);
subplot(3,2,4);
plot(T./10.^(-12) + 1,abs(et));
xlabel('Time (pico-second)');
ylabel('Output at through port');
axis([0 2 0 1]);
subplot(3,2,6);
plot(T./10.^(-12) + 1,abs(ed));
xlabel('Time (pico-second)');
ylabel('Output at drop port');
axis([0 2 0 1]);
Fig. 1: Switching activity of the Micro-ring resonator structures

MATLAB CODE OF EXOR/EXNOR LOGIC GATE


clc;
clear all;
close all;
k1 = 0.25;
k2 = 0.25;
alpha = 0.0005.*10.^(6);
Aeff = 0.25.*10.^(-12);
lembda = 1.55.*10.^(-6);
gamma = 0.005;
R = 7.08.*10.^(-6);
n0 = abs(.00000017 + 0.0174i);
n2 =-abs(-6.9998e-016 -4.3554e-015i);
L = 2.*pi.*R;
D = sqrt(1-gamma);
x = D.*exp(-alpha.*L./4);
% Generation of continuous wave signal;
t = (-10:0.01:10).*10.^(-12);
z = (-10:0.01:10).*10.^(-12);
T0 = 1e-12;
L = 2.*pi.*5.81e-6;
c = 3e-8;
T = t;
w = ((2.*pi)./T);
LD = 500.81e-6;
w0 = (2*pi./T0);
alpha = 0.08;
%
*********************************************************
****************
x0 = sech(100.*T./T0).*exp((z));
X1 = sech(100.*T./T0).*exp((z));
X2 = zeros(1,2001);
neff1 = n0 + n2.*(((abs(X2)))./Aeff);
neff2 = n0 + n2.*(abs(X2)./Aeff);
kn1 = ((2.*pi)./lembda).*neff1;
kn2 = ((2.*pi)./lembda).*neff2;
phi1 = (kn1.*L)./2;
phi2 = (kn2.*L)./2;
% First stage calculation
et1 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
ed1 = (-sqrt(k1.*k2).*D.*exp(j.*phi1)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
% Second stage
exor = ((-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*et1) +
((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
exnor = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*et1 + ((-
sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1)
subplot(4,4,1);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (pico-second)');
ylabel('Input logic (A = 0)');
axis([0 2 0 1]);
subplot(4,4,5);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (pico-second)');
ylabel('Input logic (B= 0)');
axis([0 2 0 1]);
subplot(4,4,9);
plot(T./10.^(-12) + 1,abs(exor));
xlabel('Time (pico-second)');
ylabel('Ouput A xor B');
axis([0 2 0 1]);
subplot(4,4,13);
plot(T./10.^(-12) + 1,abs(exnor));
xlabel('Time (pico-second)');
ylabel('Ouput A xnor B');
axis([0 2 0 1]);
%
*********************************************************
****************
x0 = sech(100.*T./T0).*exp((z));
X1 = sech(100.*T./T0).*exp((z));
X2 = zeros(1,2001);
neff1 = n0 + n2.*(((abs(X2)))./Aeff);
neff2 = n0 + n2.*(abs(X1)./Aeff);
kn1 = ((2.*pi)./lembda).*neff1;
kn2 = ((2.*pi)./lembda).*neff2;
phi1 = (kn1.*L)./2;
phi2 = (kn2.*L)./2;
% First stage calculation
et1 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
ed1 = (-sqrt(k1.*k2).*D.*exp(j.*phi1)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
% Second stage
exor = ((-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*et1) +
((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
exnor = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*et1 + ((-
sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1)
subplot(4,4,2);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (pico-second)');
ylabel('Input logic (A = 0)');
axis([0 2 0 1]);
subplot(4,4,6);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (pico-second)');
ylabel('Input logic (B = 1)');
axis([0 2 0 1]);
subplot(4,4,10);
plot(T./10.^(-12) + 1,abs(exor));
xlabel('Time (pico-second)');
ylabel('Ouput A xor B');
axis([0 2 0 1]);
subplot(4,4,14);
plot(T./10.^(-12) + 1,abs(exnor));
xlabel('Time (pico-second)');
ylabel('Ouput A xnor B');
axis([0 2 0 1]);
%
*********************************************************
****************
x0 = sech(100.*T./T0).*exp((z));
X1 = sech(100.*T./T0).*exp((z));
X2 = zeros(1,2001);
neff1 = n0 + n2.*(((abs(X1)))./Aeff);
neff2 = n0 + n2.*(abs(X2)./Aeff);
kn1 = ((2.*pi)./lembda).*neff1;
kn2 = ((2.*pi)./lembda).*neff2;
phi1 = (kn1.*L)./2;
phi2 = (kn2.*L)./2;
% First stage calculation
et1 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
ed1 = (-sqrt(k1.*k2).*D.*exp(j.*phi1)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
% Second stage
exor = ((-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*et1) +
((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
exnor = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*et1 + ((-
sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1)
subplot(4,4,3);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (pico-second)');
ylabel('Input logic (A = 1)');
axis([0 2 0 1]);
subplot(4,4,7);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (pico-second)');
ylabel('Input logic (B = 0)');
axis([0 2 0 1]);
subplot(4,4,11);
plot(T./10.^(-12) + 1,abs(exor));
xlabel('Time (pico-second)');
ylabel('Ouput A xor B');
axis([0 2 0 1]);
subplot(4,4,15);
plot(T./10.^(-12) + 1,abs(exnor));
xlabel('Time (pico-second)');
ylabel('Ouput A xnor B');
axis([0 2 0 1]);
% ***************************************************
x0 = sech(100.*T./T0).*exp((z));
X1 = sech(100.*T./T0).*exp((z));
X2 = zeros(1,2001);
neff1 = n0 + n2.*(((abs(X1)))./Aeff);
neff2 = n0 + n2.*(abs(X1)./Aeff);
kn1 = ((2.*pi)./lembda).*neff1;
kn2 = ((2.*pi)./lembda).*neff2;
phi1 = (kn1.*L)./2;
phi2 = (kn2.*L)./2;
% First stage calculation
et1 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
ed1 = (-sqrt(k1.*k2).*D.*exp(j.*phi1)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
% Second stage
exor = ((-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*et1) +
((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
exnor = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*et1 + ((-
sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1)
subplot(4,4,4);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (pico-second)');
ylabel('Input logic (A = 1)');
axis([0 2 0 1]);
subplot(4,4,8);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (pico-second)');
ylabel('Input logic (B = 1)');
axis([0 2 0 1]);
subplot(4,4,12);
plot(T./10.^(-12) + 1,abs(exor));
xlabel('Time (pico-second)');
ylabel('Ouput A xor B');
axis([0 2 0 1]);
subplot(4,4,16);
plot(T./10.^(-12) + 1,abs(exnor));
xlabel('Time (pico-second)');
ylabel('Ouput A xnor B');
axis([0 2 0 1])

Figure 2: Simulated waveform of proposed all-optical XOR/XNOR gate using micro-ring


resonator

You might also like