\chapter{Data streams}\sectlabel{stream}


\section{Sources and destinations}\label{sect.source-dest}

Central to the \step{} updating and analysis process are five internal
inputs within each \chip\ which we shall call {\em destinations}:
 \begin{itemize}
	\item {\em LUT Source} (\sect{LASR}). The \lut\ Source bit
contributed by the \chip.  Collectively, the sixteen \lut\ Address
bits contributed by a \chip\ set make up the address used, at every
site of a scan, for lookup in the active \lut.
	\item {\em Flywheel Output} (\sect{FOSR}). The bit to be
placed on the \chip's {\sym Flywheel Data Output} pin
(\sect{flywheel})---perhaps to be modified and returned through
the {\sym Flywheel Data Input} pin.
	\item {\em Site Source} (\sect{SDSR}). The Site Source bit
contributed by the \chip.  Collectively, the sixteen Site Source bits
contributed by a \chip\ set make up the new value to be written in the
site being scanned (cf.\ \fig{site-layer}).
	\item {\em Event Counter} (\sect{ECSR}). The bit to be fed to
the \chip's {\sym Event Counter} (see \sect{event-counter}). Each of
the sixteen \chip{}s of a module has a separate event counter.
	\item {\em Display Data} (\sect{DSR}) The data to be displayed
on the dedicated monitor, or read back by the host during scan \io\ 
(\sect{SIOR}).
 \end{itemize}
	Each destination independently can be fed, under software
control, with data derived from a number of sources.  Separate
registers (the {\sym Site Address Bit Select Register} mentioned above
and the registers described in the next few sections) determine the
data sources that are used for each of these destinations.  In all
cases, source selection and combination is made in two stages, using a
two-bit {\em select} register and a four-bit {\em map} register, as
sketched in \fig{source-dest}.

\figonecol{source-dest}{
 \begin{picture}(208,152)(-80,0)
	\thinlines
	\put(0,56){\line(0,1){64}\line(4,1){32}}	% trapezoid
	\put(32,112){\line(0,-1){48}\line(-4,1){32}}	%	''
	\put(16,88){\makebox(0,0){\sc mux}}		%
	\put(32,88){\line(1,0){24}\vector(1,1){12}}	% low input
	\put(44,96){\makebox(0,0){$s$}}
	\put(0,136){\line(1,0){56}\vector(1,-1){12}}	% hi input
	\put(44,144){\makebox(0,0){$g$}}
	\put(80,112){\circle{32}\makebox(0,0){$f$}}	% function
	\put(96,112){\vector(1,0){32}}			% output

	\multiput(-80,64)(0,16){4}{\vector(1,0){80}}	% MUX inputs
	\put(0,136){\line(-1,0){80}}			% glued input
	\put(-80,70){\makebox(0,0)[l]{\lut\ Output}}
	\put(-80,86){\makebox(0,0)[l]{Flywheel Input}}
	\put(-80,102){\makebox(0,0)[l]{\bus\ Data}}
	\put(-80,118){\makebox(0,0)[l]{Unglued Data}}
	\put(-80,142){\makebox(0,0)[l]{Glued Data}}

	\put(0,16){\framebox(32,16){select\rule[-1ex]{0pt}{3ex}}}
\put(64,16){\framebox(32,16){map\rule[-1ex]{0pt}{3ex}}}
\put(48,6){\makebox(0,0){$x$ \sym Source Register}}
\put(16,32){\dashbox{4}(0,24){}}\put(16,60){\vector(0,1){0}}
\put(80,32){\dashbox{4}(0,64){}}\put(80,96){\vector(0,1){0}}
\end{picture}}
	{Source selection and combination network.  Each of the five
destinations has its own network, driven by the corresponding source
register ($x$ stands for one of the possible five destinations). The
last input to the multiplexer is \lut\ Output (as shown in the figure)
for the three destinations Site Data, Event Counter, and Display. For
the other two destinations, i.e., \lut\ Source and Flywheel Output,
it is the bit specified by the {\sym Site Source Bit Select
Register}. For $g$ and $s$, cf.\ table \protect\eq{source-map}.}

The select register selects one source out of four, namely,

 \begin{equation}\label{eq.sources}
 \begin{tabular}{|c|p{2in}|}\hline
	select & source \\\hline\hline
	0 & Unglued Data bit (\sect{glued-stream}).\\\hline
	1 & \bus\ Data bit (\sect{SIR}, \sect{SIR}).\\\hline
	2 & Flywheel Input bit (\sect{flywheel}).\\\hline
	3 & \quad {\em When the destination is
either the \lut\ address bit or the flywheel output bit\/}: one bit of
the site address, as specified by the {\sym Site Source Bit
Select Register}.\\
	  & \quad {\em For all other destinations:} the \lut\ output.\\\hline
 \end{tabular}\;.
 \end{equation}

The selected source is combined with another source, namely, Glued
Data, by a two-input, one-output Boolean function $f$.  The map
register (\fig{source-dest}) specifies which of the sixteen possible
Boolean functions is to be used for $f$ according to the following
table (where $g$ denotes the Glued Data source and $s$ denotes the
source chosen by the select register)

 \begin{equation}\label{eq.source-map}
 \begin{tabular}{|r|l|}\hline
	map & \multicolumn{1}{c|}{Boolean function}\\\hline\hline
	0 & 0 \\
	1 & $\overline{g\ \hbox{\sc or}\ s}$\\
	2 & $g\ \hbox{\sc and}\ \overline s$\\
	3 & $\overline s$\\
	4 & $\overline g\ \hbox{\sc and}\ s$\\
	5 & $\overline g$\\
	6 & $g\neq s$\\
	7 & $\overline{g\ \hbox{\sc and}\ s}$\\
	8 & $g\ \hbox{\sc and}\ s$\\
	9 & $g=s$\\
	10 & $g$\\
	11 & $g\ \hbox{\sc or}\ \overline s$\\
	12 & $s$\\
	13 & $\overline g\ \hbox{\sc or}\ s$\\
	14 & $g\ \hbox{\sc or}\ s$\\
	15 & 1\\\hline
 \end{tabular}
 \end{equation}

\section{Event Counter}\sectlabel{event-counter}

  With a maximum space size of $2^{24}$ sites in a module, the
event counter must be able to store the $2^{24}$+1 possible values
for the count, from 0 to $2^{24}$. Thus, we need a 25-bit counter and a
25-bit buffer.

\section{Unglued and glued data}\sectlabel{glued-stream}


\section{Data flywheel}\sectlabel{flywheel}

... are taps on the data streams that circulate
within each \chip. For each layer, all the data accessed during a scan
are streamed past an output tap and an input tap. Thus, when provided
with appropriate synchronization, external hardware can, through these
taps, selectively extract any of the data involved in the simulation,
and can optionally replace them with arbitrary new data. The sixteen
{\sym Flywheel Output} and the sixteen {\sym Flywheel Input} lines of
each module, together with the control lines that decide whether
external injection of data is going to take place, are simply brought
out to connectors on the motherboard; they are mainly intended for
experimental use of the machine. (It is unlikely that even the most
advanced user will connect external equipment to more than one box.)


