%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Own Simulations}
\label{sec:Own Simulation}

\begin{frame}
	\frametitle{Design Steps}

	\begin{enumerate}
		\item Determination of operating point of individual stages
		      \begin{itemize}
			      \item SQuad
			      \item TIA
			      \item Buffer
		      \end{itemize}
		\item Integration
		      \begin{itemize}
			      \item SQuad \& TIA
			      \item SQuad, TIA \& Buffer
		      \end{itemize}
		\item Further iterative optimization of parameters (e.g., determine LO power,\\ increase buffer current for linearity, \ldots)
		\item Matching of input and output
	\end{enumerate}
\end{frame}

\begin{frame}
	\frametitle{Operating Point: Switching Quad}

	\begin{minipage}{0.5\textwidth}
		\begin{itemize}
			\item Operation
			      \begin{itemize}
				      \item Responsible for actual mixing
				      \item Multiplication of RF-signal with square wave $\rightarrow$ generation of mixing products at IF-frequency and harmonics
			      \end{itemize}
		\end{itemize}
		\bigskip
		\begin{itemize}
			\item Determination of operating point
			      \begin{itemize}
				      \item Exact value of $V_\text{CE}$ not crucial
				      \item $V_\text{BE}$: Examination of $s_\text{21}$
				            of Large-signal s-parameter simulation and noise figure (analogous to \citereference{Mai+21})
			      \end{itemize}
		\end{itemize}
	\end{minipage}%
	\begin{minipage}{0.5\textwidth}
		\centering
		\begin{figure}[H]
			\vspace*{-5mm}
			\hspace*{15mm}%
			\includegraphics[width=0.83\textwidth]{res/simulation/SQuad_OP_01.pdf}

			\vspace*{-18mm}
			\hspace*{-55mm}%
			\includegraphics[width=0.4\textwidth]{res/simulation/SQuad_OP_02.pdf}
		\end{figure}
	\end{minipage}

	\vspace{4mm}
	\addreference{Mai+21}{T. Maiwald et al., ``A Broadband Zero-IF Down-Conversion Mixer in 130 nm SiGe BiCMOS for Beyond 5G Communication Systems in D-Band'', in \emph{IEEE Transactions on Circuits and Systems II: Express Briefs}, vol. 68, no. 7, pp. 2277-2281, July 2021}
\end{frame}

\begin{frame}
	\frametitle{Operating Point: Switching Quad}

	\vspace*{-2mm}
	\begin{figure}[H]
		\centering

		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.75\textwidth,
						xlabel={$V_\text{BE}\ (\text{V})$},
						ylabel={$\mathit{s_\text{21}}\ (\text{dB})$},
						ytick={-50,-40,...,0,10},
						xtick={0.5,0.6,...,1.2},
						grid,
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=VBE, y=s21]
						{res/simulation/SQuad_OP_s21_vs_VBE.csv};
					\addplot[mark=*] coordinates {(0.8,5.031)} node[pin=-100:{Q}]{} ;
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%
		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.75\textwidth,
						xlabel={$V_\text{BE}\ (\text{V})$},
						ylabel={$\mathit{NF}_\text{dsb}\ (\text{dB})$},
						ytick={0,10,...,60},
						xtick={0.5,0.6,...,1.2},
						grid,
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=VBE, y=NFdsb]
						{res/simulation/SQuad_NFdsb.csv};
					\addplot[mark=*] coordinates {(0.8,8.607)} node[pin=100:{Q}]{} ;
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}
	\end{figure}

	\vspace*{-2mm}
	\begin{itemize}
		\item Plotted for $f_\text{LO}=\SI{135}{GHz}, f_\text{RF}=\SI{140}{GHz}$
		\item Double-sideband noise figure $\mathit{NF}_\text{dsb}$ (direct conversion mixer)
		\item Chosen operating point: $V_\text{BE} = \SI{0.8}{V}$
	\end{itemize}
\end{frame}

