diff options
author | Gabe Black <gabeblack@google.com> | 2018-05-24 01:37:55 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-08-08 10:09:54 +0000 |
commit | 16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f (patch) | |
tree | 7b6faaacb4574a555e561534aa4a8508c0624c32 /src/systemc/tests/systemc/compliance_1666/test233 | |
parent | 7235d3b5211d0ba8f528d930a4c1e7ad62eec51a (diff) | |
download | gem5-16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f.tar.xz |
systemc: Import tests from the Accellera systemc distribution.
Change-Id: Iad76b398949a55d768a34d027a2d8e3739953da6
Reviewed-on: https://gem5-review.googlesource.com/10845
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/tests/systemc/compliance_1666/test233')
-rw-r--r-- | src/systemc/tests/systemc/compliance_1666/test233/golden/test233.log | 4 | ||||
-rw-r--r-- | src/systemc/tests/systemc/compliance_1666/test233/test233.cpp | 144 |
2 files changed, 148 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/compliance_1666/test233/golden/test233.log b/src/systemc/tests/systemc/compliance_1666/test233/golden/test233.log new file mode 100644 index 000000000..d1a84db9a --- /dev/null +++ b/src/systemc/tests/systemc/compliance_1666/test233/golden/test233.log @@ -0,0 +1,4 @@ +SystemC Simulation +Should be silent... + +Success diff --git a/src/systemc/tests/systemc/compliance_1666/test233/test233.cpp b/src/systemc/tests/systemc/compliance_1666/test233/test233.cpp new file mode 100644 index 000000000..55a2c190e --- /dev/null +++ b/src/systemc/tests/systemc/compliance_1666/test233/test233.cpp @@ -0,0 +1,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;
+}
|