Boolean Circuits · NAND Game: Arithmetic Logic Unit (Optional)

Lesson 3

Nikolai Chukhin · Alexander S. Kulikov

The gate \(\texttt{ONE16}\) has no inputs and writes the 16-bit value \(1\).

Problem. Synthesize a circuit of size \(5\) over \(\{\operatorname{NAND}_{2},\allowbreak \operatorname{SELECT}_{16},\allowbreak \operatorname{ADD}_{16},\allowbreak \operatorname{SUB}_{16},\allowbreak \operatorname{ONE}_{16}\}\) computing the 16-bit arithmetic-unit function \[\operatorname{ARITHUNIT}_{16}(op_{1},op_{0},x,y)=R,\] where \(R\) is selected as follows (all arithmetic is modulo \(2^{16}\)): \[\begin{array}{c c | l} op_1 & op_0 & R \\ \hline 0 & 0 & x + y \\ 0 & 1 & x + 1 \\ 1 & 0 & x - y \\ 1 & 1 & x - 1\end{array}\]