blob: 68c52d5a2ce9c22ce5853eaeef6ef3ba6534e326 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include <systemc>
using sc_core::sc_delta_count;
using sc_core::sc_is_running;
using sc_core::SC_ZERO_TIME;
using sc_core::sc_start;
using sc_core::sc_event;
using sc_core::SC_NS;
using std::cout;
using std::endl;
// D.1 6) sc_delta_count()
SC_MODULE(M)
{
SC_CTOR(M)
{
SC_THREAD(T);
}
void T()
{
cout << "T() " << sc_is_running() << " " << sc_delta_count() << endl;
wait(10, SC_NS);
cout << "T() " << sc_is_running() << " " << sc_delta_count() << endl;
wait(10, SC_NS);
cout << "T() " << sc_is_running() << " " << sc_delta_count() << endl;
wait(10, SC_NS);
cout << "T() " << sc_is_running() << " " << sc_delta_count() << endl;
}
};
SC_MODULE(Top)
{
M *m;
SC_CTOR(Top)
{
m = new M("m");
}
};
int sc_main(int argc, char* argv[])
{
sc_assert(sc_delta_count() == 0);
Top top("top");
sc_start();
cout << endl << "Success" << endl;
return 0;
}
|