  % -*- Mode:TeX -*-
\chapter{The user connector}\label{user}

Let's go back to the {\tt HPP}-gas rule, in the version of
Section \ref{doubleup}; can we compress the two-step cycle
into a single step? Instead of waiting for the particles from
the north, south, west, and east to move into the 1\by1 scope
of the center cell in order to permute them as specified by the collision
rule, can't we catch them when they are still one cell away,
and permute them while we are bringing them in? (After all \cam\ has
a built-in 3\by3 scope of vision.)

Though we only need {\sl four} neighbors, none of the
standard \cam\ neighbors provide these particular four, namely,
  \begin{description}
        \item[\rm 0.] the {\sl west} bit from plane 0,
        \item[\rm 1.] the {\sl east} bit from plane 1,
        \item[\rm 2.] the {\sl north} bit from plane 2,
        \item[\rm 3.] the {\sl south} bit from plane 3.
  \end{description}
In fact, the \id|N/VONN| neighborhood on \cama\ makes
items 0 and 1 (but not 2 or 3) visible for the updating of
planes 0 and 1; while the same neighborhood on \camb\ makes
items 2 and 3 (but not 0 or 1) visible to planes 2 and 3.
That is, two of the neighbors we want are missing from
\cama, and two from \camb.

The neighbors we need are actually present on the {\sl user connector\/}\index{User connector}; in
fact, all nine neighbors from each of the four planes---for a total of
36---plus a number of additional signals are present as {\sl outputs} there.
Moreover, the \id|N/VONN| major neighborhood assignment leaves us with
two spare address lines (10 and 11) on each lookup table, which can be
programmed by a minor neighborhood assignment (cf.\ Section
\ref{neighborhoods} and \cf{7.3.2}).  What we'll do is program these
spare lines as {\sl user neighbors} (with the \id|&/USER| assignment); that is,
they will be directly tied to input pins UA10, UA11 (for \cama)
and UB10, UB11 (for \camb) of the user connector.
We'll install four wire jumpers to connect to these input pins the desired plane outputs,
coming out of pins N2, S3, W0, and E1 of the user connector.

The overall situation is the following:

