#LyX 2.0 created this file. For more info see http://www.lyx.org/
\lyxformat 413
\begin_document
\begin_header
\textclass scrartcl
\use_default_options true
\begin_modules
theorems-ams
\end_modules
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\float_placement h
\paperfontsize default
\spacing single
\use_hyperref true
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks false
\pdf_pdfborder false
\pdf_colorlinks false
\pdf_backref false
\pdf_pdfusetitle true
\papersize default
\use_geometry false
\use_amsmath 1
\use_esint 1
\use_mhchem 1
\use_mathdots 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation skip
\defskip smallskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Title
ACT
\end_layout

\begin_layout Subtitle
ADC Characterization Toolkit
\end_layout

\begin_layout Author
Federico Asara
\begin_inset Newline newline
\end_inset

Juan David Gonzalez Cobas
\end_layout

\begin_layout Abstract
In this document I will provide a brief introduction to ADCs and their performan
ce parameters, along with the procedures to calculate them.
 I will focus on single and two tone performances parameters.
\end_layout

\begin_layout Abstract
Then I will present you ACT, the ADC Characterization Toolkit, a Python-powered
 application which allows you to evaluate the performances of an ADC in
 different ways.
 Using the self-developed PAGE (Python ADCs and GEnerators) API, ACT can
 control waveform generators and ADCs simultaneously and gather a large
 number of parameters.
 
\end_layout

\begin_layout Section
Brief introduction to ADCs
\end_layout

\begin_layout Standard
Analog-to-digital converters, in short ADCs, are electronic devices which
 translate analog quantities in digital numbers.
 Usually analog input variables are converted by transducers into voltages
 or currents.
 An ADC is defined by three parameters:
\end_layout

\begin_layout Description
N the number of bits used to store each sample;
\end_layout

\begin_layout Description
FSR Full Scale Range, range of the analog values that can be represented
 by the device;
\end_layout

\begin_layout Description
LSB Least Significant Bit, is the minimum change in the input that guarantees
 a change in the output, defined as 
\begin_inset Formula 
\begin{equation}
LSB=\frac{FSR}{2^{N}}\label{eq:LSBdef}
\end{equation}

\end_inset


\end_layout

\begin_layout Standard
The transfer function of an ADC shows the relation between the input and
 the output, and also shows the quantization error generated by the conversion.
 A transfer function of an ideal ADC is show in 
\begin_inset CommandInset ref
LatexCommand formatted
reference "fig:Ideal-ADC-transfer"

\end_inset

.
\end_layout

\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open

\begin_layout Plain Layout
\noindent
\align center
\begin_inset Graphics
	filename images/adc_ideal.png

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Ideal-ADC-transfer"

\end_inset

Ideal ADC transfer function
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Subsection
Parameters explained
\end_layout

\begin_layout Standard
DNL stands for Differential Non Linearity, and it is defined as the difference
 between an actual step width of the transfer function and the LSB.
 An ideal ADC will thus have 
\begin_inset Formula 
\[
DNL_{i}=0\quad\forall i
\]

\end_inset

since every step is exactly 1 LSB.
 The DNL is defined as follow:
\begin_inset Formula 
\[
DNL_{i}=\frac{f(V_{x+1})-f(V_{x})}{LSB}-1\quad i\in]0,2^{N}-2[
\]

\end_inset

 
\end_layout

\begin_layout Remark
If the DNL respect the following condition:
\begin_inset Formula 
\[
DNL_{i}\leq1\, LSB\quad\forall i
\]

\end_inset


\end_layout

\begin_layout Remark
then the transfer function 
\begin_inset Formula $f(x)$
\end_inset

 is monotonic, with no missing codes.
\end_layout

\begin_layout Standard
INL, Integral Non Linearity, is described as the deviation, in LSB or as
 a FSR percentage, of an actual transfer function from a straight line.
 The INL error magnitude depends directly on the position chosen for this
 straight line.
 The theoretical formula of measuring INL is the following:
\begin_inset Formula 
\[
INL=\left|\frac{f(V_{x})-f(V_{0})}{LSB}-x\right|\quad i\in]0,2^{N}-1[
\]

\end_inset


\end_layout

\begin_layout Standard
The SNR, Signal to Noise Ratio, show how much a signal has been corrupted
 by noise.
 The theoretical value of the SNR is defined as follows:
