112855Sgabeblack@google.com// This tests that sc_clock values are updated during the value update phase
212855Sgabeblack@google.com// not during the execution phase of a delta cycle.
312855Sgabeblack@google.com
412855Sgabeblack@google.com#include "systemc.h"
512855Sgabeblack@google.com
612855Sgabeblack@google.com
712855Sgabeblack@google.comSC_MODULE(Test) {
812855Sgabeblack@google.com  sc_in_clk clk;
912855Sgabeblack@google.com  sc_event e1;
1012855Sgabeblack@google.com  sc_time d;
1112855Sgabeblack@google.com
1212855Sgabeblack@google.com  void main() {
1312855Sgabeblack@google.com    cerr << sc_time_stamp() <<" " << name() << " clk = " << clk.read() << "\n";
1412855Sgabeblack@google.com    e1.notify(d);
1512855Sgabeblack@google.com  }
1612855Sgabeblack@google.com  SC_CTOR(Test) :d(5,SC_NS) {
1712855Sgabeblack@google.com    SC_METHOD(main);
1812855Sgabeblack@google.com    sensitive << e1;
1912855Sgabeblack@google.com  }
2012855Sgabeblack@google.com};
2112855Sgabeblack@google.com
2212855Sgabeblack@google.com
2312855Sgabeblack@google.comint sc_main(int argc,char *argv[]) {
2412855Sgabeblack@google.com
2512855Sgabeblack@google.com  Test t1("t1");
2612855Sgabeblack@google.com  sc_clock clk("clk",10,SC_NS);
2712855Sgabeblack@google.com  Test t2("t2");
2812855Sgabeblack@google.com
2912855Sgabeblack@google.com  t1.clk(clk);
3012855Sgabeblack@google.com  t2.clk(clk);
3112855Sgabeblack@google.com
3212855Sgabeblack@google.com  sc_start(50,SC_NS);
3312855Sgabeblack@google.com  return 0;
3412855Sgabeblack@google.com}
35