$$
\begin{tabular}{|c|l|l|}
\multicolumn{3}{l}{\cama} \\\hline
\sc bit needed & \sc seen as & \sc via \\\hline
{\sl west} \hfill of plane 0 & \tt WEST & \tt N/VONN \\
{\sl east} \hfill of plane 1 & \tt EAST'& \tt N/VONN \\
{\sl north} \hfill of plane 2 & UA10 (``{\tt \&NORTH}'') & \tt \&/USER \\
{\sl south} \hfill of plane 3 & UA11 (``{\tt \&SOUTH'}'') & \tt \&/USER \\\hline
\multicolumn{3}{l}{\camb} \\\hline
\sc bit needed & \sc seen as & \sc via \\\hline
{\sl west} \hfill of plane 0 & UB10 (``{\tt \&WEST}'') & \tt \&/USER \\
{\sl east} \hfill of plane 1 & UB11 (``{\tt \&EAST'}'') & \tt \&/USER \\
{\sl north} \hfill of plane 2 & \tt NORTH & \tt N/VONN \\
{\sl south} \hfill of plane 3 & \tt SOUTH & \tt N/VONN \\\hline
\end{tabular}
$$

\noindent We have chosen mnemonic names for the new custom neighbors by
analogy with the rest of the naming scheme; for instance, \id|&SOUTH'|
signifies the {\sl south} bit from the {\sl primed} plane (i.e., the
odd-numbered one) of the {\sl other} \cam\ half, namely \camb---and
therefore the south bit of plane 3.  These names, to be used in the
rule descriptor, are assigned to the appropriate address lines by the
\id|==| assignment.\index{Lookup table/address-line assignment}  Figure \ref{fig.hpp-fast} shows the entire
source code for this experiment.

\noteskip

{\small In that figure, \id|COLL-A| and \id|COLL-B| represent the
conditions under which a collision (and thus the reshuffling)
occurs, as seen respectively from \cama\ and \camb. As in Figure
\ref{fig.hpp-slow}, we have made life simpler by including in the
collision condition the two cases where there are four particles
or no particles, since the reshuffling of identical particles
or of empty cells is harmless. 

Of course, in place of \id|HPP-FAST| we could have written, perhaps more
clearly, separate rule descriptors for \cama\ and \camb.

}
 \begin{figure}[tb]
 $$
        \begin{tabular}{|c|}
        \multicolumn{1}{c}{\small\tt Screen 1 \hfill HPP-FAST.EXP \hfill (100\%)}\\\hline
        \begin{minipage}{\scrn}\smallskip\small
        \begin{verbatim}
\ Fast version of the HPP rule (1-step cycle)         04Jan87tmt
NEW-EXPERIMENT  N/VONN &/USER    DECIMAL \ to make sure 10, 11
10 == &NORTH    10 = &WEST       \ mean the right thing
11 == &SOUTH'   11 = &EAST'      \ in case you were in HEX
                                              : COLL-A
         WEST  EAST' =  &NORTH &SOUTH' =  AND ;
                                              : COLL-B
        &WEST &EAST' =   NORTH  SOUTH' =  AND ;
                                              : HPP-FAST
                        COLL-A IF
              &NORTH &SOUTH' ELSE
                   WEST EAST THEN >PLN1 >PLN0
                        COLL-B IF
                &WEST &EAST' ELSE
                NORTH SOUTH' THEN >PLN3 >PLN2 ;
MAKE-TABLE HPP-FAST
\end{verbatim}
        \microskip
        \end{minipage}\\\hline
        \end{tabular}
 $$
 \caption{Source screen for a fast realization of the {\tt HPP} gas,
using the user connector to provide the required extra neighbors.}
 \label{fig.hpp-fast}
 \end{figure}

\bigskip

The signals on the user connector are discussed in \cam's \hm.  The
connector's pinout is given in file \iprog{PINOUT.DOC}.  All 36
neighbors from the planes are brought out as outputs on this connector,
as well as all table address lines for both lookup tables as inputs
(except lines 0 and 1, which are permanently connected to \id|CENTER|
and \id|CENTER'|).  Thus, by placing a few jumpers on the connector it
is possible to complement or replace the standard \cam\ neighborhoods by
custom neighborhoods.

It is also possible to completely bypass the built-in lookup tables and
replace them with external ones: the ``new state'' inputs
for all four planes can be made to come, under software control, from four pins
on the user connector. 

Other output signals of general interest (cf.\ \hm) include:
  \begin{itemize}
        \item The spatial phases and the temporal phases.
        \item Four pseudo-neighbors that take on the value \id|1| on,
respectively, the top and bottom rows and the leftmost and rightmost
columns of the bit-plane array.\index{Bit-plane/edges}  These are useful, for example, for
generating a ``{\tt NOW}'' line for one-dimensional cellular automata
(cf.\ \cf{9.7}) without wasting one bit-plane for this purpose; for
constructing reflecting boundaries (in place of the default wraparound)
around the bit-planes; for injecting a flow from one edge and draining
it from the opposite edge (``wind tunnel''); and similar situations
where a different dynamics is required on a distinguished line drawn
across the array.
        \item Gating signals, to tell external
circuitry when the array is actively updating and when it is undergoing maintenance
tasks (such as horizontal or vertical retrace). In this way, external
counters or event detectors can be prevented from recognizing spurious
events.
  \end{itemize}

        It must be noted that any jumpers or other circuitry connected
to the user connector for special applications may be left in place
even when not needed, since it's up to the software to decide whether
or not to look at the user-connector signals: all experiments
that do not attempt to use this connector run as if nothing was connected to it.

If applications requiring different wiring schemes are to be run
on the same \cam, prewired headers (duly labeled and documented)
should be used instead of individual jumpers, to facilitate switch-over.
If signals have to travel between \cam\ and external custom hardware,
one can use ribbon cable terminated by standard 50-pin headers.