\begin_inset Formula 
\[
SNR_{th}=6.02*N+1.76\quad[dB]
\]

\end_inset


\end_layout

\begin_layout Standard
The THD, Total Harmonic Distortion, is defined as the ratio of the signal
 to the RSS of a specified number of harmonics of the fundamental signal.
 IEEE Std.
 1241-2000 suggests to use the first 10 harmonics.
 A THD rating < 1% is desired.
 
\begin_inset Formula 
\[
THD_{n}=10\log\left(\sum_{i=2}^{n}10^{\left[\frac{h_{i}}{20}\right]^{2}}\right)
\]

\end_inset


\end_layout

\begin_layout Standard
where 
\begin_inset Formula $h_{i}$
\end_inset

 is the i-th harmonic expressed in dB.
 
\end_layout

\begin_layout Section
Parameters evaluation formulae and algorithms 
\end_layout

\begin_layout Subsection
Incoherent sampling
\end_layout

\begin_layout Standard
The biggest 
\emph on
problem
\emph default
 we have to account for when evaluating performances of an ADC is incoherent
 sampling: a sampling is incoherent if
\begin_inset Formula 
\[
\frac{f_{s}}{f_{0}}\notin\mathbb{N}
\]

\end_inset


\end_layout

\begin_layout Standard
Incoherency in sampling will produce the so-called spectral leakage; 
\begin_inset CommandInset ref
LatexCommand formatted
reference "fig:spectral_leakage"

\end_inset

 shows how an incoherently sampled sine-wave suffers from spectral leakage:
\begin_inset Note Note
status collapsed

\begin_layout Plain Layout
http://gaussianwaves.blogspot.com/2011/01/fft-and-spectral-leakage.html
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open

\begin_layout Plain Layout
\begin_inset Graphics
	filename images/sineWave_FFT_spectral_leakage.png
	width 100text%

\end_inset


\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:spectral_leakage"

\end_inset

Spectral leakage of an incoherently sampled sine-wave
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
Since it interferes with all our formulae, we must find a way to 
\emph on
artificially remove
\emph default
 it.
 The best way so far only works assuming that we have a single tone signal
 
\begin_inset Formula $x[n]$
\end_inset

.
 
\end_layout

\begin_layout Standard
First of all we compute the DFT:
\begin_inset Formula 
\[
X[f]=DFT\left\{ x[n]\right\} 
\]

\end_inset

and then we compute:
\begin_inset Formula 
\begin{equation}
\alpha_{1}=\arg\max\left|X[f]\right|\label{eq:alpha1}
\end{equation}

\end_inset

and:
\begin_inset Formula 
\begin{equation}
\alpha_{2}=\begin{cases}
\alpha_{1}+1 & \left|X[\alpha_{1}+1]\right|\geq\left|X[\alpha_{1}-1]\right|\\
\alpha_{1}-1 & otherwise
\end{cases}\label{eq:alpha2}
\end{equation}

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Formula $\alpha_{1}$
\end_inset

 is the index of the highest peak in 
\begin_inset Formula $\left|X[f]\right|$
\end_inset

, and 
\begin_inset Formula $\alpha_{2}$
\end_inset

 is its follower.
 From these values we can compute the strength of the incoherency:
\begin_inset Formula 
\begin{equation}
\beta=\frac{M}{\pi}\arctan\left(\frac{\sin\frac{\pi}{M}}{\cos\frac{\pi}{M}+\frac{X[\alpha_{1}]}{X[\alpha_{2}]}}\right)\label{eq:beta}
\end{equation}

\end_inset


\end_layout

\begin_layout Standard
The peak lies between 
\begin_inset Formula $\alpha_{1}$
\end_inset

 and 
\begin_inset Formula $\alpha_{2}$
\end_inset

:
\begin_inset Formula 
\begin{equation}
\alpha=\alpha_{1}+\beta\label{eq:alpha}
\end{equation}

\end_inset


\end_layout

\begin_layout Standard
We can then use 
\begin_inset Formula $\alpha$
\end_inset

 as the initial frequency guess for the sinefit4 algorithm, obtaining 
\begin_inset Formula $\bar{\omega_{0}}$
\end_inset

.
 Then:
\begin_inset Formula 
\begin{equation}
\alpha_{0}=\frac{\bar{\omega_{0}}}{\omega_{s}}M\label{eq:alpha0}
\end{equation}

\end_inset

