The preferred coding style is more flexible: we pass a time accumulator variable called `delay' around for various models to augment where time would pass (clearly this causes far fewer entries to the SystemC kernel):
// Preferred coding style putbyte(char d, sc_time &delay) // The delay variable records how far ahead of kernel time this thread has advanced. { ... delay += sc_time(140, SC_NS); // It should be increment at each point where time would pass... }
But, at any point, any thread can resynch itself with the kernel by performing
// Resynch idiomatic form: sc_wait(delay); delay = 0;
Important note: Simulation performance is reduced when there are frequent resynchs, but true transaction ordering will be modelled correctly.
At a parallel fork, we need to make a fresh accumulator variable and at any join we continue with the larger delay (ignoring 'eureka' joins).