
\chapter{Scanning}\label{sect.scanning}

\memo{This chapter is for the moment a collage of pieces gotten
from different places}


\section{Site Address}\label{sect.site-address}

{\sym Site Address} ({\sym SA})



The {\sym Dimension Register} ({\sym DR}) is used to split the Site Address into
several pieces, each of which is the address within one dimension of
the sector of the subarray managed by this \chip.  The {\sym OSR} is split
up in the same way, and as the Site Address is added to the {\sym OSR}, each
dimension is added separately (with no carry between adjacent bits
belonging to different dimensions).  

Since kicks involve moving the origin in each dimension, each kick
moves the origin from the spot that it has reached as a result of all
earlier kicks---the {\sym OSR} is the accumulation of all previous
kicks, to which the {\sym Kick Amount Register} (see {\sym KAR} in
{\sym KR}) is added to account for the latest kick.  This addition is
again performed separately on each dimension, and occurs once per
scan, when the scan is scheduled (see {\sym SSF} in {\sym RR}).  Note that if a
space is broken up into small patches, each of which is counted while
being updated (to get average quantities), the {\sym KAR} value for all but
the first patch should be zero.

\section{Dimension register}


Address arithmetic is done separately for each dimension.  An ordinary
24 bit add of an offset to our Site Address becomes several
simultaneous shorter adds by cutting several of the carrys that join
one stage of the adder to the next.  The positions of the cuts are
given by the {\sym DCFR}.

For each of the three gluable dimensions ($x$, $y$, and $z$), it is
necessary to perform a glue calculation to determine if the next site
bit lies within this \chip's \dram\, or must come from a glue
wire.  This calculation simply amounts to asking if we are in the
portion of the space that has been shifted correctly by modularly
adding an offset, or if we're in the portion that has been wrapped
around, rather than been shifted into an adjacent module.  To decide
this simply involves determining whether or not there is a carry from
the addition of the kick to the address bits for this dimension.  The
{\sym XDCP}, {\sym YDCP}, and {\sym ZDCP} point to the appropriate carrys in
these additions (which are cut, but still made available for glue).


[form Kick Register section]

In order to update a space of $2^n$ cells, the {\sym Scan Index
Counter} ({\sym SIC}) counts from 0 to $2^n-1$.  The bits of this
count are then permuted (see {\sym PR}) to form the {\sym Site
Address}.  The {\sym DR} determines the interpretation of this {\sym Site
Address}: so many consecutive bits represent position in the $x$
dimension, then so many in $y$, in $z$, and possibly in additional
dimensions.  The permutation determines the order in which sites will
be accessed (useful for display purposes, for data shuffling, or for
scanning patches in order to count average quantities).

For each set of consecutive bits in the {\sym Site Address}
representing position in a given dimension, we can shift the origin of
the data by adding a constant to those bits.  The shifts for all the
dimensions are in the {\sym KAR}---if $k$ consecutive bits in the
{\sym Site Address} belong to one dimension, the corresponding $k$
bits in the {\sym KAR} give the shift in the origin of that dimension.

Only the $x$, $y$, and $z$ dimensions of the cell array within each
module can be arbitrarily extended by means of the glue wires that
join modules in three dimensions.  For each of these dimensions, we
need to distinguish between a positive and a negative shift in
origin---this is done by the 3 bits of the {\sym KSR}.  Note that
additional non-extendable ({\em internal\/}) dimensions don't need a
sign bit.  For example, if we have a (periodic) internal dimension of
length 4 (i.e., 2 bits of the {\sym Site Address} and the 2
corresponding bits of the {\sym KAR} are devoted to this dimension),
then a shift of one position to the left or three to the right
leads to the same result, so that we don't need a sign bit to
distinguish between the two cases.  If, on the other hand, the $z$
dimension is of length 4 within each module, but modules are glued
together to form a larger $z$ dimension, then we use the $z$ bit
in the {\sym KSR} to distinguish between the case where everything is shifted
left 1 position, and the case where everthing is shifted right 3
positions (the two $z$-bits of the {\sym KAR} are the same in both
cases).

Finally, using the same example, we need the three bits of the {\sym
KZFR} to distinguish, for $x$, $y$, and $z$, between a shift of $+4$,
a shift of $-4$, and a shift of 0, while all three cases would be
identical for an internal dimension of length 4.
