HOME   PREV   NEXT (Transactor Configurations)

Example H/W Protocol: 4/P Handshake

A common asynchronous protocol is the simple, four-phase handshake. Data is transferred once per complete handshake operation, which involves four phases.

Simple transactor code to convert the pin-level implementation so that software can call it can be implemented as follows:

  putbyte(char d)
  {
    wait_until(!ack);
    data = d;
    settle();
    req = 1;
    wait_until(ack);
    req = 0;
  }


  char getbyte()
  {
    wait_until(req);
    char r = data;
    ack = 1;
    wait_until(!req);
    ack = 0;
    return r;
  }

It is also possible to have transactors that keep their own thread and make up-calls to user callbacks for each transaction.