finished q1b
This commit is contained in:
parent
9c17fcd819
commit
0b1a5bc9e0
99
PS1/doc.tex
Normal file
99
PS1/doc.tex
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
\documentclass{article}
|
||||||
|
|
||||||
|
\usepackage{graphicx}
|
||||||
|
\usepackage{setspace}
|
||||||
|
\usepackage{listings}
|
||||||
|
\usepackage{color}
|
||||||
|
\usepackage{circuitikz}
|
||||||
|
\usepackage{float}
|
||||||
|
|
||||||
|
\definecolor{dkgreen}{rgb}{0,0.6,0}
|
||||||
|
\definecolor{gray}{rgb}{0.5,0.5,0.5}
|
||||||
|
\definecolor{mauve}{rgb}{0.58,0,0.82}
|
||||||
|
|
||||||
|
\lstset{basicstyle=\small,
|
||||||
|
keywordstyle=\color{mauve},
|
||||||
|
identifierstyle=\color{dkgreen},
|
||||||
|
stringstyle=\color{gray},
|
||||||
|
numbers=left
|
||||||
|
}
|
||||||
|
|
||||||
|
\title{ECE 456 - Problem Set 1}
|
||||||
|
\date{2021-02-06}
|
||||||
|
\author{David Lenfesty \\ lenfesty@ualberta.ca
|
||||||
|
\and Phillip Kirwin \\ pkirwin@ualberta.ca}
|
||||||
|
|
||||||
|
\setcounter{tocdepth}{2} % Show subsections
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
|
||||||
|
\doublespacing
|
||||||
|
\pagenumbering{gobble}
|
||||||
|
\maketitle
|
||||||
|
\newpage
|
||||||
|
|
||||||
|
\singlespacing
|
||||||
|
\pagenumbering{arabic}
|
||||||
|
|
||||||
|
\section{Introduction}
|
||||||
|
|
||||||
|
The purpose of this lab was to design control circuits according to the provided
|
||||||
|
specifications, and then verify their operation using a simulation or an FPGA.
|
||||||
|
|
||||||
|
In the first part of the lab, a series of boolean expressions
|
||||||
|
were designed to implement a Multiplexer/Demultiplexer circuit,
|
||||||
|
intended to route data from one of three radio recievers to one
|
||||||
|
of three engineers, and signal which engineer was currently
|
||||||
|
recieving data.
|
||||||
|
First, Xilinx Vivado Software was used to produce a circuit
|
||||||
|
to fulfill this objective. Then, using the same software,
|
||||||
|
the circuit was simulated against input combinations which
|
||||||
|
would be encountered during normal use, for verification.
|
||||||
|
|
||||||
|
For the second part of the lab, an Access Control circuit was to be designed,
|
||||||
|
allowing lab entry only if a valid ID was provided alongside a proper keypad
|
||||||
|
combination. Otherwise, an alarm signal was to be sent out.
|
||||||
|
The method of designing this circuit was very similar to the method in part one:
|
||||||
|
Again using Xilinx Vivado, the circuit was designed and simulated against inputs
|
||||||
|
to verify if the outputs matched those in the specification.
|
||||||
|
However, for this section, the design was also uploaded to a physical FPGA board
|
||||||
|
where various could be manually tested and validated.
|
||||||
|
|
||||||
|
\section{Design Section}
|
||||||
|
|
||||||
|
In order to design the desired systems, the Xilinx Vivado software was
|
||||||
|
used to write VHDL code that described the operation of each circuit.
|
||||||
|
|
||||||
|
\newpage
|
||||||
|
\paragraph{MUX / DEMUX Circuit}
|
||||||
|
To implement the multiplexing/demultiplexing system, the following circuit had to be written in VHDL.
|
||||||
|
|
||||||
|
The VHDL architecture below was written to implement this circuit in hardware.
|
||||||
|
|
||||||
|
\begin{lstlisting}[language=MATLAB]
|
||||||
|
U0 = 0.25;
|
||||||
|
kBT = 0.025;
|
||||||
|
mu = 0;
|
||||||
|
cal_E = 0.2;
|
||||||
|
|
||||||
|
% Capacitance parameters
|
||||||
|
|
||||||
|
alpha_G = 0.5;
|
||||||
|
alpha_D = 0.5;
|
||||||
|
alpha_S = 1 - alpha_G - alpha_D;
|
||||||
|
|
||||||
|
% Energy grid in eV, from -1 eV to 1 eV
|
||||||
|
|
||||||
|
NE = 501;
|
||||||
|
E = linspace(-1,1,NE);
|
||||||
|
dE = E(2) - E(1);
|
||||||
|
|
||||||
|
% Gamma parameters, in eV
|
||||||
|
|
||||||
|
gamma_1 = 0.005;
|
||||||
|
gamma_2 = 0.005;
|
||||||
|
gamma = gamma_1 + gamma_2;
|
||||||
|
\end{lstlisting}
|
||||||
|
\newpage
|
||||||
|
|
||||||
|
\end{document}
|
11
PS1/q1b.m
11
PS1/q1b.m
@ -3,8 +3,8 @@ clear all;
|
|||||||
%% Constants
|
%% Constants
|
||||||
|
|
||||||
% Physical constants
|
% Physical constants
|
||||||
%hbar = 1.052e-34;
|
hbar = 1.052e-34;
|
||||||
%q = 1.602e-19;
|
q = 1.602e-19;
|
||||||
%epsilon_0 = 8.854e-12;
|
%epsilon_0 = 8.854e-12;
|
||||||
%epsilon_r = 4;
|
%epsilon_r = 4;
|
||||||
%mstar = 0.25 * 9.11e-31;
|
%mstar = 0.25 * 9.11e-31;
|
||||||
@ -55,7 +55,8 @@ for n = 1:length(voltages)
|
|||||||
mu_2 = mu - V_D;
|
mu_2 = mu - V_D;
|
||||||
|
|
||||||
% Laplace potential, does not change as solution is found (eV)
|
% Laplace potential, does not change as solution is found (eV)
|
||||||
U_L = - (a_G*V_G - a_D*V_D - a_S*V_S);
|
% q is factored out here, we are working in eV
|
||||||
|
U_L = - (a_G*V_G) - (a_D*V_D) - (a_S*V_S);
|
||||||
|
|
||||||
% Poisson potential must change, assume 0 initially (eV)
|
% Poisson potential must change, assume 0 initially (eV)
|
||||||
U_P = 0;
|
U_P = 0;
|
||||||
@ -78,8 +79,8 @@ for n = 1:length(voltages)
|
|||||||
dU_P = abs(U_P - tmpU_P);
|
dU_P = abs(U_P - tmpU_P);
|
||||||
|
|
||||||
% Unsure why U_P is updated incrementally, perhaps to avoid oscillations?
|
% Unsure why U_P is updated incrementally, perhaps to avoid oscillations?
|
||||||
U_P = tmpU_P;
|
%U_P = tmpU_P;
|
||||||
% U_P = U_P + 0.1 * (tmpU_P - U_P)
|
U_P = U_P + 0.1 * (tmpU_P - U_P)
|
||||||
end
|
end
|
||||||
|
|
||||||
% Calculate current based on solved potential.
|
% Calculate current based on solved potential.
|
||||||
|
128
PS1/test.asv
Normal file
128
PS1/test.asv
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
clear all;
|
||||||
|
|
||||||
|
% Physical constants in MKS units
|
||||||
|
|
||||||
|
hbar = 1.054e-34;
|
||||||
|
6 q = 1.602e-19;
|
||||||
|
|
||||||
|
% Energy parameters in eV; included are the single-electron charging
|
||||||
|
% energy U0; the kBT product; the equilibrium Fermi level mu; and the
|
||||||
|
% energy level cal_E, which is short-form for "calligraphic E"
|
||||||
|
|
||||||
|
% Please especially note that ALL ENERGY VARIABLES IN THIS CODE
|
||||||
|
% ARE IN eV (NOT joules); the equations from class must be adjusted
|
||||||
|
% accordingly, multiplying or dividing appropriate terms by a factor of q
|
||||||
|
|
||||||
|
U0 = 0.25;
|
||||||
|
kBT = 0.025;
|
||||||
|
mu = 0;
|
||||||
|
cal_E = 0.2;
|
||||||
|
|
||||||
|
% Capacitance parameters
|
||||||
|
|
||||||
|
alpha_G = 0.5;
|
||||||
|
alpha_D = 0.5;
|
||||||
|
alpha_S = 1 - alpha_G - alpha_D;
|
||||||
|
|
||||||
|
% Energy grid in eV, from -1 eV to 1 eV
|
||||||
|
|
||||||
|
NE = 501;
|
||||||
|
E = linspace(-1,1,NE);
|
||||||
|
dE = E(2) - E(1);
|
||||||
|
|
||||||
|
% Gamma parameters, in eV
|
||||||
|
|
||||||
|
gamma_1 = 0.005;
|
||||||
|
gamma_2 = 0.005;
|
||||||
|
gamma = gamma_1 + gamma_2;
|
||||||
|
|
||||||
|
% Lorentzian density of states, normalized so that its integral is unity
|
||||||
|
|
||||||
|
D = (gamma/(2*pi))./((E-cal_E).ˆ2+(gamma/2)ˆ2);
|
||||||
|
D = D./(dE*sum(D));
|
||||||
|
|
||||||
|
% Reference number of electrons in the channel, assumed to be zero in
|
||||||
|
% this code
|
||||||
|
|
||||||
|
N0 = 0;
|
||||||
|
|
||||||
|
% Voltage values to consider for the final plots
|
||||||
|
|
||||||
|
NV = 101;
|
||||||
|
VV = linspace(0,1,NV);
|
||||||
|
dV = VV(2) - VV(1);
|
||||||
|
|
||||||
|
% Loop over voltage values and compute number of electrons and current
|
||||||
|
% for each voltage value in a self-consistent manner
|
||||||
|
|
||||||
|
for count = 1:NV
|
||||||
|
|
||||||
|
% Set terminal voltages
|
||||||
|
|
||||||
|
VG = 0;
|
||||||
|
VD = VV(count);
|
||||||
|
VS = 0;
|
||||||
|
|
||||||
|
% Values of mu1 and mu2; notice that the usual factor of q multiplying
|
||||||
|
% the voltages is omitted, because in this code, energy is in eV
|
||||||
|
|
||||||
|
mu1 = mu - VS;
|
||||||
|
mu2 = mu - VD;
|
||||||
|
|
||||||
|
% Value of Laplace potential in eV
|
||||||
|
|
||||||
|
UL = - (alpha_G*VG) - (alpha_D*VD) - (alpha_S*VS);
|
||||||
|
|
||||||
|
% Initial value of Poisson part in eV
|
||||||
|
UP = 0;
|
||||||
|
|
||||||
|
% Iterate until self-consistent potential is achieved by monitoring
|
||||||
|
% the Poisson part (the Laplace part does not change)
|
||||||
|
|
||||||
|
dUP = 1;
|
||||||
|
while dUP > 1e-6
|
||||||
|
|
||||||
|
% Compute source and drain Fermi functions
|
||||||
|
|
||||||
|
f1 = 1./(1+exp((E + UL + UP - mu1)./kBT));
|
||||||
|
f2 = 1./(1+exp((E + UL + UP - mu2)./kBT));
|
||||||
|
|
||||||
|
% Compute number of channel electrons
|
||||||
|
|
||||||
|
N(count) = dE*sum( ((gamma_1/gamma).*f1 + (gamma_2/gamma).*f2).*D );
|
||||||
|
|
||||||
|
% Newly calculated Poisson part of self-consistent potential
|
||||||
|
|
||||||
|
UPnew = U0*( N(count) - N0 );
|
||||||
|
|
||||||
|
% Change in Poisson part between iterations
|
||||||
|
|
||||||
|
dUP = abs(UP - UPnew);
|
||||||
|
|
||||||
|
% New guess for next iteration, found by adding a fraction of the
|
||||||
|
% difference between iterations to the old guess
|
||||||
|
105
|
||||||
|
106 UP = UP + 0.1*(UPnew - UP);
|
||||||
|
107
|
||||||
|
108 end
|
||||||
|
109
|
||||||
|
110 % Compute the current in A after the self-consistent potential
|
||||||
|
111 % has been achieved; notice the extra factor of q preceding the
|
||||||
|
112 % equation, which is needed since the gammas are in eV
|
||||||
|
113
|
||||||
|
114 I(count) = q*(q/hbar)*(gamma_1*gamma_2)/(gamma) ...
|
||||||
|
115 *dE*sum((f1-f2).*D);
|
||||||
|
116
|
||||||
|
117 end
|
||||||
|
118
|
||||||
|
119 % Plotting commands, including lines to modify the linewidth
|
||||||
|
120 % and Fontsize, just to make the plots look nicer; you don’t
|
||||||
|
% need to worry about how these work
|
||||||
|
|
||||||
|
figure(1); h = plot(VV,N,’k’); grid on;
|
||||||
|
set(h,’linewidth’,[2.0]); set(gca,’Fontsize’,[18]);
|
||||||
|
xlabel(’DRAIN VOLTAGE [V]’); ylabel(’NUMBER OF ELECTRONS’);
|
||||||
|
|
||||||
|
figure(2); h = plot(VV,I,’k’); grid on;
|
||||||
|
set(h,’linewidth’,[2.0]); set(gca,’Fontsize’,[18]);
|
||||||
|
xlabel(’DRAIN VOLTAGE [V]’); ylabel(’CURRENT [A]’);
|
127
PS1/test.m
Normal file
127
PS1/test.m
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
clear all;
|
||||||
|
|
||||||
|
% Physical constants in MKS units
|
||||||
|
|
||||||
|
hbar = 1.054e-34;
|
||||||
|
q = 1.602e-19;
|
||||||
|
|
||||||
|
% Energy parameters in eV; included are the single-electron charging
|
||||||
|
% energy U0; the kBT product; the equilibrium Fermi level mu; and the
|
||||||
|
% energy level cal_E, which is short-form for "calligraphic E"
|
||||||
|
|
||||||
|
% Please especially note that ALL ENERGY VARIABLES IN THIS CODE
|
||||||
|
% ARE IN eV (NOT joules); the equations from class must be adjusted
|
||||||
|
% accordingly, multiplying or dividing appropriate terms by a factor of q
|
||||||
|
|
||||||
|
U0 = 0.25;
|
||||||
|
kBT = 0.025;
|
||||||
|
mu = 0;
|
||||||
|
cal_E = 0.2;
|
||||||
|
|
||||||
|
% Capacitance parameters
|
||||||
|
|
||||||
|
alpha_G = 0.5;
|
||||||
|
alpha_D = 0.5;
|
||||||
|
alpha_S = 1 - alpha_G - alpha_D;
|
||||||
|
|
||||||
|
% Energy grid in eV, from -1 eV to 1 eV
|
||||||
|
|
||||||
|
NE = 501;
|
||||||
|
E = linspace(-1,1,NE);
|
||||||
|
dE = E(2) - E(1);
|
||||||
|
|
||||||
|
% Gamma parameters, in eV
|
||||||
|
|
||||||
|
gamma_1 = 0.005;
|
||||||
|
gamma_2 = 0.005;
|
||||||
|
gamma = gamma_1 + gamma_2;
|
||||||
|
|
||||||
|
% Lorentzian density of states, normalized so that its integral is unity
|
||||||
|
|
||||||
|
D = (gamma/(2*pi))./((E-cal_E).^2+(gamma/2)^2);
|
||||||
|
D = D./(dE*sum(D));
|
||||||
|
|
||||||
|
% Reference number of electrons in the channel, assumed to be zero in
|
||||||
|
% this code
|
||||||
|
|
||||||
|
N0 = 0;
|
||||||
|
|
||||||
|
% Voltage values to consider for the final plots
|
||||||
|
|
||||||
|
NV = 101;
|
||||||
|
VV = linspace(0,1,NV);
|
||||||
|
dV = VV(2) - VV(1);
|
||||||
|
|
||||||
|
% Loop over voltage values and compute number of electrons and current
|
||||||
|
% for each voltage value in a self-consistent manner
|
||||||
|
|
||||||
|
for count = 1:NV
|
||||||
|
|
||||||
|
% Set terminal voltages
|
||||||
|
|
||||||
|
VG = 0;
|
||||||
|
VD = VV(count);
|
||||||
|
VS = 0;
|
||||||
|
|
||||||
|
% Values of mu1 and mu2; notice that the usual factor of q multiplying
|
||||||
|
% the voltages is omitted, because in this code, energy is in eV
|
||||||
|
|
||||||
|
mu1 = mu - VS;
|
||||||
|
mu2 = mu - VD;
|
||||||
|
|
||||||
|
% Value of Laplace potential in eV
|
||||||
|
|
||||||
|
UL = - (alpha_G*VG) - (alpha_D*VD) - (alpha_S*VS);
|
||||||
|
|
||||||
|
% Initial value of Poisson part in eV
|
||||||
|
UP = 0;
|
||||||
|
|
||||||
|
% Iterate until self-consistent potential is achieved by monitoring
|
||||||
|
% the Poisson part (the Laplace part does not change)
|
||||||
|
|
||||||
|
dUP = 1;
|
||||||
|
while dUP > 1e-6
|
||||||
|
|
||||||
|
% Compute source and drain Fermi functions
|
||||||
|
|
||||||
|
f1 = 1./(1+exp((E + UL + UP - mu1)./kBT));
|
||||||
|
f2 = 1./(1+exp((E + UL + UP - mu2)./kBT));
|
||||||
|
|
||||||
|
% Compute number of channel electrons
|
||||||
|
|
||||||
|
N(count) = dE*sum( ((gamma_1/gamma).*f1 + (gamma_2/gamma).*f2).*D );
|
||||||
|
|
||||||
|
% Newly calculated Poisson part of self-consistent potential
|
||||||
|
|
||||||
|
UPnew = U0*( N(count) - N0 );
|
||||||
|
|
||||||
|
% Change in Poisson part between iterations
|
||||||
|
|
||||||
|
dUP = abs(UP - UPnew);
|
||||||
|
|
||||||
|
%New guess for next iteration, found by adding a fraction of the
|
||||||
|
%difference between iterations to the old guess
|
||||||
|
|
||||||
|
UP = UP + 0.1*(UPnew - UP);
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
% Compute the current in A after the self-consistent potential
|
||||||
|
% has been achieved; notice the extra factor of q preceding the
|
||||||
|
% equation, which is needed since the gammas are in eV
|
||||||
|
|
||||||
|
I(count) = q*(q/hbar)*(gamma_1*gamma_2)/(gamma)*dE*sum((f1-f2).*D);
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
% Plotting commands, including lines to modify the linewidth
|
||||||
|
% and Fontsize, just to make the plots look nicer; you don’t
|
||||||
|
% need to worry about how these work
|
||||||
|
|
||||||
|
figure(1); h = plot(VV,N,'k'); grid on;
|
||||||
|
set(h,'linewidth',[2.0]); set(gca,'Fontsize',[18]);
|
||||||
|
xlabel('DRAIN VOLTAGE [V]'); ylabel('NUMBER OF ELECTRONS');
|
||||||
|
|
||||||
|
figure(2); h = plot(VV,I,'k'); grid on;
|
||||||
|
set(h,'linewidth',[2.0]); set(gca,'Fontsize',[18]);
|
||||||
|
xlabel('DRAIN VOLTAGE [V]'); ylabel('CURRENT [A]');
|
Loading…
Reference in New Issue
Block a user