This slide/section not lectured in 2017/18.
(Have seen blocking style on earlier slide.)
Example: Non-blocking (untimed) transactor for the four-phase handshake. Non-examinable Part II CST.
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 repeatedly called by the client until returning true.
14: (C) 2008-18, DJ Greaves, University of Cambridge, Computer Laboratory. |