\begin{frame}
	\frametitle{Operating Point: Transimpedance Amplifier}

	\begin{minipage}{0.5\textwidth}
		\begin{itemize}
			\item Operation
			      \begin{itemize}
				      \item Conversion of switched current to voltage, amplification
				      \item Modified Cherry-Hooper topology: decoupling of bandwidth and gain, modification for greater dynamic range
			      \end{itemize}
		\end{itemize}
		\bigskip
		\begin{itemize}
			\item Determination of operating point
			      \begin{itemize}
				      \item Exact value of supply voltage not crucial
				      \item S-parameter simulation: Examination of maximum available gain ($\mathit{MAG}$) and minimum noise figure ($\mathit{NF}_\text{min}$)
				      \item At this stage: only determination of operating point of bottom transistors
			      \end{itemize}
		\end{itemize}
	\end{minipage}%
	\begin{minipage}{0.5\textwidth}
		\vspace*{-6mm}

		\begin{figure}[H]
			\centering
			\hspace*{-8mm}
			\includegraphics[width=0.83\textwidth]{res/simulation/TIA_OP_01.pdf}

			\vspace*{-20mm}
			\hspace*{58mm}%
			\includegraphics[width=0.33\textwidth]{res/simulation/TIA_OP_02.pdf}
		\end{figure}
	\end{minipage}
\end{frame}

\begin{frame}
	\frametitle{Operating Point: Transimpedance Amplifier}

	\begin{figure}[H]
		\centering
		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.75\textwidth,
						xlabel={$I_\text{C}\ (\text{mA})$},
						ylabel={$\mathit{MAG}\ (\text{dB})$},
						grid,
						xtick={0,2,...,20},
						ytick={-15, -10, ..., 15},
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=IC, y=MaxGain]
						{res/simulation/TIA_OP_MaxGain_vs_IC.csv};
					\addplot[mark=*] coordinates {(5,15.532)} node[pin=-100:{Q}]{} ;
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%
		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.75\textwidth,
						xlabel={$I_\text{C}\ (\text{mA})$},
						ylabel={$\mathit{NF}_\text{min}\ (\text{dB})$},
						xtick={0,2,...,20},
						ytick={0,2,...,16},
						grid,
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=IC, y=NFmin]
						{res/simulation/TIA_OP_NFmin_vs_IC.csv};
					\addplot[mark=*] coordinates {(5,2.756)} node[pin=100:{Q}]{} ;
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}
	\end{figure}

	\begin{itemize}
		\item Plotted for $f_\text{IF} = \SI{20}{GHz}$
		\item Chosen operating point: $I_\text{C} = \SI{5}{mA}$ (with multiplier of $10$)
	\end{itemize}
\end{frame}

\begin{frame}
	\frametitle{Operating Point: Buffer}

	\begin{minipage}{0.45\textwidth}
		\begin{itemize}
			\item Operation
			      \begin{itemize}
				      \item Amplification of signal
				      \item Comprises three stages: two differential amplifiers and an emitter follower
			      \end{itemize}
		\end{itemize}
		\bigskip
		\begin{itemize}
			\item Determination of operating point
			      \begin{itemize}
				      \item Exact value of supply voltage not crucial at this point
				      \item S-parameter simulation: Examination of $\mathit{MAG}$ and $\mathit{NF}_\text{min}$
				      \item \textbf{Note}: Adjustment with respect to linearity at the very end
			      \end{itemize}
		\end{itemize}
	\end{minipage}%
	\begin{minipage}{0.57\textwidth}
		\vspace*{-5mm}
		\begin{figure}[H]
			\hspace*{2mm}%
			\includegraphics[width=1\textwidth]{res/simulation/Buffer_OP.pdf}
		\end{figure}
	\end{minipage}
\end{frame}