is an improvement over 
\begin_inset Formula $\alpha$
\end_inset

.
 We can then use this to trim 
\begin_inset Formula $x[n]$
\end_inset

:
\begin_inset Formula 
\begin{equation}
x_{c}[n]=x[n]\quad\forall n=0..i\label{eq:trim}
\end{equation}

\end_inset

where:
\begin_inset Formula 
\[
i=\left\lfloor 0.5+M\frac{\left\lfloor \alpha_{0}\right\rfloor }{\alpha_{0}}\right\rfloor 
\]

\end_inset


\end_layout

\begin_layout Standard
We can use 
\begin_inset Formula $x_{c}[n]$
\end_inset

 to compute all the other parameters; from now on we will refer to 
\begin_inset Formula $x[n]$
\end_inset

 as a coherently sampled signal, unless otherwise specified.
\end_layout

\begin_layout Subsection
Histograms
\end_layout

\begin_layout Standard
In order to compute DNL and INL in a fast way for a given signal we generate
 two histograms that count the frequency of all the possible value the ADC
 can output.
 The 
\series bold
real histogram
\series default
 uses the data read from the signal, the 
\series bold
ideal histogram
\series default
 uses simulated data for the same signal supposing we have a perfect ADC.
 The signal used in this case is a sinusoid.
\end_layout

\begin_layout Standard
The histogram should theoretically have 
\begin_inset Formula $R_{t}=2^{N}$
\end_inset

 bars: for high N values, however, we will have to many bins, slowing down
 the computation.
 We fix a resolution limit 
\begin_inset Formula $R_{l}$
\end_inset

 such that we have:
\begin_inset Formula 
\begin{equation}
R=\min\text{\left(R_{l},R_{t}\right)}\label{eq:histres}
\end{equation}

\end_inset


\end_layout

\begin_layout Standard
A good value of 
\begin_inset Formula $R_{l}$
\end_inset

 could easily be 256 or 512, and it should preferably be a power of two.
\end_layout

\begin_layout Subsubsection
Ideal histogram generation
\end_layout

\begin_layout Standard
To generate the ideal histogram we need few information:
\end_layout

\begin_layout Itemize
the resolution 
\begin_inset Formula $R$
\end_inset


\end_layout

\begin_layout Itemize
the number of samples M
\end_layout

\begin_layout Itemize
the first and last values of the signal, 
\begin_inset Formula $x[0]$
\end_inset

 and 
\begin_inset Formula $x[M-1]$
\end_inset


\end_layout

\begin_layout Standard
We can then evaluate:
\begin_inset Formula 
\[
\phi=\sin\left(\frac{\pi}{2}\frac{M}{M+x[0]+x[M-1]}\right)
\]

\end_inset


\end_layout

\begin_layout Standard
which will keep the ideal sinusoid we are simulating just below the full
 scale.
 We can then define the value of each bar:
\begin_inset Formula 
\[
h_{i}[n]=\frac{M}{\pi}\left(\arcsin\frac{n-\frac{R}{2}}{\frac{R}{2}}-\arcsin\frac{n-1-\frac{R}{2}}{\frac{R}{2}}\right)\quad\forall n\in[0,\, R-1]
\]

\end_inset


\end_layout

\begin_layout Subsubsection
Real histogram generation
\end_layout

\begin_layout Standard
To generate the real histogram
\begin_inset Formula 
\[
h_{r}[n]\quad\forall n\in[0,\, R-1]
\]

\end_inset

no particular method is needed.
 For example, 
\emph on
numpy 
\emph default
provides the 
\emph on
hist
\emph default
 function, that calculate an histogram of an array with a given number of
 bins.
 
\end_layout

\begin_layout Subsection
Non linearities
\end_layout

\begin_layout Standard
We use histograms when evaluating DNL and INL in order to speed up the calculati
on.
\end_layout

\begin_layout Subsubsection
DNL
\end_layout

\begin_layout Standard
We can easily compute an histogram of the DNL provided we have the ideal
 and real histograms:
\begin_inset Formula 
\[
DNL[n]=\frac{H_{r}[n]}{H_{i}[n]}-1
\]

\end_inset


\end_layout

\begin_layout Subsubsection
INL
\end_layout

\begin_layout Standard
The INL is evaluated from the DNL:
\begin_inset Formula 
\[
INL[n]=\sum_{i=0}^{n}DNL[i]
\]

