(Have seen blocking style on earlier slide.)
Example: Non-blocking (untimed) transactor for the four-phase handshake (non-examinable).
bool nb_putbyte_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 nb_putbyte_end(char d)
{
if (!ack) return false;
req = 0;
return true;
}
| bool nb_getbyte_start(char &r)
{
if (!req) return false;
r = data;
ack = 1;
return true;
}
bool nb_getbyte_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: