summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/kernel/module_method_after_sc_start/module_method_after_sc_start.cpp
blob: d39696b46de14dc0acde439147bbe1a77da7b825 (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
#include "systemc.h"

SC_MODULE(Y)
{
public:
        sc_in<bool> in;
        SC_CTOR(Y) : in("in")
	{
		SC_METHOD(comb);
		sensitive << in;
		init = 1;
	}
	int             init;
	void comb()
	{
		if ( init )
		{
			init = 0;
			SC_METHOD(dork);
		}
	}
	void dork()
	{
		cout << "dork" << endl;
	}
};

int sc_main(int argc, char* arg[])
{
	sc_clock clock;
	Y        y("y");
        y.in(clock);


	sc_start(10, SC_NS);
	cerr << "Program completed" << endl;

    return 0;
}