\end_inset


\end_layout

\begin_layout Subsubsection
IMD: InterModulation Distortion
\end_layout

\begin_layout Standard
When an ADC read a signal composed by two sinewaves with close frequencies
 a particular kind of distortion might be observed.
 
\end_layout

\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open

\begin_layout Plain Layout
\noindent
\align center
\begin_inset Graphics
	filename images/imd1.png

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
IMD explained
\begin_inset Note Note
status open

\begin_layout Plain Layout
http://en.wikipedia.org/wiki/File:RF_Intermodulation_at_280_MHz.jpg
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Plain Layout

\end_layout

\end_inset


\end_layout

\begin_layout Standard
Intermodulation or intermodulation distortion (IMD) is the unwanted amplitude
 modulation of signals containing two or more different frequencies in a
 system with nonlinearities.
 The distortion introduced is very close to the meaningful signal, therefore
 is difficult to eliminate it with a passband filter.
\end_layout

\begin_layout Standard
ACT calculate IMD in a very easy way.
 It first detect the frequencies of the two sinusoids, using a modified
 version of sinefit4, and then:
\begin_inset Formula 
\[
\Delta=\left|\omega_{2}-\omega_{1}\right|
\]

\end_inset

Therefore:
\begin_inset Formula 
\begin{eqnarray*}
i_{lower} & = & \min\left(\omega_{1},\omega_{2}\right)-\Delta\\
i_{upper} & = & \max\left(\omega_{1},\omega_{2}\right)+\Delta
\end{eqnarray*}

\end_inset


\end_layout

\begin_layout Standard
Let's define 
\begin_inset Formula $I_{lower}$
\end_inset

 and 
\begin_inset Formula $I_{upper}$
\end_inset

 as the maximum value of the FFT close to 
\begin_inset Formula $i_{lower}$
\end_inset

 and 
\begin_inset Formula $i_{upper}$
\end_inset

.
 Finally, assuming that 
\begin_inset Formula $P_{m}$
\end_inset

 is the power of the meaningful signal, the IMD is:
\begin_inset Formula 
\[
IMD=20\log\left(\frac{P_{m}}{\sqrt{I_{lower}^{2}+I_{upper}^{2}}}\right)
\]

\end_inset

and it's measured in dBc.
\end_layout

\begin_layout Subsection
Sinusoidal wave frequency detection
\end_layout

\begin_layout Standard
In order to compute the SNR of a single tone signal, we need to know the
 wave's parameters.
 IEEE proposes two different ways to solve this problem, whether we know
 or not the wave's frequency.
\end_layout

\begin_layout Standard
A wave can represented as a superposition of two waves and a constant term,
 using five parameters:
\begin_inset Formula 
\[
A\cos\left(\omega_{0}t+\theta\right)+B\sin\left(\omega_{0}t+\theta\right)+C
\]

\end_inset


\end_layout

\begin_layout Standard
The amplitude and the phase of the frequency can then be evaluated this
 way:
\begin_inset Formula 
\begin{eqnarray*}
V & = & \sqrt{A^{2}+B^{2}}\\
\theta & = & \arctan\frac{B}{A}
\end{eqnarray*}

\end_inset


\end_layout

\begin_layout Standard
When using a twotone signal the representation is more complex:
\begin_inset Formula 
\[
A_{1}\cos\left(\omega_{1}t+\theta_{1}\right)+B_{1}\sin\left(\omega_{1}t+\theta_{1}\right)+A_{2}\cos\left(\omega_{2}t+\theta_{2}\right)+B_{2}\sin\left(\omega_{2}t+\theta_{2}\right)+C
\]

\end_inset


\end_layout

\begin_layout Subsubsection
sinefit3
\end_layout

\begin_layout Standard
This algorithm evaluates A, B, C starting from 
\begin_inset Formula $\omega$
\end_inset

.
 The algorithm is well described in IEEE Standard for Terminology and Test
 Methods for Analog-to-Digital Converters, IEEE Std 1241-2000.
\end_layout

\begin_layout Subsubsection
doubleSinefit3
\end_layout

\begin_layout Standard
This algorithm evaluates 
\begin_inset Formula $A_{1},\, B_{1},\, A_{2},\, B_{2},\, C$
\end_inset

 starting from 
\begin_inset Formula $\omega_{1}$
\end_inset

 and 
