SystemC LRM says:
6.4 sc_signal6.4.9 Member functions for eventsMember function event shall return the value true if and only if the value of the signal changed inthe update phase of the immediately preceding delta cycle and at the current simulation time
Then what about following code:
#include <systemc.h> #include <cassert> int sc_main(int, char *[]) { sc_signal<int> sig; sig.write(1); sc_start(); assert(sig.event()); sc_start(1, SC_NS); assert(sig.event()); return 0; }
In this example signal was changed at 0 ns, but event() function still returns true 1 ns after.
Considering the fact that LRM also says
4.5.5 Function sc_delta_count
The function sc_delta_count shall return an integer value that is incremented exactly once in each deltacycle in which at least one process is triggered or resumed and, thus, returns a count of the absolute numberof delta cycles that have occurred during simulation, starting from zero, ignoring any delta cycles in whichthere were no runnable processes
and describes delta cycle as
4.2.2 Initialization, cycles, and pauses in the scheduling algorithmA delta cycle is a sequence of steps in the scheduling algorithm consisting of the following steps in the order given:a) An evaluation phaseb ) An update phasec) A delta notification phase
Looks like the only way to make mq_signal<T>::event() work is to compare both time and delta count of the last change with current values, but current implementation only compares delta count.
So my question is: is this a bug or was it made on purpose for performance reasons?