summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/compliance_1666/test106
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-05-24 01:37:55 -0700
committerGabe Black <gabeblack@google.com>2018-08-08 10:09:54 +0000
commit16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f (patch)
tree7b6faaacb4574a555e561534aa4a8508c0624c32 /src/systemc/tests/systemc/compliance_1666/test106
parent7235d3b5211d0ba8f528d930a4c1e7ad62eec51a (diff)
downloadgem5-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/test106')
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test106/golden/test106.log7
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test106/test106.cpp50
2 files changed, 57 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/compliance_1666/test106/golden/test106.log b/src/systemc/tests/systemc/compliance_1666/test106/golden/test106.log
new file mode 100644
index 000000000..8f2cbd409
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test106/golden/test106.log
@@ -0,0 +1,7 @@
+SystemC Simulation
+T() 1 0
+T() 1 1
+T() 1 2
+T() 1 3
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test106/test106.cpp b/src/systemc/tests/systemc/compliance_1666/test106/test106.cpp
new file mode 100644
index 000000000..68c52d5a2
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test106/test106.cpp
@@ -0,0 +1,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;
+}