#include <stdio.h>
#include "parc.h"

using namespace parc;

module top {
public:
  char i;
  top() {
    i = 1;
  }

  signal<char> sig;

  process p1 {
    driver<char> drv1 = sig;
  start:
    for (; i < 5 ; i++) {
      printf("p1: %d\n",i);
      drv1 @= i;
      wait(5);
    }
  } a;

  process p2 {
    char d;
  start:
    for (;;) { @(sig) printf("p2: %d\n",sig); }
  } b;

  process p3 {
    char d; 
  start:
    migrate();
    for (;;) { 
      @(sig) 
      printf("p3: %d\n",sig); 
    }
  } c;

};

void test()
{
  top t;

  root()->StartAll();
}

int main(int argc,char **argv)
{
  test();
}