\begin_inset Formula $\omega_{2}$
\end_inset

.
 It's an extension of sinefit3.
\end_layout

\begin_layout Subsubsection
sinefit4
\end_layout

\begin_layout Standard
This algorithm evaluates A, B, C and 
\begin_inset Formula $\omega_{0}$
\end_inset

 starting for an initial approximation of the angular frequency.
 A good approximation is given by this formula:
\begin_inset Formula 
\[
\omega_{i}=2\pi\frac{f_{s}}{M}arg\max_{j\leq M}X_{j}
\]

\end_inset

where 
\begin_inset Formula $X_{j}$
\end_inset

 is the DFT of the signal, 
\begin_inset Formula $f_{s}$
\end_inset

 the sampling frequency and 
\begin_inset Formula $M$
\end_inset

 the number of samples of the signal.
 Based on sinefit3, this algorithm is essentially a least square fit of
 the four parameters, and it's well described in IEEE Standard for Terminology
 and Test Methods for Analog-to-Digital Converters, IEEE Std 1241-2000.
 
\end_layout

\begin_layout Subsubsection
doubleSinefit4
\end_layout

\begin_layout Standard
This algorithm evaluates 
\begin_inset Formula $A_{1},\, B_{1},\, A_{2},\, B_{2},\, C$
\end_inset

 and also 
\begin_inset Formula $\omega_{1}$
\end_inset

 and 
\begin_inset Formula $\omega_{2}$
\end_inset

 starting from an initial approximation of the two angular frequencies.
\family roman
\series medium
\shape up
\size normal
\emph off
\bar no
\strikeout off
\uuline off
\uwave off
\noun off
\color none

\begin_inset Formula 
\[
J_{1}=arg\max_{j\leq M}X_{j}
\]

\end_inset


\family default
\series default
\shape default
\size default
\emph default
\bar default
\strikeout default
\uuline default
\uwave default
\noun default
\color inherit

\begin_inset Formula 
\[
\omega_{1}=2\pi\frac{f_{s}}{M}J_{1}
\]

\end_inset


\begin_inset Formula 
\[
\omega_{2}=2\pi\frac{f_{s}}{M}arg\max_{j\leq M,j\neq J_{1}}X_{j}
\]

\end_inset


\end_layout

\begin_layout Subsection
Performance parameters
\end_layout

\begin_layout Standard
All these parameters are calculated for a digitized sinusoidal wave, eventually
 multiplied with a window signal.
 
\end_layout

\begin_layout Subsubsection
SNR: Signal to Noise Ratio
\end_layout

\begin_layout Standard
The SNR is a rather important parameter, and its general formula is the
 following:
\begin_inset Formula 
\[
SNR=20\log_{10}\frac{P_{s}}{P_{n}}\quad[dB]
\]

\end_inset

with 
\begin_inset Formula $P_{s}$
\end_inset

 being the signal power and 
\begin_inset Formula $P_{n}$
\end_inset

 the noise power
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
It doesn't take into account the harmonic distortions, in addition to DC
 and the meaningful signal.
\end_layout

\end_inset

.
 This ratio will always be greater than one.
 The noise power is computed this way:
\begin_inset Formula 
\begin{eqnarray*}
C[f] & = & \begin{cases}
0 & f\in\{0,\, i\alpha_{0},\, M-1-\alpha_{0}\}\quad\forall i\in[0,\left\lfloor \frac{M}{\alpha_{0}}\right\rfloor ]\\
X[f] & otherwise
\end{cases}\\
P_{n} & = & \frac{\sum C[f]^{2}}{M}
\end{eqnarray*}

\end_inset


\end_layout

\begin_layout Subsubsection
SINAD: SIgnal to Noise And Distortion ratio
\end_layout

\begin_layout Standard
To compute with great precision this value, we compare our wave with a synthetic
 one.
 Using the data obtained from sinefit4 we can generate a signal that represents
 with great precision (as a perfect ADC) the sinusoid, so we can compute
 the noise signal:
