\subsubsection{Synchronous programming}
An obvious application of synchronous programming ideas is in the
specification of synchronous circuits, such as those used to
describe the operation of systolic algorithms \cite{systol}.
Computation is performed by a network of cells connected together
by ``wires'', possibly with finite buffering. Data moves
rhythmically through the system, pulsed by an external clock.

It should be clear that an arbitrarily-connected network of cells
can be described using an (untimed) \Gentzen{} program. The
synchronous execution of such a system is then described by
merely ``extending over time'' their operation at a particular
time instant.  At every instant, the environment may supply input
and accept output from interface cells. More powerfully, using
Timed Negative Asks, a cell may sense if data was {\em not}
present on a wire in the past cycle, and take subsequent action.

A simple concrete example is provided by the obvious program for
computing the Fibonacci sequence. This consists of a single cell
containing an adder and a two-place buffer, with the output wired
into the input: 
\begin{ccprogram}
\agent fib(Val):: 
  \[\{Val:0\},  next\  \{Val:1\},
    always\  X\$\(Val:X 
                 -> (next\  \R (Y,Z)\$
                              ((Val:Y, Z\ is\ X+Y) -> (next\  \{Val:Z\}))\L)\)\]..
\end{ccprogram}

A harness for running the program is provided by:
\begin{ccprogram}
\agent main(N) :: 
  Index^\[watching\(Index:N, 
          \quad Val^\[fib(Val),counter(Index),
                      output(Val,Index,fib)\]\),
    whenever(Index:N, abort)\]..

\agent counter(Init, I):: 
  \[\{I:Init\}, always\ (X,X1)\$((I:X,X1\ is\ X+1) -> next\  \{I:X1 \})\]..

\agent output(In1, In2, Op):: 
  always\ (X,I)\$((In1:X, In2:I)  -> \{format('~p(~p)=~p.~n', [Op, I,X])\})..
\end{ccprogram}

Clearly, other synchronous algorithms can be implemented in a
similar way.
