\section{理論} \subsection{ディジタル} ディジタルとは最小単位が存在する物理量であり, 連続的で最小単位が存在しないアナログと対になる. この最小単位というのは時間や電圧などの刻み幅を決めるもので分解能ともいう. 分解能を高くすれば, 真の値と観測値の誤差が小さくなる. ディジタルには「誰が測っても同じになる」ことと「多少ノイズが混じっても大丈夫」という長所があり, 逆に「最小単位より小さいものは測れない」という短所がある. ディジタルにより, 現実世界の様々な現象をある一定の精度で数値的に解析・再現することが出来るようになった\supercite{digital-circuit:digital}. \begin{figure}[tbh] \centering \begin{minipage}[h]{0.45\textwidth} \centering \includegraphics[width=0.9\textwidth]{./assets/t-2/analog-example.png} \subcaption{Analog} \end{minipage} \begin{minipage}[h]{0.45\textwidth} \centering \includegraphics[width=0.9\textwidth]{./assets/t-2/digitize-example.png} \subcaption{Digital} \end{minipage} \caption{Example of Analog and Digital Signal} \end{figure} \subsection{二進数} 二進数とは0と1などの二種類の記号を用いた数の表記法である. これにより電気のオン・オフなど回路で扱いやすい形で様々な数を表すことが出来るようになった\supercite{digital-circuit:basic-logic}. \subsection{ブール代数} ブール代数とは二値化された数に対し, 演算子や法則を定義した数学の分野である. ブール代数では基本的な演算子は論理和, 論理積, 論理否定である\supercite{digital-circuit:basic-logic}. これらの演算子の演算結果は\cref{tab:truth-table-basic}のような真理値表でまとめることが出来る\supercite{digital-circuit:truth-table}. \begin{table}[!ht] \caption{Truth Tables of Basic Logic Operations} \label{tab:truth-table-basic} \begin{minipage}[h]{0.33\textwidth} \centering \subcaption{Logical And ($x = a \cdot b$)} \begin{tabular}{ccc} \hline a & b & x \\ \hline 0 & 0 & 0 \\ 1 & 0 & 0 \\ 0 & 1 & 0 \\ 1 & 1 & 1 \\ \hline \end{tabular} \end{minipage} \begin{minipage}[h]{0.33\textwidth} \centering \subcaption{Logical Or ($x = a + b$)} \begin{tabular}{ccc} \hline a & b & x \\ \hline 0 & 0 & 0 \\ 1 & 0 & 1 \\ 0 & 1 & 1 \\ 1 & 1 & 1 \\ \hline \end{tabular} \end{minipage} \begin{minipage}[h]{0.33\textwidth} \centering \subcaption{Logical Not ($x = \bar{a}$)} \begin{tabular}{cc} \hline a & $\bar{\text{a}}$ \\ \hline 0 & 1 \\ 1 & 0 \\ \hline \end{tabular} \end{minipage} \end{table} これら演算子に対する法則を\cref{equ:laws-of-boolean}に示す. \begin{equation} \label{equ:laws-of-boolean} \begin{aligned} a + a &= a &\ \text{(Idempotent Law)} \\ a \cdot a &= a &\ \text{(Idempotent Law)} \\ a + 1 &= 1 &\ \text{(Identity Law)} \\ a \cdot 0 &= 0 &\ \text{(Identity Law)} \\ a + (a \cdot b) &= a &\ \text{(Absorption Law)} \\ a \cdot (a + b) &= a &\ \text{(Absorption Law)} \\ (a + b) + c &= a + (b + c) &\ \text{(Associative Law)} \\ (a \cdot b) \cdot c &= a \cdot (b \cdot c) &\ \text{(Associative Law)} \\ \bar{\bar{a}} &= a &\ \text{(Double Negation)} \end{aligned} \end{equation} ブール代数の代表的な定理としてド・モルガンの定理がある. この定理は「あるブール式の各変数を否定し, 式の中の論理積と論理和を入れ替えた式は, 全体を否定した式と同じ値をとる」というもので\cref{equ:deMorgan}のような式で表現される\supercite{digital-circuit:basic-logic}. \begin{equation}\label{equ:deMorgan} \overline{f(x_1, x_2, \dotsc, +, \cdot)} = f(\overline{x_1}, \overline{x_2}, \dotsc, \cdot{}, +) \end{equation} \subsection{論理ゲート} 論理ゲートは論理演算を電気回路で表現したもので, 回路記号は\cref{fig:logic-gate-symbols}で表される\supercite{digital-circuit:gate-ic}. \begin{figure}[tbh] \centering \begin{circuitikz} \ctikzset{logic ports=ieee} \node [and port] at (0,2) {}; \node [nand port] at (0,0) {}; \node [or port] at (3,2) {}; \node [nor port] at (3,0) {}; \node [not port] at (6,1) {}; \node at (0,1) {AND Gate}; \node at (0,-1) {NAND Gate}; \node at (3,1) {OR Gate}; \node at (3,-1) {NOR Gate}; \node at (6,0) {NOT Gate}; \end{circuitikz} \caption{Symbols of Logic Gates} \label{fig:logic-gate-symbols} \end{figure} 図中のNANDゲートやNORゲートはそれぞれANDゲートとORゲートの結果の論理否定を出力する. これら論理ゲートを複数個まとめてパッケージしたICが論理ゲートICと呼ばれている. \subsection{組み合わせ回路} 複雑な条件を扱う論理回路は論理ゲート1つだけでは実現できない. 論理ゲートを複数種類・複数個組み合わせて作られた回路を組み合わせ回路という. 組み合わせ回路を作成するにあたり, 論理式の簡略化はコストや実装空間の制限上必須である. この簡略化で用いられる方法の1つがカルノー図である. カルノー図は論理式の結果を特定の条件に対応する行と列に写したもので, $x = (\bar{a} \cdot b \cdot c) + (a \cdot b \cdot \bar{c}) + (a \cdot \bar{b} \cdot \bar{c})$のカルノー図は\cref{fig:karnaugh-map-example}となる. \begin{figure}[tbh] \centering \begin{tabular}{|c|c|c|} \hline & $\bar{c}$ & $c$ \\ \hline $\bar{a} \ \bar{b}$ & & \\ \hline $\bar{a} \ b$ & & 1 \\ \hline $a \ b$ & 1 & \\ \hline $a \ \bar{b}$ & 1 & \\ \hline \end{tabular} \caption{Karnaugh Map of $x = (\bar{a} \cdot b \cdot c) + (a \cdot b \cdot \bar{c}) + (a \cdot \bar{b} \cdot \bar{c})$} \label{fig:karnaugh-map-example} \end{figure} カルノー図から隣接する1のセルを「くくる」と論理式を簡略化することが出来る\supercite{digital-circuit:karnaugh-map}. 今回の例では$a \cdot b \cdot \bar{c}$のセルと$a \cdot \bar{b} \cdot \bar{c}$のセルでは$b$の値によらず1になっているので, くくって $x = (a \cdot \bar{c}) + (\bar{a} \cdot b \cdot c)$を得る. \subsection{順序回路} 論理回路には現在の状態と入力によって次の状態へ変化する回路が存在する. これらの回路は順序回路と呼ばれている. 例えば, ある状態Aで入力が0の時, 出力を1にし状態Bへ, 入力が1の時, 出力を0にし状態Cへ遷移するというような回路のことである\supercite{digital-circuit:sequential-logic}. 順序回路の動作を説明するには状態遷移図や状態遷移表が有効である. 状態遷移図は各状態をノード, 入力/出力の順で表記された状態の遷移をエッジとする有向グラフとして表現される. 状態遷移表は入力と現状態が次にどの状態と出力をするのかを表にまとめたものである\supercite{digital-logic:state-transition}. 前述の例を状態遷移図と状態遷移表で表現するとそれぞれ\cref{fig:state-transition-graph-example}と\cref{tab:state-tarnsition-table-example}となる. \begin{table}[!ht] \begin{minipage}[h]{0.45\textwidth} \centering \begin{tikzpicture}[shorten >=1pt, node distance=2cm, auto] \node [state] (A) {$A$}; \node [state] (B) [above right of=A] {$B$}; \node [state] (C) [below right of=A] {$C$}; \path[->] (A) edge node {$0/1$} (B) edge node {$1/0$} (C); \end{tikzpicture} \captionof{figure}{Example of State Transition Graph} \label{fig:state-transition-graph-example} \end{minipage} \begin{minipage}[h]{0.45\textwidth} \centering \captionof{table}{Example of State Transition Table} \label{tab:state-tarnsition-table-example} \begin{tabular}{cccc} \hline State & Input & Next State & Output \\ \hline A & 0 & B & 1 \\ A & 1 & C & 0 \\ \hline \end{tabular} \end{minipage} \end{table}