\begin_inset Formula 
\begin{eqnarray*}
s[k] & = & C+A\cos(\frac{\omega_{0}}{f_{s}}k)+B\sin(\frac{\omega_{0}}{f_{s}}k)\,\,\forall k\in[0,\, M[\\
n[k] & = & x[k]-n[k]
\end{eqnarray*}

\end_inset


\end_layout

\begin_layout Labeling
\labelwidthstring 00.00.0000
At this point we calculate:
\begin_inset Formula 
\begin{eqnarray*}
RMS_{n} & = & \sqrt{\frac{1}{M}\sum_{i=0}^{M-1}n[k]^{2}}\\
RMS_{x} & = & \frac{\max x}{\sqrt{2}}
\end{eqnarray*}

\end_inset


\end_layout

\begin_layout Standard
And then we can define the SINAD:
\begin_inset Formula 
\[
SINAD=20\log_{10}\frac{RMS_{x}}{RMS_{n}}\;[dB]
\]

\end_inset


\end_layout

\begin_layout Subsubsection
THD: Total Harmonic Distortion
\end_layout

\begin_layout Standard
The THS is evaluated in the following way:
\begin_inset Formula 
\[
THD=-20\log_{10}\frac{X[\alpha_{0}]}{\left\Vert h_{i}\right\Vert }
\]

\end_inset


\end_layout

\begin_layout Standard
where:
\begin_inset Formula 
\begin{eqnarray*}
\alpha_{0} & = & \arg\max X[f]\\
h_{i} & = & X[\alpha_{0}i]\quad\forall i\in[2,\,2-i[
\end{eqnarray*}

\end_inset


\end_layout

\begin_layout Subsubsection
ENOB: Effective Number Of Bits
\end_layout

\begin_layout Standard
Let's define the full scale range as:
\begin_inset Formula 
\[
R_{FS}=2^{N-1}
\]

\end_inset


\end_layout

\begin_layout Standard
The data range, instead, is the following quantity:
\begin_inset Formula 
\[
R_{data}=\frac{\min x[t]+\max x[t]}{2}
\]

\end_inset


\end_layout

\begin_layout Standard
Therefore, we define 
\begin_inset Formula $f$
\end_inset

 as follow:
\begin_inset Formula 
\[
f=20log\frac{R_{FS}}{R_{data}}
\]

\end_inset

in order to avoid penalization for a signal that doesn't cover all the full
 scale range.
 The effective number of bits can then be defined as:
\begin_inset Formula 
\[
ENOB=\frac{SINAD+f-1.76}{6.02}
\]

\end_inset


\end_layout

\begin_layout Subsubsection
SFDR: Spurious Free Dynamic Range
\end_layout

\begin_layout Standard
The spurious free dynamic range is, simply put, the difference between the
 main peak and the highest harmonic distortion peak in dBc:
\begin_inset Formula 
\[
SFDR_{i}=10\log\frac{\max X[f]}{\max h_{i}}
\]

\end_inset

A good value of 
\begin_inset Formula $i$
\end_inset

 is 10.
 
\end_layout

\begin_layout Section
PAGE API: Python ADCs and GEnerators API
\end_layout

\begin_layout Standard
The PAGE API acts as a bridge between various devices with different purpose
 and in different machines.
 PAGE has been built with flexibility in mind, and it fully exploits Python
 in order to achieve its objective.
\end_layout

\begin_layout Standard
For a better description of the API use the help interface of Python, since
 the code is full of docstrings.
\end_layout

\begin_layout Subsection
Requisites
\end_layout

\begin_layout Standard
In order to use PAGE, you need to install:
\end_layout

\begin_layout Itemize
Python 
\begin_inset Formula $\geq$
\end_inset

 2.7 
\end_layout

\begin_layout Itemize
Pyro4
\end_layout

\begin_layout Subsection
Structure of the API
\end_layout

\begin_layout Standard
The API offers three different categories of objects, that all inherit from
 the Item class; this is an implementation choiche.
 The Item parameters (and therefore also inherited classes' ones) can be
 discovered at runtime without efforts.
 Item implement a few helper methods to make the use of remote objects easier.
\end_layout

\begin_layout Standard
Waveforms describe waves in a way that doesn't depend on the device who's
 going to reproduce them.
 They must offer a way to generate either a period of the wave itself, or
 an array of it.
 All the waveforms inherit from the Waveform class, which implements also
 another remote objects helper method.
\end_layout

\begin_layout Standard
Generators translates Waveform objects into analog output.
 A generator must provide a way to play a waveform in the best possible
 way.
 For example, a module for a DAC which plays data from a buffer will use
 the waveform-generated array, while a device like the Agilent 33250A can
 qualitatively reprodue a few signals, like a sinewave, getting higher speeds
 and precision.
 All the generators will inherit from Generator.
\end_layout

\begin_layout Standard
ADCs inherit from the ADC class, and they translate analog signal into a
 sequence of bytes (but not into a waveform!).
 An ADC class must provide a way to discover its bits number, the supported
 sampling frequencies, the one being used and also a method, readEvent,
 that returns an array of data.
\end_layout

\begin_layout Section
ACT: ADC Characterization Toolkit
\end_layout

\begin_layout Subsection
Introduction
\end_layout

\begin_layout Standard
This program helps to test ADC in a very detailed yet easy way, with a usable
 interface and high flexibility.
 
\end_layout

\begin_layout Standard
ACT works with chains: a particular sequence of operations to execute in
 order to achieve a different result.
 The majority of the operations are executed by PAGE items.
 To use ACT, one must choose a chain between four of them.
 ACT will then offer other possibilities to fine-tune the analysis, or to
 perform a frequency sweep, too.
\end_layout

\begin_layout Standard
The tool can keep track of various readings at different frequencies, when
 applicable.
\end_layout

\begin_layout Subsection
ACT items: SignalProcessing module
\end_layout

\begin_layout Standard
ACT has its own set of items in the SignalProcessing module.
 This module implements all the algorithm described before.
 Basically, there are three main components:
\end_layout

\begin_layout Description
Signal this class will hold data from a signal, nothing more and nothing
 less.
 
\end_layout

\begin_layout Description
SingleToneSignal this class, which inherits from Signal, computes parameters
 assuming that there is only one sinusoidal wave in the digitized data.
 
\end_layout

\begin_layout Description
TwoToneSignal this class, which also inherits from Signal, computes the
 IMD, assuming there are two different tones in the signal.
\end_layout

\begin_layout Subsection
Synthetic data chain
\end_layout

\begin_layout Standard
This chain is composed only by a waveform.
 It's used to test the application and its algorithms.
 
\end_layout

\begin_layout Standard
The user must select a waveform object and configure it, to choose its parameter
s.
 When ready, the application will compute parameters accordingly to the
 wafeform type, selecting either SingleToneSignal or TwoToneSignal.
 The user can then configure the waveform generation parameters on the control
 panel.
\end_layout

\begin_layout Subsection
File chain
\end_layout

\begin_layout Standard
The data is read from a file: as one can guess, this chain won't use PAGE
 items.
 The file structure is rather easy, and contains all the information we
 need to compute everything, except the type of data it contains:
\end_layout

\begin_layout Standard
\begin_inset listings
inline false
status open

\begin_layout Plain Layout

[SIGNAL]
\end_layout

\begin_layout Plain Layout

nbits = n
\end_layout

\begin_layout Plain Layout

rate = Fs
\end_layout

\begin_layout Plain Layout

data =<tab>data[0]
\end_layout

\begin_layout Plain Layout

<tab>data[1]
\end_layout

\begin_layout Plain Layout

..
\end_layout

\begin_layout Plain Layout

<tab>data[M -1]
\end_layout

\end_inset


\end_layout

\begin_layout Description
n number of bits of the ADC;
\end_layout

\begin_layout Description
Fs sampling rate;
\end_layout

\begin_layout Description
data a list of integers that represent the signal, always preceded by a
 TAB character.
 
\end_layout

\begin_layout Standard
The user has to choose which ACT item to use for the analysis.
\end_layout

\begin_layout Subsection
Full chain
\end_layout

\begin_layout Standard
This chain is composed by a Waveform item, a Generator item, a ADC item
 and a Signal item.
 
\end_layout

\begin_layout Standard
The waveform selected will be played by the chosen Generator; then the ADC
 will read the data from the generator and will pass them to the application,
 which will create one (or more) instance(s) of Signal; the application
 will choose SingleToneSignal or TwoToneSignal depending on the chosen Waveform.
\end_layout

\begin_layout Standard
This chain is by far the most complex one, but it also allows to fully test
 the ADC (and, to some extents, the Generator itself!).
\end_layout

\begin_layout Subsection
ADC only chain
\end_layout

\begin_layout Standard
This chain is composed of a ADC item and a Signal item, which the user must
 select.
 The ADC will read data and then the application will load it into the user-sele
cted Signal item.
 
\end_layout

\begin_layout Subsection
Frequency 
\end_layout

\end_body
\end_document