\begin{frame}
	\frametitle{Operating Point: Buffer}

	\begin{figure}
		\centering
		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.75\textwidth,
						xlabel={$I_\text{C}\ (\text{mA})$},
						ylabel={$\mathit{MAG}\ (\text{dB})$},
						grid,
						xtick={0.5,1,...,5},
						ytick={-20, -15, ..., 20},
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=IC, y=MaxGain]
						{res/simulation/Buffer_OP_MaxGain_vs_IC.csv};
					\addplot[mark=*] coordinates {(3,8.231)} node[pin=-100:{Q}]{} ;
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%
		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.75\textwidth,
						xlabel={$I_\text{C}\ (\text{mA})$},
						ylabel={$\mathit{NF}_\text{min}\ (\text{dB})$},
						xtick={0.5,1,...,5},
						ytick={0,2,...,22},
						grid,
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=IC, y=NFmin]
						{res/simulation/Buffer_OP_NFmin_vs_IC.csv};
					\addplot[mark=*] coordinates {(3,3.419)} node[pin=100:{Q}]{} ;
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}
	\end{figure}

	\begin{itemize}
		\item Plotted for $f_\text{IF} = \SI{20}{GHz}$
		\item Chosen operating point: $I_\text{C} = \SI{3}{mA}$
	\end{itemize}
\end{frame}

\begin{frame}
	\frametitle{Integration: SQuad \& TIA}

	\begin{minipage}{0.45\textwidth}
		\begin{itemize}
			\item DC coupling $\rightarrow$ Redesign of bias circuitry
			\item Supply voltage fixed to $\SI{2.5}{\volt}$ to not exceed breakdown voltage of transistors
			\item Examination using Harmonic-Balance simulation:
			      \begin{itemize}
				      \item Conversion gain
				      \item $\SI{1}{dB}$ compression point ($P_{\SI{1}{dB}}$)
			      \end{itemize}
		\end{itemize}
	\end{minipage}%
	\begin{minipage}{0.6\textwidth}
		\vspace*{-38mm}
		\begin{figure}[H]
			\includegraphics[width=0.67\textwidth]{res/simulation/INT_SQuad_TIA_01.pdf}

			\vspace*{-50mm}
			\hspace{-70mm}%
			\includegraphics[width=0.28\textwidth]{res/simulation/INT_SQuad_TIA_02.pdf}

			\vspace*{-20mm}
			\hspace{60mm}%
			\includegraphics[width=0.22\textwidth]{res/simulation/INT_SQuad_TIA_03.pdf}
		\end{figure}
	\end{minipage}
\end{frame}

\begin{frame}
	\frametitle{Integration: SQuad \& TIA}

	\vspace*{-4mm}
	\begin{figure}
		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.5\textwidth,
						ylabel={$P_\text{IF}\ (\text{dBm})$},
						xlabel={$P_\text{LO}\ (\text{dBm})$},
						grid,
						xtick={-50,-40,...,10},
						ytick={-80,-70,...,-20},
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=LOPow, y expr=(\thisrowno{1}-40)]
						{res/simulation/INT_SQuad_TIA_ConvGain_vs_LOPow.csv};
					\addplot[mark=*] coordinates {(-5,-31.031)} node[pin=-100:{OP}]{} ;
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%
		\begin{subfigure}{0.5\textwidth}
			\hspace*{2mm}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.5\textwidth,
						ylabel={Conversion Gain (dB)},
						xlabel={$f_\text{RF}\ (\text{GHz})$},
						xtick={-110,-100,...,170},
						ytick={-10,-8,...,10},
						grid,
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=RFFreq, y=ConvGain]
						{res/simulation/INT_SQuad_TIA_ConvGain_vs_RFFreq.csv};
					\draw[dashed] (axis cs:135, 0) -- (axis cs:135,12);
					\node at (axis cs:147,1.25) {$f_\text{LO} = \SI{135}{GHz}$};
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%

		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.5\textwidth,
						ylabel={$P_\text{IF}\ (\text{dBm})$},
						xlabel={$P_\text{RF}\ (\text{dBm})$},
						xtick={-60,-50,...,20},
						ytick={-60,-50,...,10},
						grid,
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=RFPow, y expr=(\thisrowno{1}-40)]
						{res/simulation/INT_SQuad_TIA_ConvGain_vs_RFPow.csv};
					\addplot[mark=*] coordinates {(-20,-11.927)} node[pin=-80:{$P_{\SI{1}{dB}}$}]{} ;
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%
		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.5\textwidth,
						ylabel={$\mathit{NF}_\text{dsb}\ (\text{dB})$},
						xlabel={$f_\text{IF}\ (\text{GHz})$},
						xtick={0,5,...,30},
						ytick={9.4,9.6,...,10.8},
						grid,
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=f, y=NF]
						{res/simulation/INT_SQuad_TIA_noise.csv};
					\draw[dashed] (axis cs:135, 0) -- (axis cs:135,12);
					\node at (axis cs:147,1.25) {$f_\text{LO} = \SI{135}{GHz}$};
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%
	\end{figure}
