The Process Do-Loop



next up previous contents index
Next: Determinism Up: Creating Channels and Previous: The Process Block

The Process Do-Loop

     

A process do-loop creates multiple instances of the same process. It is identical in form to the do-loop, except that the keyword PROCESSDO  is used in place of DO the body can include only a process do-loop or a process call, and the keyword ENDPROCESSDO  is used in place of ENDDO . For example:

      processdo i = 1, n
         processcall myprocess
      endprocessdo
Process do-loops can be nested inside both process do-loops and process blocks. However, process blocks cannot be nested inside process do-loops.

We illustrate the use of the process do-loop in the ring1.fm program below. A total of nodes channels and processes are created, with the channels connecting the processes in a unidirectional ring.

==

      program ring1
      parameter (nodes=4)
      inport  (integer) pi(nodes)
      outport (integer) po(nodes)
      do i = 1, nodes
         channel(in=pi(i), out=po(mod(i,nodes)+1))
      enddo
      processdo i = 1, nodes
         processcall ringnode(i, pi(i), po(i))
      endprocessdo
      end
=1.03   

   



Steve Tuecke
Tue Aug 30 12:20:34 CDT 1994