A commonly-used, asynchronous, simplex protocol, with flow control.
putbyte(char d) { while(!ack) do wait(0, SC_NS); data = d; settle(); req = 1; while(ack) do wait(0, SC_NS); req = 0; } | char getbyte() { while(!req) do wait(0, SC_NS); char r = data; ack = 1; while(req) do wait(0, SC_NS); ack = 0; return r; } |
Example, untimed, blocking transactor: converts from transaction to pin-level modelling.
See working SystemC versions in the 'Toy ESL' practical material.