Using the following code from doulos tutorial on SystemC
#include "systemc.h"
#include
SC_MODULE(mon)
{
sc_in<bool> A,B,F;
sc_in<bool> Clk;
void monitor()
{
cout << setw(10) << "Time";
cout << setw(2) << "A" ;
cout << setw(2) << "B";
cout << setw(2) << "F" << endl;
while (true)
{
cout << setw(10) << sc_time_stamp();
cout << setw(2) << A.read();
cout << setw(2) << B.read();
cout << setw(2) << F.read() << endl;
wait(); // wait for 1 clock cycle
}
}
SC_CTOR(mon)
{
SC_THREAD(monitor);
sensitive << Clk.pos();
}
};
and a clock declaration sc_clock TestClk("TestClock", 10, SC_NS,0.5);
in the sc_main
the output contains results from time 0
but when the positive edge of the clock is delayed for 1 ns (i.e. sc_clock TestClk("TestClock", 10, SC_NS,0.5, 1, SC_NS);
) the output starts from time 1 ns.
This is logical as the first trigger of the process is delayed until 1 ns.
The question is isn't the simulation kernel supposed to run all the processes once at time zero!
According to this the results are supposed to start from time 0 in both cases. what am I missing here?