\end{frame}

\begin{frame}
	\frametitle{Integration: SQuad, TIA \& Buffer}

	\begin{minipage}{0.6\textwidth}
		\begin{itemize}
			\item DC coupling $\rightarrow$ Redesign of bias circuitry
			\item Supply voltage fixed to $\SI{2.5}{\volt}$
			\item Examination using Harmonic-Balance simulation:
			      \begin{itemize}
				      \item Conversion gain
				      \item $\SI{1}{dB}$ compression point ($P_{\SI{1}{dB}}$)
			      \end{itemize}
		\end{itemize}
	\end{minipage}%
	\begin{minipage}{0.4\textwidth}
		\vspace*{-5mm}
		\begin{figure}[H]
			\includegraphics[width=0.9\textwidth]{res/simulation/INT_Buffer.pdf}
		\end{figure}
	\end{minipage}
\end{frame}

\begin{frame}
	\frametitle{Integration: SQuad, TIA \& Buffer}

	\vspace*{-4mm}
	\begin{figure}
		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.5\textwidth,
						ylabel={$P_\text{IF}\ (\text{dBm})$},
						xlabel={$P_\text{LO}\ (\text{dBm})$},
						grid,
						xtick={-50,-40,...,10},
						ytick={-60,-50,...,0},
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=LOPow, y expr=(\thisrowno{1}-40)]
						{res/simulation/INT_Buffer_ConvGain_vs_LOPow.csv};
					\addplot[mark=*] coordinates {(-5,-2.226)} node[pin=-100:{OP}]{} ;
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%
		\begin{subfigure}{0.5\textwidth}
			\hspace{2mm}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.5\textwidth,
						ylabel={Conversion Gain (dB)},
						xlabel={$f_\text{RF}\ (\text{GHz})$},
						xtick={-110,-100,...,170},
						ytick={20,22,...,40},
						grid,
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=RFFreq, y=ConvGain]
						{res/simulation/INT_Buffer_ConvGain_vs_RFFreq.csv};
					\draw[dashed] (axis cs:135, 30) -- (axis cs:135,40);
					\node at (axis cs:147,33) {$f_\text{LO} = \SI{135}{GHz}$};
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%

		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.5\textwidth,
						ylabel={$P_\text{IF}\ (\text{dBm})$},
						xlabel={$P_\text{RF}\ (\text{dBm})$},
						xtick={-60,-50,...,20},
						ytick={-50,-40,...,10},
						grid,
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=RFPow, y expr=(\thisrowno{1}-40)]
						{res/simulation/INT_Buffer_ConvGain_vs_RFPow.csv};
					\addplot[mark=*] coordinates {(-40,-2.226)} node[pin=-80:{$P_{\SI{1}{dB}}$}]{} ;
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%
		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.5\textwidth,
						ylabel={$\mathit{NF}_\text{dsb}\ (\text{dB})$},
						xlabel={$f_\text{IF}\ (\text{GHz})$},
						xtick={0,5,...,30},
						ytick={9.4,9.6,...,10.8},
						grid,
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=f, y=NF]
						{res/simulation/INT_Buffer_noise.csv};
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%
	\end{figure}
\end{frame}

\begin{frame}
	\frametitle{Final Circuit}

	\begin{figure}[H]
		\centering
		\vspace*{-20mm}
		\hspace{40mm}
		\includegraphics[width=0.7\textwidth]{res/simulation/final_01.pdf}

		\vspace*{-40mm}
		\hspace{-120mm}
		\includegraphics[width=0.2\textwidth]{res/simulation/final_02.pdf}
	\end{figure}
