Boolean Circuits · NAND Game: Processor (Optional)

Lesson 3

Nikolai Chukhin · Alexander S. Kulikov

The next component selects between two control buses.

Problem. Construct the control selector. The bit inputs are \(\texttt{s}\), \(\texttt{a1}\), \(\texttt{d1}\), \(\texttt{*a1}\), \(\texttt{j1}\), \(\texttt{a0}\), \(\texttt{d0}\), \(\texttt{*a0}\), and \(\texttt{j0}\). The labels \(\texttt{R1}\) and \(\texttt{R0}\) are hardcoded 16-bit inputs, so you may use them directly in gate lines. The outputs of your circuit must be five labels, in the order \(\texttt{R a d *a j}\), where \(\texttt{R}\) is 16-bit and the other four outputs are bits.

The selector bit \(\texttt{s}\) chooses one of the two control buses: \[\begin{array}{c | c c c c c} s & R & a & d & *a & j \\ \hline 0 & R_0 & a_0 & d_0 & *a_0 & j_0 \\ 1 & R_1 & a_1 & d_1 & *a_1 & j_1\end{array}\]

You may use only the following functions: \[\begin{aligned}\operatorname{NAND}(a,b) &= \neg(a \land b), \\ \operatorname{SELECT}(s,d_1,d_0) &= \begin{cases} d_0, & s=0, \\ d_1, & s=1, \end{cases} \\ \operatorname{SELECT}_{16}(s,d_1,d_0) &= \begin{cases} d_0, & s=0, \\ d_1, & s=1, \end{cases} \\ \operatorname{SPLIT}_{16}(x) &= (x_{15},x_{14},\dotsc,x_0), \\ \operatorname{ISNEG}(x) &= \begin{cases} 1, & x < 0, \\ 0, & x \ge 0. \end{cases}\end{aligned}\]

For example, a line \(\texttt{r s R1 R0 SELECT16}\) means that \(\texttt{r}\) is a new 16-bit label equal to \(\texttt{R0}\) if \(\texttt{s}\)=0 and equal to \(\texttt{R1}\) if \(\texttt{s}\)=1.

The authors' solution uses \(5\) gates.

1 point