This repository has been archived on 2023-07-29. You can view files and clone it, but cannot push or open issues or pull requests.
sscs-chipathon-sar-adc/figures/adc.tex
2023-04-27 11:08:33 -04:00

165 lines
5.9 KiB
TeX

\documentclass[border=5pt]{standalone}
\usepackage{circuitikz}
\begin{document}
\newcommand{\wedgedown}{+(-0.15,0) -- +(0,-0.15) -- +(0.15,0)}
\begin{circuitikz}
\draw (0, 0) node[above]{$V_{+}$} to[short, *-]++ (1, 0) coordinate (sh1_left);
\draw (0, -4) node[above]{$V_{-}$} to[short, *-]++ (1, 0) coordinate (sh2_left);
% Sample & Hold
\node [muxdemux,
muxdemux def={Lh=4, NL=2, Rh=4, NR=2, NT=1, NB=0, w=6},
draw only top pins={},
draw only left pins={1},
draw only right pins={1},
anchor=lpin 1
](sh1) at (sh1_left) {};
\node [above] at ($(sh1.btpin 1) + (-1, 0)$) {S\&H};
\draw (sh1.blpin 1) to[switch]++ (2, 0) coordinate (sh1_c)
to (sh1.brpin 1);
\draw (sh1_c) to[C]++ (0, -1) node[ground]{};
\node [muxdemux,
muxdemux def={Lh=4, NL=2, Rh=4, NR=2, NT=1, NB=0, w=6},
draw only top pins={},
draw only left pins={1},
draw only right pins={1},
anchor=lpin 1
](sh2) at (sh2_left) {};
\node [above] at ($(sh2.btpin 1) + (-1, 0)$) {S\&H};
\draw (sh2.blpin 1) to[switch]++ (2, 0) coordinate (sh2_c)
to (sh2.brpin 1);
\draw (sh2_c) to[C]++ (0, -1) node[ground]{};
% DAC -
\node [muxdemux,
muxdemux def={Lh=8, NL=2, Rh=8, NR=2, NT=1, NB=1, w=10, inset w=0.5, inset Lh=3.0, inset Rh=2.0},
draw only top pins={},
anchor=lpin 1
] (dac2) at ($(sh2.rpin 1) + (1, 0)$) {};
\node [above] at ($(dac2.btpin 1) + (-2, 0)$) {DAC};
\coordinate (dac2_cap_j) at ($(dac2.btpin 1) + (0, -0.5)$);
\coordinate (dac2_tj) at ($(dac2_cap_j)!0.5!(dac2.btpin 1)$);
\coordinate (dac2_outset_left) at ($(dac2.brpin 1) + (-0.5, 0)$);
\draw (dac2.blpin 1) to (dac2.blpin 1 -| dac2.inset right)
|- (dac2_tj)
-| (dac2.brpin 1 -| dac2_outset_left)
to (dac2.brpin 1);
\draw (dac2_tj) to (dac2_cap_j);
\draw (dac2_cap_j) to++ (-2, 0)
to[C]++ (0, -2) node[spdt, rotate=-90, anchor=in](d1){} node[right]{$D_1$};
\coordinate (dac2_left_cap) at (d1.out 1);
\draw (dac2_cap_j) ++ (-1, 0)
to[C]++ (0, -2) node[spdt, rotate=-90, anchor=in](d2){} node[right]{$D_2$};
\draw (dac2_cap_j) ++ (0, 0)
to[C]++ (0, -2) node[spdt, rotate=-90, anchor=in](d3){} node[right]{$D_3$};
\draw (dac2_cap_j) ++ (1, 0)
++ (0, -1) node{\ldots};
\draw (dac2_cap_j) to++ (2, 0)
to[C]++ (0, -2) node[spdt, rotate=-90, anchor=in](d12){} node[right]{$D_{12}$};
\coordinate (dac2_right_cap) at (d12.out 1);
\coordinate (dac2_bj) at ($(d1.out 1 -| dac2.bbpin 1)!0.5!(dac2.bbpin 1)$);
\draw (d1.out 1 |- dac2_bj) to (dac2_bj) to (d12.out 1 |- dac2_bj);
\draw (d1.out 1) to (d1.out 1 |- dac2_bj);
\draw (d2.out 1) to (d2.out 1 |- dac2_bj);
\draw (d3.out 1) to (d3.out 1 |- dac2_bj);
\draw (d12.out 1) to (d12.out 1 |- dac2_bj);
\draw (d1.out 2) to (d12.out 2) |- (dac2.brpin 2);
\node [ground] at (dac2.rpin 2){};
\coordinate (dac2_sw_j) at ($(dac2_left_cap)!0.5!(dac2_right_cap)$);
\draw (dac2_bj) to (dac2.bbpin 1);
\node [below] at (dac2.bpin 1){$V_{ref}$};
% DAC +
\node [muxdemux,
muxdemux def={Lh=8, NL=2, Rh=8, NR=2, NT=1, NB=1, w=10, inset w=0.5, inset Lh=3.0, inset Rh=2.0},
draw only bottom pins={},
anchor=lpin 2
] (dac1) at ($(sh1.rpin 1) + (1, 0)$) {};
\node [above] at ($(dac1.btpin 1) + (-2, 0)$) {DAC};
\coordinate (dac1_cap_j) at ($(dac1.bbpin 1) + (0, 0.5)$);
\coordinate (dac1_bj) at ($(dac1_cap_j)!0.5!(dac1.bbpin 1)$);
\coordinate (dac1_outset_left) at ($(dac1.brpin 2) + (-0.5, 0)$);
\draw (dac1.blpin 2) to (dac1.blpin 2 -| dac1.inset right)
|- (dac1_bj)
-| (dac1.brpin 2 -| dac1_outset_left)
to (dac1.brpin 2);
\draw (dac1_bj) to (dac1_cap_j);
\draw (dac1_cap_j) to++ (-2, 0)
to[C]++ (0, 2) node[spdt, rotate=90, anchor=in](d1){} node[right]{$D_1$};
\coordinate (dac_left_cap) at (d1.out 1);
\draw (dac1_cap_j) ++ (-1, 0)
to[C]++ (0, 2) node[spdt, rotate=90, anchor=in](d2){} node[right]{$D_2$};
\draw (dac1_cap_j) ++ (0, 0)
to[C]++ (0, 2) node[spdt, rotate=90, anchor=in](d3){} node[right]{$D_3$};
\draw (dac1_cap_j) ++ (1, 0)
++ (0, 1) node{\ldots};
\draw (dac1_cap_j) to++ (2, 0)
to[C]++ (0, 2) node[spdt, rotate=90, anchor=in](d12){} node[right]{$D_{12}$};
\coordinate (dac1_right_cap) at (d12.out 1);
\coordinate (dac1_tj) at ($(d1.out 1 -| dac1.btpin 1)!0.5!(dac1.btpin 1)$);
\draw (d1.out 1 |- dac1_tj) to (dac1_tj) to (d12.out 1 |- dac1_tj);
\draw (dac1_tj) to (dac1.btpin 1);
\node [above] at (dac1.tpin 1) {$V_{ref}$};
\draw (d1.out 1) to (d1.out 1 |- dac1_tj);
\draw (d2.out 1) to (d2.out 1 |- dac1_tj);
\draw (d3.out 1) to (d3.out 1 |- dac1_tj);
\draw (d12.out 1) to (d12.out 1 |- dac1_tj);
\draw (d1.out 2) to (d12.out 2) |- (dac1.brpin 1);
\node [ground] at (dac1.rpin 1){};
% Comparator
\node [op amp, yscale=-1, scale=1.5](comp) at ($(dac1.rpin 2)!0.5!(dac2.rpin 1) + (2, 0)$) {};
\draw (dac1.rpin 2) |- (comp.+);
\draw (dac2.rpin 1) |- (comp.-);
% SAR
\node [muxdemux,
muxdemux def={Lh=8, NL=1, Rh=8, NR=1, NT=2, NB=0},
anchor=lpin 1
] (sar) at ($(comp.out) + (0.5, 0)$) {SAR};
\draw (sar.btpin 1) \wedgedown;
\node [above] at (sar.tpin 1) {CLK};
\node [above] at (sar.tpin 2) {RST};
\coordinate (sar_j) at ($(sar.rpin 1) + (0.5, 0)$);
\draw (sar.rpin 1) to (sar_j);
\draw (sh1.rpin 1) to (dac1.lpin 2);
\draw (sh2.rpin 1) to (dac2.lpin 1);
\draw (dac2.lpin 2) to++ (0, -2) coordinate (temp)
to (temp -| sar_j)
|- (sar_j);
\draw (dac1.lpin 1) to++ (0, 2) coordinate (temp)
to (temp -| sar_j)
|- (sar_j);
\draw (comp.out) to (sar.lpin 1);
\draw (sar_j) to[multiwire=12, -*]++ (2, 0) node[above]{$V_{out}$};
\end{circuitikz}
\end{document}