\end{frame}

\begin{frame}
	\frametitle{Final Circuit}

	\vspace*{-4mm}
	\begin{figure}
		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.5\textwidth,
						ylabel={$20 \log_{10}(s_{xy})$ (dB)},
						xlabel={$f (\text{GHz})$},
						legend pos = south east,
                        grid,
					]

					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=f, y=SRF]
						{res/simulation/final_S_RF.csv};
					\addlegendentry{$s_{11}$ (RF)}

					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=f, y=SLO]
						{res/simulation/final_S_LO.csv};
					\addlegendentry{$s_{22}$ (LO)}
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%
		\begin{subfigure}{0.5\textwidth}
			\hspace{2mm}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.5\textwidth,
						ylabel={Conversion Gain (dB)},
						xlabel={$f_\text{RF}\ (\text{GHz})$},
						xtick={-110,-100,...,170},
						ytick={10,15,...,40},
						grid,
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=RFFreq, y=ConvGain]
						{res/simulation/final_ConvGain_vs_RFFreq.csv};
					\draw[dashed] (axis cs:135, 5) -- (axis cs:135,40);
					\node at (axis cs:147,12) {$f_\text{LO} = \SI{135}{GHz}$};
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%

		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.5\textwidth,
						ylabel={$\mathit{NF}_\text{dsb}\ (\text{dB})$},
						xlabel={$f_\text{IF}\ (\text{GHz})$},
						xtick={0,5,...,30},
						ytick={9,9.5,...,11.5},
						grid,
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=f, y=NF]
						{res/simulation/final_noise.csv};
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%
		\begin{subfigure}{0.5\textwidth}
			\begin{tikzpicture}
				\begin{axis}[
						width=\textwidth,
						height=0.5\textwidth,
						ylabel={$P_\text{IF}\ (\text{dBm})$},
						xlabel={$P_\text{RF} / P_\text{LO} \ (\text{dBm})$},
                        legend pos = south west,
                        xtick = {-90,-80,...,10},
                        ytick = {-100,-80,...,0},
						grid,
					]
					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=RFPow, y expr=(\thisrowno{1}-40)]
						{res/simulation/final_ConvGain_vs_RFPow.csv};
                    \addlegendentry{RF}

					\addplot+[mark=none, line width=1pt]
					table[col sep=comma, x=LOPow, y expr=(\thisrowno{1}-40)]
						{res/simulation/final_ConvGain_vs_LOPow.csv};
                    \addlegendentry{LO}
				\end{axis}
			\end{tikzpicture}
		\end{subfigure}%
	\end{figure}
\end{frame}

%\begin{frame}
%	\frametitle{Simulation Setup}
%
%    \begin{figure}[H]
%        \centering
%
%        \includegraphics[width=0.6\textwidth]{res/simulation/schematic.pdf} 
%    \end{figure}
%
%	\begin{itemize}
%		\item [TODO] Simulation schematics
%		\item [TODO] Differences to schematic from paper (if any)
%	\end{itemize}
%\end{frame}
%
%\begin{frame}
%	\frametitle{Design Steps}
%
%	\begin{itemize}
%		\item [TODO] Idea: approach from lecture: first worry about actual circuit, biasing later
%		\item [TODO] Choice of transistors
%		\item [TODO] Choice of operating points
%		\item [TODO] Rest of schematic details (?)
%	\end{itemize}
%\end{frame}
%
%\begin{frame}
%	\frametitle{Simulation Results}
%
%	\begin{itemize}
%		\item [TODO] Simulation results
%		\item [TODO] Intuitive explanation of results
%	\end{itemize}
%\end{frame}
%
%\begin{frame}
%    \frametitle{Comparison with Standard Topology}
%
%    \begin{itemize}
%		\item [TODO] (Remove if not applicable)
%        \item [TODO] Comparison of pros and cons of each topology
%        \item [TODO] Comparison of simulation results
%    \end{itemize}
%\end{frame}
