Boolean Circuits · NAND Game: Processor (Optional)

Lesson 3

Nikolai Chukhin · Alexander S. Kulikov

A program is a sequence of instructions, where each instruction consists of a set of bit flags that determine the following:

  • the ALU operation to be performed,
  • the registers to be used as inputs, and
  • the register or registers in which the result is to be stored.

The control unit chooses between data instructions and ALU instructions. The gate \(\texttt{SPLIT16}\) takes one 16-bit value and writes its 16 bits from most to least significant.

Problem. Synthesize a circuit of size \(6\) over \(\{\operatorname{NAND}_{2},\allowbreak \operatorname{CONTROLSELECTOR}_{16},\allowbreak \operatorname{SPLIT}_{16},\allowbreak \operatorname{SELECT}_{16},\allowbreak \operatorname{ALU}_{16},\allowbreak \operatorname{CONDITION}_{16}\}\) computing the control-unit function: \[\operatorname{CONTROLUNIT}_{16}(I,A,D,\texttt{*A})=(R,a,d,\texttt{*a},j).\] The values \(I,A,D\), \(\texttt{*A}\), and \(R\) are 16-bit; the remaining variables are bits.

Let \(Y=A\) when \(\texttt{I}[12]=0\) and \(Y=\texttt{*A}\) otherwise, and define \[\begin{aligned}R_1&=\operatorname{ALU}_{16}(\texttt{I}[10],\texttt{I}[9],\texttt{I}[8],\texttt{I}[7],\texttt{I}[6],D,Y),\\ (a_1,d_1,\texttt{*a}_1)&=(\texttt{I}[5],\texttt{I}[4],\texttt{I}[3]),\\ j_1&=\operatorname{CONDITION}_{16}(\texttt{I}[2],\texttt{I}[1],\texttt{I}[0],R_1).\end{aligned}\] If \(\texttt{I}[15]=1\), return \((R_{1},a_{1},d_{1},\texttt{*a}_{1},j_{1})\); otherwise return \((I,1,0,0,0)\).