HOME       UP       PREV       NEXT (TLM in SystemC: TLM 1.0)  

Example of non-blocking coding styles:

(Have seen blocking style on earlier slide.)

Example: Non-blocking (untimed) transactor for the four-phase handshake.
  bool putbyte_nb_start(char d)
  {
    if (ack) return false;
    data = d;
    settle(); // A H/W delay for skew issues, 
    // or a memory fence in S/W for 
    // sequential consistency.
    req = 1;
    return true;
  }

  bool putbyte_nb_end(char d)
  {
    if (!ack) return false;
    req = 0;
    return true;
  }
  bool getbyte_nb_start(char &r)
  {
    if (!req) return false;
    r = data;
    ack = 1;
    return true;
  }
  
  bool getbyte_nb_end()
  {
    if (req) return false;
    ack = 0;
    return true;
  }

Both routines should be repeated by the client until returning true.

Four timing points may be of interest:


14: (C) 2008-11, DJ Greaves, University of Cambridge, Computer Laboratory.