blob: 55a2c190ef9107af8e187b3bd0b7654ecffc81ab (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
#include <systemc>
#include <cstring>
using namespace sc_core;
using namespace sc_dt;
using std::cout;
using std::endl;
// 33) Process macros in (before_)end_of_elaboration
SC_MODULE(M)
{
SC_CTOR(M)
{
SC_THREAD(T);
}
void T()
{
}
void before_end_of_elaboration()
{
SC_THREAD(T1);
sc_process_handle h = sc_get_current_process_handle();
sc_assert(h.valid() == true);
sc_assert(strcmp(h.name(), "top.m.T1") == 0);
sc_assert(h.proc_kind() == SC_THREAD_PROC_);
sc_assert(h.get_process_object() != 0);
std::vector<sc_object*> children = h.get_child_objects();
sc_assert(children.size() == 0);
sc_assert(h.get_parent_object() == this);
sc_assert(h.terminated() == false);
sc_assert(h.dynamic() == false);
SC_METHOD(M1);
h = sc_get_current_process_handle();
sc_assert(h.valid() == true);
sc_assert(strcmp(h.name(), "top.m.M1") == 0);
sc_assert(h.proc_kind() == SC_METHOD_PROC_);
sc_assert(h.get_process_object() != 0);
children = h.get_child_objects();
sc_assert(children.size() == 0);
sc_assert(h.get_parent_object() == this);
sc_assert(h.terminated() == false);
sc_assert(h.dynamic() == false);
}
void end_of_elaboration()
{
SC_THREAD(T2);
sc_process_handle h = sc_get_current_process_handle();
sc_assert(h.valid() == true);
sc_assert(strcmp(h.name(), "top.m.T2") == 0);
sc_assert(h.proc_kind() == SC_THREAD_PROC_);
sc_assert(h.get_process_object() != 0);
std::vector<sc_object*> children = h.get_child_objects();
sc_assert(children.size() == 0);
sc_assert(h.get_parent_object() == this);
sc_assert(h.terminated() == false);
sc_assert(h.dynamic() == true);
SC_METHOD(M2);
h = sc_get_current_process_handle();
sc_assert(h.valid() == true);
sc_assert(strcmp(h.name(), "top.m.M2") == 0);
sc_assert(h.proc_kind() == SC_METHOD_PROC_);
sc_assert(h.get_process_object() != 0);
children = h.get_child_objects();
sc_assert(children.size() == 0);
sc_assert(h.get_parent_object() == this);
sc_assert(h.terminated() == false);
sc_assert(h.dynamic() == true);
}
void T1 ()
{
sc_process_handle h = sc_get_current_process_handle();
sc_assert(h.valid() == true);
sc_assert(strcmp(h.name(), "top.m.T1") == 0);
sc_assert(h.proc_kind() == SC_THREAD_PROC_);
sc_assert(h.get_process_object() != 0);
std::vector<sc_object*> children = h.get_child_objects();
sc_assert(children.size() == 0);
sc_assert(h.get_parent_object() == this);
sc_assert(h.terminated() == false);
sc_assert(h.dynamic() == false);
}
void M1 ()
{
sc_process_handle h = sc_get_current_process_handle();
sc_assert(h.valid() == true);
sc_assert(strcmp(h.name(), "top.m.M1") == 0);
sc_assert(h.proc_kind() == SC_METHOD_PROC_);
sc_assert(h.get_process_object() != 0);
std::vector<sc_object*> children = h.get_child_objects();
sc_assert(children.size() == 0);
sc_assert(h.get_parent_object() == this);
sc_assert(h.terminated() == false);
sc_assert(h.dynamic() == false);
}
void T2 ()
{
sc_process_handle h = sc_get_current_process_handle();
sc_assert(h.valid() == true);
sc_assert(strcmp(h.name(), "top.m.T2") == 0);
sc_assert(h.proc_kind() == SC_THREAD_PROC_);
sc_assert(h.get_process_object() != 0);
std::vector<sc_object*> children = h.get_child_objects();
sc_assert(children.size() == 0);
sc_assert(h.get_parent_object() == this);
sc_assert(h.terminated() == false);
sc_assert(h.dynamic() == true);
}
void M2 ()
{
sc_process_handle h = sc_get_current_process_handle();
sc_assert(h.valid() == true);
sc_assert(strcmp(h.name(), "top.m.M2") == 0);
sc_assert(h.proc_kind() == SC_METHOD_PROC_);
sc_assert(h.get_process_object() != 0);
std::vector<sc_object*> children = h.get_child_objects();
sc_assert(children.size() == 0);
sc_assert(h.get_parent_object() == this);
sc_assert(h.terminated() == false);
sc_assert(h.dynamic() == true);
}
};
struct Top: sc_module
{
M *m;
Top(sc_module_name)
{
m = new M("m");
}
};
int sc_main(int argc, char* argv[])
{
cout << "Should be silent..." << endl;
Top top("top");
sc_start();
cout << endl << "Success" << endl;
return 0;
}
|