summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/compliance_1666
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/tests/systemc/compliance_1666')
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test00/golden/test00.log9
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test00/test00.cpp384
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test001/golden/test001.log19
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test001/test001.cpp330
-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
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test200/golden/test200.log56
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test200/test200.cpp194
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test202/golden/test202.log6
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test202/test202.cpp49
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test203a/golden/test203a.log398
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test203a/test203a.cpp265
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test203b/golden/test203b.log4
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test203b/test203b.cpp68
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test205/golden/test205.log6
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test205/test205.cpp69
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test206/golden/test206.log4
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test206/test206.cpp103
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test207/golden/test207.log4
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test207/test207.cpp67
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test208/golden/test208.log4
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test208/test208.cpp238
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test209/golden/test209.log4
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test209/test209.cpp136
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test210/golden/test210.log4
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test210/test210.cpp120
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test211/golden/test211.log4
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test211/test211.cpp110
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test219/golden/test219.log4
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test219/test219.cpp79
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test220/golden/test220.log16
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test220/test220.cpp68
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test228/golden/test228.log6
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test228/test228.cpp107
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test233/golden/test233.log4
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test233/test233.cpp144
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test234/golden/test234.log6
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test234/test234.cpp110
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test235a/golden/test235a.log4
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test235a/test235a.cpp175
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test235b/golden/test235b.log25
-rw-r--r--src/systemc/tests/systemc/compliance_1666/test235b/test235b.cpp92
42 files changed, 3552 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/compliance_1666/test00/golden/test00.log b/src/systemc/tests/systemc/compliance_1666/test00/golden/test00.log
new file mode 100644
index 000000000..809bb8015
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test00/golden/test00.log
@@ -0,0 +1,9 @@
+SystemC Simulation
+Caught rpt Info: msg_type: msg
+Prim::Proc spawned and resumed
+Th::i=1
+Th::i=2
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test00/test00.cpp b/src/systemc/tests/systemc/compliance_1666/test00/test00.cpp
new file mode 100644
index 000000000..6541e9e0d
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test00/test00.cpp
@@ -0,0 +1,384 @@
+
+// General tests combining features of SystemC 2.1 and 1666
+
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+
+#include <systemc>
+using sc_core::sc_interface;
+using sc_core::sc_object;
+using sc_core::sc_port;
+using sc_core::sc_export;
+using sc_core::sc_module;
+using sc_core::sc_module_name;
+using sc_core::sc_in;
+using sc_core::sc_in_clk;
+using sc_core::sc_signal;
+using sc_core::sc_prim_channel;
+using sc_core::sc_event;
+using sc_core::sc_delta_count;
+using sc_core::sc_is_running;
+using sc_core::sc_get_top_level_objects;
+using sc_core::sc_find_object;
+using sc_core::sc_report;
+using sc_core::sc_report_handler;
+using sc_core::sc_actions;
+using sc_core::SC_INFO;
+using sc_core::SC_UNSPECIFIED;
+using sc_core::SC_THROW;
+using sc_core::sc_spawn;
+using sc_core::sc_process_handle;
+using sc_core::sc_get_current_process_handle;
+using sc_core::sc_time;
+using sc_core::sc_time_stamp;
+using sc_core::SC_ZERO_TIME;
+using sc_core::SC_PS;
+using sc_core::SC_NS;
+using sc_core::SC_US;
+using sc_core::sc_start_of_simulation_invoked;
+using sc_core::sc_end_of_simulation_invoked;
+using sc_core::sc_start;
+using sc_core::sc_stop;
+using sc_core::sc_copyright;
+using sc_core::sc_version;
+using sc_core::sc_release;
+using sc_dt::sc_abs;
+using sc_dt::sc_max;
+using sc_dt::sc_min;
+using sc_dt::sc_int;
+using sc_dt::sc_bigint;
+using std::cout;
+using std::endl;
+
+#if defined(IEEE_1666_CPLUSPLUS) && IEEE_1666_CPLUSPLUS >= 201103L
+// dynamic process macros have been moved to functions on C++11
+using sc_core::sc_bind;
+using sc_core::sc_ref;
+using sc_core::sc_cref;
+#endif // IEEE_1666_CPLUSPLUS
+
+struct i_f: virtual sc_interface
+{
+ virtual void write() = 0;
+};
+
+void check_form_of_suffix(std::string s)
+{
+ std::string charset = "0123456789";
+ while (!s.empty())
+ {
+ sc_assert(s[0] == '_');
+ s = s.substr(1);
+ sc_assert(!s.empty());
+ do
+ {
+ sc_assert(charset.find(s[0]) < charset.size());
+ s = s.substr(1);
+ } while (!s.empty() && (s[0] != '_'));
+ }
+}
+
+struct Chan: i_f, sc_object
+{
+ virtual void write()
+ {
+ sc_assert(std::string(name()).substr(0,17) == "top.m_dest.object");
+ check_form_of_suffix(std::string(name()).substr(17));
+ }
+};
+
+struct M_src: sc_core::sc_behavior
+{
+ sc_port<i_f>* p;
+ SC_HAS_PROCESS(M_src);
+
+ M_src(sc_module_name _name)
+ {
+ p = new sc_port<i_f>;
+
+ SC_THREAD(T);
+ }
+ void T()
+ {
+ (*p)->write();
+ }
+};
+
+struct M_dest: sc_core::sc_channel
+{
+ sc_export<i_f>* xp;
+ SC_HAS_PROCESS(M_dest);
+
+ M_dest(sc_module_name _name)
+ {
+ xp = new sc_export<i_f>;
+ Chan* ch = new Chan;
+ xp->bind(*ch);
+ }
+};
+
+void f()
+{
+ ::sc_core::wait(33, SC_PS);
+}
+
+struct Prim: sc_prim_channel
+{
+ Prim() : cref_arg(1) {}
+
+ void write() { request_update(); }
+
+ void update()
+ {
+ sc_spawn(sc_bind(&Prim::proc, this));
+ }
+
+ void proc()
+ {
+ ev.notify(SC_ZERO_TIME);
+ wait(ev);
+ cout << "Prim::Proc spawned and resumed" << endl;
+ SC_FORK
+ sc_spawn(sc_bind(&Prim::Th, this, 1)),
+ sc_spawn(sc_bind(&Prim::Th, this, 2))
+ SC_JOIN
+ sc_spawn(sc_bind(&Prim::Th_ref, this, sc_ref(ref_arg)));
+ sc_spawn(sc_bind(&Prim::Th_cref, this, sc_cref(cref_arg)));
+ wait(1, SC_NS);
+ sc_assert(ref_arg == 99);
+ }
+ sc_event ev;
+ void Th(int i)
+ {
+ cout << "Th::i=" << i << endl;
+ }
+ void Th_ref(int& arg)
+ {
+ arg = 99;
+ sc_time t(sc_time_stamp());
+ sc_process_handle h = sc_spawn(&f);
+ wait(h.terminated_event());
+ sc_assert(sc_time_stamp() == t + sc_time(33, SC_PS));
+ }
+ void Th_cref(const int& arg)
+ {
+ }
+ int ref_arg;
+ const int cref_arg;
+};
+
+SC_MODULE(M)
+{
+ Prim prim;
+ SC_CTOR(M)
+ {
+ SC_THREAD(T);
+ }
+
+ void T()
+ {
+ wait(10, SC_NS);
+ try {
+ sc_report_handler::set_actions("msg_type", SC_INFO, SC_THROW);
+ SC_REPORT_INFO("msg_type", "msg");
+ }
+ catch (sc_report& rpt) {
+ cout << "Caught rpt " << rpt.what() << endl;
+ sc_assert(rpt.get_severity() == SC_INFO);
+ sc_assert(std::string(rpt.get_msg_type()) == "msg_type");
+ sc_assert(std::string(rpt.get_msg()) == "msg");
+ sc_assert(rpt.get_time() == sc_time(10, SC_NS));
+ sc_assert(std::string(rpt.get_process_name()) == "top.m.T");
+
+ sc_assert(sc_report_handler::get_count(SC_INFO) == 1);
+ sc_report rpt2 = rpt; // Copy constructor
+
+ prim.write();
+
+ sc_spawn(sc_bind(&M::proc, this, &rpt2));
+ wait(100, SC_NS);
+ }
+ }
+ void proc(sc_report* rpt)
+ {
+ sc_assert(rpt->get_severity() == SC_INFO);
+ sc_assert(std::string(rpt->get_msg_type()) == "msg_type");
+ sc_assert(std::string(rpt->get_msg()) == "msg");
+ sc_assert(rpt->get_time() == sc_time(10, SC_NS));
+ sc_assert(std::string(rpt->get_process_name()) == "top.m.T");
+ rpt->get_file_name();
+ rpt->get_line_number();
+ }
+};
+
+struct CM: sc_module
+{
+ sc_in_clk clk;
+ sc_in<bool> reset;
+
+ SC_HAS_PROCESS(CM);
+
+ CM(sc_module_name _name)
+ : first(true)
+ {
+ SC_CTHREAD(CT, clk.pos());
+ reset_signal_is(reset, true);
+
+ sc_assert(sc_start_of_simulation_invoked() == false);
+ sc_assert(sc_end_of_simulation_invoked() == false);
+ sc_assert(sc_is_running() == false);
+ }
+
+ bool first;
+
+ void CT()
+ {
+ if (first)
+ sc_assert(sc_time_stamp() == sc_time(5, SC_US));
+ else
+ sc_assert(sc_time_stamp() == sc_time(30, SC_US));
+ first = false;
+
+ sc_assert(sc_start_of_simulation_invoked() == true);
+ sc_assert(sc_end_of_simulation_invoked() == false);
+ sc_assert(sc_is_running() == true);
+
+ while(1)
+ {
+ wait();
+ sc_assert(sc_time_stamp() == sc_time(15, SC_US));
+ wait();
+ sc_assert(sc_time_stamp() == sc_time(25, SC_US));
+ wait();
+ sc_assert(false);
+ }
+ }
+
+ void start_of_simulation()
+ {
+ sc_assert(sc_start_of_simulation_invoked() == false);
+ sc_assert(sc_end_of_simulation_invoked() == false);
+ sc_assert(sc_is_running() == false);
+ }
+
+ void end_of_simulation()
+ {
+ sc_assert(sc_start_of_simulation_invoked() == true);
+ sc_assert(sc_end_of_simulation_invoked() == false);
+ sc_assert(sc_is_running() == false);
+ }
+};
+
+SC_MODULE(Top)
+{
+ M *m;
+ CM *cm;
+
+ M_src m_src;
+ M_dest m_dest;
+
+ sc_signal<bool> clk, reset;
+
+ SC_CTOR(Top)
+ : m_src("m_src"), m_dest("m_dest")
+ {
+ m = new M("m");
+ cm = new CM("cm");
+ cm->clk(clk);
+ cm->reset(reset);
+
+ m_src.p->bind( *(m_dest.xp) ); // Port-export binding
+
+ SC_THREAD(T);
+ SC_THREAD(T2);
+ }
+ void T()
+ {
+ clk = false;
+ reset = true;
+ wait(5, SC_US);
+ clk = true;
+ wait(5, SC_US);
+ clk = false;
+ reset = false;
+ wait(5, SC_US);
+ clk = true;
+ wait(5, SC_US);
+ clk = false;
+ wait(5, SC_US);
+ clk = true;
+ wait(5, SC_US);
+ clk = false;
+ reset = true;
+ wait(10, SC_US);
+ }
+ void T2()
+ {
+ sc_assert(sc_min(-1,1) == -1);
+ sc_assert(sc_max(-1,1) == 1);
+ sc_assert(sc_abs(-1) == 1);
+
+ sc_assert(sc_min(sc_int<8>(-1),sc_int<8>(1)) == sc_int<8>(-1));
+ sc_assert(sc_max(sc_int<8>(-1),sc_int<8>(1)) == sc_int<8>(1));
+ sc_assert(sc_abs(sc_int<8>(-1)) == sc_int<8>(1));
+
+ sc_assert(sc_min(sc_bigint<256>(-1),sc_bigint<256>(1)) == sc_bigint<256>(-1));
+ sc_assert(sc_max(sc_bigint<256>(-1),sc_bigint<256>(1)) == sc_bigint<256>(1));
+ sc_assert(sc_abs(sc_bigint<256>(-1)) == sc_bigint<256>(1));
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_assert(sc_delta_count() == 0);
+ sc_assert(sc_is_running() == 0);
+ sc_assert(sc_time_stamp() == sc_time(SC_ZERO_TIME));
+ sc_assert(sc_report_handler::get_count(SC_INFO) == 0);
+ sc_assert(sc_report_handler::get_count("foo") == 0);
+
+ sc_actions act1 = sc_report_handler::get_new_action_id();
+ sc_actions act2 = sc_report_handler::get_new_action_id();
+ while (act2 != SC_UNSPECIFIED)
+ {
+ sc_assert(act2 != act1);
+ act2 = sc_report_handler::get_new_action_id();
+ }
+ sc_assert(sc_report_handler::get_log_file_name() == 0);
+ sc_assert(sc_get_top_level_objects().size() == 0);
+ sc_assert(sc_find_object("foo") == 0);
+ sc_assert(!sc_get_current_process_handle().valid());
+
+ sc_copyright();
+ sc_version();
+ std::string release = sc_release();
+ int n = release.find('.');
+ std::string major = release.substr(0,n);
+ release = release.substr(n+1,release.size()-1);
+ n = release.find('.');
+ std::string minor = release.substr(0,n);
+ release = release.substr(n+1,release.size()-1);
+ n = release.find('-');
+ std::string patch = release.substr(0,n);
+ std::string originator = release.substr(n+1,release.size());
+
+ std::string charset =
+ "abcdefghijklmnopqrstuvwxyzABSCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-";
+
+ for (unsigned int i = 0; i < major.size(); i++)
+ sc_assert(charset.find(major[i]) < charset.size());
+ for (unsigned int i = 0; i < minor.size(); i++)
+ sc_assert(charset.find(minor[i]) < charset.size());
+ for (unsigned int i = 0; i < patch.size(); i++)
+ sc_assert(charset.find(patch[i]) < charset.size());
+ for (unsigned int i = 0; i < originator.size(); i++)
+ sc_assert(charset.find(originator[i]) < charset.size());
+
+ Top top("top");
+ sc_start();
+
+ sc_stop();
+ sc_assert(sc_end_of_simulation_invoked() == true);
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test001/golden/test001.log b/src/systemc/tests/systemc/compliance_1666/test001/golden/test001.log
new file mode 100644
index 000000000..4f2aa1853
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test001/golden/test001.log
@@ -0,0 +1,19 @@
+SystemC Simulation
+Should be silent except for some renaming warnings...
+
+Warning: (W505) object already exists: top.mod0.thread. Latter declaration will be renamed to top.mod0.thread_0
+In file: <removed by verify.pl>
+
+Warning: (W505) object already exists: top.mod0.thread. Latter declaration will be renamed to top.mod0.thread_1
+In file: <removed by verify.pl>
+
+Warning: (W505) object already exists: top.mod0.thread. Latter declaration will be renamed to top.mod0.thread_2
+In file: <removed by verify.pl>
+
+Warning: (W505) object already exists: top.mod0.thread. Latter declaration will be renamed to top.mod0.thread_3
+In file: <removed by verify.pl>
+
+Warning: (W558) disable() or dont_initialize() called on process with no static sensitivity, it will be orphaned: top.mod0.method
+In file: <removed by verify.pl>
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test001/test001.cpp b/src/systemc/tests/systemc/compliance_1666/test001/test001.cpp
new file mode 100644
index 000000000..d40a7aa14
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test001/test001.cpp
@@ -0,0 +1,330 @@
+
+#include <systemc.h>
+
+// Tests for 2.0.1 extended coding styles, illustrating that SystemC is a class library, not a syntax
+
+static int global_count = 0;
+
+SC_MODULE(Mod)
+{
+ SC_CTOR(Mod)
+ {
+ sc_assert(std::string(this->kind()) == "sc_module");
+ }
+};
+
+
+
+SC_MODULE(Mod0)
+{
+ SC_CTOR(Mod0)
+ {
+ sc_assert(std::string(basename()) == "mod0");
+ SC_METHOD(method);
+ dont_initialize();
+ method(); //// Calling an SC_METHOD member function directly DOULOS009
+
+ for (int i = 0; i < 3; i++)
+ {
+ SC_THREAD(thread); //// Registering the same function multiple times DOULOS046
+ //// Get warnings re-defining sc_object names, multiple threads created
+ }
+ SC_THREAD(thread);
+ SC_THREAD(thread); //// Compile-time error - 'threadhandle' redefinition
+
+ f();
+ }
+ void method(void) {
+ sc_assert(sc_get_current_process_handle().proc_kind() == SC_METHOD_PROC_);
+ ++ global_count;
+ }
+ void thread(void) {
+ sc_assert(sc_get_current_process_handle().proc_kind() == SC_THREAD_PROC_);
+ ++ global_count;
+ }
+
+ void f() { SC_THREAD(g); } //// Process registered in member function called from constructor DOULOS007
+ void g()
+ {
+ sc_assert(std::string(sc_get_current_process_handle().name()) == "top.mod0.g");
+ ++ global_count;
+ }
+};
+
+
+struct Chan //// Pseudo-channel used for port-less interprocess communication
+ //// but not derived from sc_module, sc_prim_channel or sc_interface DOULOS048
+{
+ void write(int i) { wait(10, SC_NS); data = i; e.notify(); }
+ void read(int& i) { wait(e); i = data; }
+ int data;
+ bool wr, re;
+ sc_event e;
+};
+
+struct MyMod: Mod //// Class derived from an SC_MODULE DOULOS050
+{
+ sc_in<bool> p;
+
+ MyMod(sc_module_name n)
+ : Mod(n)
+ {
+ SC_THREAD(p1);
+ SC_THREAD(p2);
+ }
+
+ Chan ch; //// Instance of pseudo-channel DOULOS048
+ void p1() { ch.write(333); }
+ void p2() { int i; ch.read(i); sc_assert(i == 333); }
+
+ SC_HAS_PROCESS(MyMod);
+};
+
+
+
+struct C0: sc_module, virtual sc_interface //// Combining channel and interface in one class DOULOS015
+{
+ void write(int i) { data = i; }
+ void read(int& i) { i = data; }
+ int data;
+
+ SC_CTOR(C0)
+ {
+ SC_THREAD(action);
+ }
+ void action() {
+ sc_assert(std::string(sc_get_current_process_handle().get_process_object()->basename()) == "action");
+ }
+};
+
+
+struct C1: virtual public sc_interface //// Combining channel and interface in one class DOULOS015
+{
+ void write(int i) { data = i; }
+ void read(int& i) { i = data; }
+ int data;
+};
+
+
+struct I_F: virtual public sc_interface
+{
+ virtual void method() = 0;
+};
+
+struct C2: I_F //// Channel derived from neither sc_module nor sc_prim_channel DOULOS049
+{
+ void method() {}
+};
+
+struct C3: sc_object, I_F //// Channel derived from sc_object only
+ //// (and derived from neither sc_module nor sc_prim_channel) DOULOS049
+{
+ void method() {}
+};
+
+
+void check_form_of_suffix(std::string s)
+{
+ std::string charset = "0123456789";
+ while (!s.empty())
+ {
+ sc_assert(s[0] == '_');
+ s = s.substr(1);
+ sc_assert(!s.empty());
+ do
+ {
+ sc_assert(charset.find(s[0]) < charset.size());
+ s = s.substr(1);
+ } while (!s.empty() && (s[0] != '_'));
+ }
+}
+
+struct Modtype: sc_module
+{
+ Modtype(sc_module_name n = sc_gen_unique_name("Modtype"))
+ {
+ if (global_count == 0)
+ sc_assert(std::string(basename()) == "mt");
+ else
+ {
+ std::string s = std::string(basename());
+ sc_assert(s.substr(0,7) == "Modtype");
+ sc_assert(s.size() > 7);
+ check_form_of_suffix(s.substr(7));
+ }
+ ++ global_count;
+ }
+ void dump() {
+ sc_assert(std::string(sc_get_current_process_handle().get_process_object()->basename()) == "thread");
+ ++ global_count;
+ }
+};
+
+typedef sc_signal<Modtype*> MS; //// Pointer-to-module used as the type of a signal DOULOS051
+
+
+
+template<class T>
+struct S
+{
+ T t;
+};
+
+
+
+SC_MODULE(Moda)
+{
+ sc_port<C0> p0;
+ sc_port<C1> p1;
+ sc_port<C2> p2;
+ sc_port<C3> p3;
+ sc_port<MS> p4;
+
+ Modtype mt;
+
+ SC_CTOR(Moda): mt("mt")
+ {
+ sc_assert(std::string(name()) == "top.moda");
+ SC_THREAD(thread);
+ }
+ void thread();
+};
+
+SC_MODULE(Modb)
+{
+ sc_port<C0> p0;
+ sc_port<C1> p1;
+ sc_port<C2> p2;
+ sc_port<C3> p3;
+ sc_port<MS> p4;
+
+ SC_CTOR(Modb)
+ {
+ sc_assert(std::string(name()) == "top.modb");
+ SC_THREAD(thread);
+ SC_THREAD(funny);
+ }
+ void thread();
+ void funny();
+};
+
+void Moda::thread()
+{
+ p1->write(999);
+ p2->method();
+ p3->method();
+ p4->write(&mt);
+}
+void Modb::thread()
+{
+ wait(SC_ZERO_TIME);
+ int i; p1->read(i);
+ sc_assert(i == 999);
+ p2->method();
+ p3->method();
+ wait(SC_ZERO_TIME);
+ (p4->read())->dump();
+}
+
+void Modb::funny() { C1 c1; C2 c2; C3 c3; }
+
+
+
+
+struct Link
+{
+ Link *link;
+ sc_module *m; //// Pointer-to-module DOULOS006
+ sc_signal<int> *s; //// Pointer-to-signal
+ sc_in<int> *p; //// Pointer-to-port DOULOS008
+};
+
+SC_MODULE(Top)
+{
+
+ SC_MODULE(Nested) //// Nested modules DOULOS005
+ {
+ sc_in<int> *pp; //// Pointer-to-port DOULOS008
+
+ SC_CTOR(Nested)
+ {
+ SC_METHOD(action);
+
+ pp = new sc_in<int>; //// Dynamic port instantiation DOULOS008
+
+ sensitive << *pp; //// Sensitivity separated from SC_METHOD DOULOS011
+ }
+
+ void action() { op = sc_min(3, (*pp).read() + 1); }
+
+ sc_out<int> op; //// Out-of-order declaration DOULOS052
+ };
+
+
+ Nested n;
+ Link* link;
+ sc_signal<bool> b;
+ sc_signal<int> *sig; //// Pointer-to-signal
+
+ MyMod mymod;
+ Moda moda;
+ Modb modb;
+ C0 c0;
+ C1 c1;
+ C2 c2;
+ C3 c3;
+
+ S<Modtype> Sm; //// Using sc_module as a template parameter DOULOS051
+ MS ms; //// Pointer-to-module used as the type of a signal DOULOS051
+
+ Mod0 mod0;
+
+ SC_CTOR(Top)
+ : n("n"), mymod("mymod"), moda("moda"), modb("modb"), c0("c0"), mod0("mod0")
+ {
+ link = new Link;
+ link->m = new Mod("mod_1");
+ link->p = new sc_in<int>;
+ link->link = new Link;
+ link->link->m = new Mod("mod_2"); //// Buried dynamic module instantiation DOULOS002
+ link->link->s = new sc_signal<int>;//// Buried dynamic channel instantiation
+ link->link->p = new sc_in<int>; //// Buried dynamic port instantiation DOULOS008
+
+ sig = new sc_signal<int>; //// Dynamic channel instantiation
+ n.op(*sig);
+ (*(n.pp)).bind(*sig); //// Binding dynamically allocated port DOULOS008
+
+ mymod.p(b);
+
+ moda.p0(c0);
+ moda.p1(c1);
+ moda.p2(c2);
+ moda.p3(c3);
+ moda.p4(ms);
+
+ modb.p0(c0);
+ modb.p1(c1);
+ modb.p2(c2);
+ modb.p3(c3);
+ modb.p4(ms);
+ }
+
+};
+
+
+int sc_main(int argc, char* argv[])
+{
+ cout << "Should be silent except for some renaming warnings..." << endl;
+
+ sc_signal<int> s;
+ Top top("top");
+ top.link->p->bind(s);
+ top.link->link->p->bind(s); //// Binding dynamically allocated port DOULOS008
+
+ sc_start();
+ sc_assert(global_count == 10);
+ sc_assert(top.sig->read() == 3);
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
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;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test200/golden/test200.log b/src/systemc/tests/systemc/compliance_1666/test200/golden/test200.log
new file mode 100644
index 000000000..b4a7d0f5f
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test200/golden/test200.log
@@ -0,0 +1,56 @@
+SystemC Simulation
+Should be silent except for reports ...
+
+Warning: (W505) object already exists: top.m.T. Latter declaration will be renamed to top.m.T_0
+In file: <removed by verify.pl>
+
+Warning: (W505) object already exists: top.m.T. Latter declaration will be renamed to top.m.T_1
+In file: <removed by verify.pl>
+
+Info: type: msg
+
+Warning: type: msg
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Error: type: msg
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Fatal: type: msg
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Info: type: msg
+
+Warning: type: msg
+In file: <removed by verify.pl>
+In process: top.m.T_0 @ 0 s
+
+Error: type: msg
+In file: <removed by verify.pl>
+In process: top.m.T_0 @ 0 s
+
+Fatal: type: msg
+In file: <removed by verify.pl>
+In process: top.m.T_0 @ 0 s
+
+Info: type: msg
+
+Warning: type: msg
+In file: <removed by verify.pl>
+In process: top.m.T_1 @ 0 s
+
+Error: type: msg
+In file: <removed by verify.pl>
+In process: top.m.T_1 @ 0 s
+
+Fatal: type: msg
+In file: <removed by verify.pl>
+In process: top.m.T_1 @ 0 s
+
+Error: type: msg
+In file: <removed by verify.pl>
+In process: top.m.R @ 100 ns
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test200/test200.cpp b/src/systemc/tests/systemc/compliance_1666/test200/test200.cpp
new file mode 100644
index 000000000..5f68240aa
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test200/test200.cpp
@@ -0,0 +1,194 @@
+#include <systemc.h>
+
+// Multiple tests for Annex D.1 and D.2
+
+struct i_f: virtual sc_interface
+{
+};
+
+struct Chan: i_f, sc_object
+{
+};
+
+struct Port: sc_port<i_f>
+{
+ Chan chan;
+};
+
+void check_form_of_suffix(std::string s)
+{
+ std::string charset = "0123456789";
+ while (!s.empty())
+ {
+ sc_assert(s[0] == '_');
+ s = s.substr(1);
+ sc_assert(!s.empty());
+ do
+ {
+ sc_assert(charset.find(s[0]) < charset.size());
+ s = s.substr(1);
+ } while (!s.empty() && (s[0] != '_'));
+ }
+}
+
+SC_MODULE(M)
+{
+ Port port;
+
+ SC_CTOR(M)
+ {
+ SC_THREAD(T);
+ std::string s1 = std::string(sc_get_current_process_handle().name());
+ sc_assert(s1.substr(0,7) == "top.m.T");
+ check_form_of_suffix(s1.substr(7));
+
+ SC_THREAD(T);
+ std::string s2 = std::string(sc_get_current_process_handle().name());
+ sc_assert(s2.substr(0,7) == "top.m.T");
+ check_form_of_suffix(s2.substr(7));
+
+ SC_THREAD(T);
+ std::string s3 = std::string(sc_get_current_process_handle().name());
+ sc_assert(s3.substr(0,7) == "top.m.T");
+ check_form_of_suffix(s3.substr(7));
+
+ sc_assert(s1 != s2);
+ sc_assert(s2 != s3);
+ sc_assert(s3 != s1);
+
+ SC_THREAD(R);
+ }
+
+ void end_of_elaboration()
+ {
+ sc_assert(port.get_parent_object() == this);
+ sc_assert(port.chan.get_parent_object() == this);
+ sc_assert(get_child_objects().size() == 6);
+ }
+
+ void T()
+ {
+ int i_count = sc_report_handler::get_count(SC_INFO);
+ int w_count = sc_report_handler::get_count(SC_WARNING);
+ int e_count = sc_report_handler::get_count(SC_ERROR);
+ int f_count = sc_report_handler::get_count(SC_FATAL);
+
+ sc_report_handler::set_actions(SC_INFO, SC_DO_NOTHING);
+ sc_report_handler::set_actions(SC_WARNING, SC_DO_NOTHING);
+ sc_report_handler::set_actions(SC_ERROR, SC_DO_NOTHING);
+ sc_report_handler::set_actions(SC_FATAL, SC_DO_NOTHING);
+
+ SC_REPORT_INFO("type", "msg");
+
+ sc_assert(sc_report_handler::get_count(SC_INFO) == i_count + 1);
+ sc_assert(sc_report_handler::get_count(SC_WARNING) == w_count);
+ sc_assert(sc_report_handler::get_count(SC_ERROR) == e_count);
+ sc_assert(sc_report_handler::get_count(SC_FATAL) == f_count);
+
+ SC_REPORT_WARNING("type", "msg");
+
+ sc_assert(sc_report_handler::get_count(SC_INFO) == i_count + 1);
+ sc_assert(sc_report_handler::get_count(SC_WARNING) == w_count + 1);
+ sc_assert(sc_report_handler::get_count(SC_ERROR) == e_count);
+ sc_assert(sc_report_handler::get_count(SC_FATAL) == f_count);
+
+ SC_REPORT_ERROR("type", "msg");
+
+ sc_assert(sc_report_handler::get_count(SC_INFO) == i_count + 1);
+ sc_assert(sc_report_handler::get_count(SC_WARNING) == w_count + 1);
+ sc_assert(sc_report_handler::get_count(SC_ERROR) == e_count + 1);
+ sc_assert(sc_report_handler::get_count(SC_FATAL) == f_count);
+
+ SC_REPORT_FATAL("type", "msg");
+
+ sc_assert(sc_report_handler::get_count(SC_INFO) == i_count + 1);
+ sc_assert(sc_report_handler::get_count(SC_WARNING) == w_count + 1);
+ sc_assert(sc_report_handler::get_count(SC_ERROR) == e_count + 1);
+ sc_assert(sc_report_handler::get_count(SC_FATAL) == f_count + 1);
+
+ sc_report_handler::set_actions(SC_INFO, SC_DISPLAY);
+ sc_report_handler::set_actions(SC_WARNING, SC_DISPLAY);
+ sc_report_handler::set_actions(SC_ERROR, SC_DISPLAY);
+ sc_report_handler::set_actions(SC_FATAL, SC_DISPLAY);
+
+ SC_REPORT_INFO("type", "msg");
+
+ sc_assert(sc_report_handler::get_count(SC_INFO) == i_count + 2);
+ sc_assert(sc_report_handler::get_count(SC_WARNING) == w_count + 1);
+ sc_assert(sc_report_handler::get_count(SC_ERROR) == e_count + 1);
+ sc_assert(sc_report_handler::get_count(SC_FATAL) == f_count + 1);
+
+ SC_REPORT_WARNING("type", "msg");
+
+ sc_assert(sc_report_handler::get_count(SC_INFO) == i_count + 2);
+ sc_assert(sc_report_handler::get_count(SC_WARNING) == w_count + 2);
+ sc_assert(sc_report_handler::get_count(SC_ERROR) == e_count + 1);
+ sc_assert(sc_report_handler::get_count(SC_FATAL) == f_count + 1);
+
+ SC_REPORT_ERROR("type", "msg");
+
+ sc_assert(sc_report_handler::get_count(SC_INFO) == i_count + 2);
+ sc_assert(sc_report_handler::get_count(SC_WARNING) == w_count + 2);
+ sc_assert(sc_report_handler::get_count(SC_ERROR) == e_count + 2);
+ sc_assert(sc_report_handler::get_count(SC_FATAL) == f_count + 1);
+
+ SC_REPORT_FATAL("type", "msg");
+
+ sc_assert(sc_report_handler::get_count(SC_INFO) == i_count + 2);
+ sc_assert(sc_report_handler::get_count(SC_WARNING) == w_count + 2);
+ sc_assert(sc_report_handler::get_count(SC_ERROR) == e_count + 2);
+ sc_assert(sc_report_handler::get_count(SC_FATAL) == f_count + 2);
+ }
+ void R()
+ {
+ wait(100, SC_NS);
+
+ int i_count = sc_report_handler::get_count(SC_INFO);
+ int w_count = sc_report_handler::get_count(SC_WARNING);
+ int e_count = sc_report_handler::get_count(SC_ERROR);
+ int f_count = sc_report_handler::get_count(SC_FATAL);
+
+ try {
+ SC_REPORT_ERROR("type", "msg");
+ }
+ catch (sc_report& rpt) {
+ sc_assert(rpt.get_severity() == SC_ERROR);
+ sc_assert(strcmp(rpt.get_msg_type(), "type") == 0);
+ sc_assert(strcmp(rpt.get_msg(), "msg") == 0);
+ sc_assert(rpt.get_time() == sc_time(0, SC_NS));
+ sc_assert(strcmp(rpt.get_process_name(), "top.m.R") == 0);
+ }
+
+ sc_assert(sc_report_handler::get_count(SC_INFO) == i_count);
+ sc_assert(sc_report_handler::get_count(SC_WARNING) == w_count);
+ sc_assert(sc_report_handler::get_count(SC_ERROR) == e_count + 1);
+ sc_assert(sc_report_handler::get_count(SC_FATAL) == f_count);
+ }
+};
+
+SC_MODULE(Top)
+{
+ M *m;
+ Chan *chan;
+ SC_CTOR(Top)
+ {
+ m = new M("m");
+ chan = new Chan;
+ m->port.bind(*chan);
+ }
+ void end_of_elaboration()
+ {
+ sc_assert(get_child_objects().size() == 2);
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ cout << "Should be silent except for reports ..." << endl;
+
+ Top top("top");
+ sc_start();
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test202/golden/test202.log b/src/systemc/tests/systemc/compliance_1666/test202/golden/test202.log
new file mode 100644
index 000000000..6dbc6d5c7
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test202/golden/test202.log
@@ -0,0 +1,6 @@
+SystemC Simulation
+Should be silent...
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test202/test202.cpp b/src/systemc/tests/systemc/compliance_1666/test202/test202.cpp
new file mode 100644
index 000000000..8d8fec5dd
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test202/test202.cpp
@@ -0,0 +1,49 @@
+#include <systemc>
+#include <cstring>
+using namespace sc_core;
+using namespace sc_dt;
+using std::cout;
+using std::endl;
+
+// 2) sc_clock - start_time and posedge_first (in addition to period and duty_cycle)
+
+SC_MODULE(M)
+{
+ SC_CTOR(M)
+ {
+ SC_THREAD(T);
+ }
+ void T()
+ {
+ wait(10, SC_NS);
+ sc_stop();
+ }
+};
+
+struct Top: sc_module
+{
+ sc_clock clk;
+ M *m;
+ Top(sc_module_name)
+ : clk("clk", 20, SC_NS, 0.75, 5, SC_NS, false)
+ {
+ m = new M("m");
+ sc_assert(strcmp(clk.name(), "top.clk") == 0);
+ sc_assert(strcmp(clk.kind(), "sc_clock") == 0);
+ sc_assert(clk.period() == sc_time(20, SC_NS));
+ sc_assert(clk.duty_cycle() == 0.75);
+ sc_assert(clk.start_time() == sc_time(5, SC_NS));
+ sc_assert(clk.posedge_first() == false);
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ cout << "Should be silent..." << endl;
+
+ Top top("top");
+ sc_start();
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test203a/golden/test203a.log b/src/systemc/tests/systemc/compliance_1666/test203a/golden/test203a.log
new file mode 100644
index 000000000..74a57a017
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test203a/golden/test203a.log
@@ -0,0 +1,398 @@
+SystemC Simulation
+Should be silent except for warning messages
+There should be warning 11 messages
+
+Warning: (W570) attempt to use an empty process handle ignored: disable()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: enable()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: is_unwinding()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: kill()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: reset()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: resume()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: suspend()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_off()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_on()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: terminated_event()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: throw_it()
+In file: <removed by verify.pl>
+End of warning messages
+There should be warning 11 messages
+
+Warning: (W570) attempt to use an empty process handle ignored: disable()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: enable()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: is_unwinding()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: kill()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: reset()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: resume()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: suspend()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_off()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_on()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: terminated_event()
+In file: <removed by verify.pl>
+
+Warning: (W570) attempt to use an empty process handle ignored: throw_it()
+In file: <removed by verify.pl>
+End of warning messages
+There should be warning 11 messages
+
+Warning: (W570) attempt to use an empty process handle ignored: disable()
+In file: <removed by verify.pl>
+In process: top.m.ME @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: enable()
+In file: <removed by verify.pl>
+In process: top.m.ME @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: is_unwinding()
+In file: <removed by verify.pl>
+In process: top.m.ME @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: kill()
+In file: <removed by verify.pl>
+In process: top.m.ME @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: reset()
+In file: <removed by verify.pl>
+In process: top.m.ME @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: resume()
+In file: <removed by verify.pl>
+In process: top.m.ME @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: suspend()
+In file: <removed by verify.pl>
+In process: top.m.ME @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_off()
+In file: <removed by verify.pl>
+In process: top.m.ME @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_on()
+In file: <removed by verify.pl>
+In process: top.m.ME @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: terminated_event()
+In file: <removed by verify.pl>
+In process: top.m.ME @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: throw_it()
+In file: <removed by verify.pl>
+In process: top.m.ME @ 0 s
+End of warning messages
+There should be warning 11 messages
+
+Warning: (W570) attempt to use an empty process handle ignored: disable()
+In file: <removed by verify.pl>
+In process: top.m.stat_method @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: enable()
+In file: <removed by verify.pl>
+In process: top.m.stat_method @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: is_unwinding()
+In file: <removed by verify.pl>
+In process: top.m.stat_method @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: kill()
+In file: <removed by verify.pl>
+In process: top.m.stat_method @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: reset()
+In file: <removed by verify.pl>
+In process: top.m.stat_method @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: resume()
+In file: <removed by verify.pl>
+In process: top.m.stat_method @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: suspend()
+In file: <removed by verify.pl>
+In process: top.m.stat_method @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_off()
+In file: <removed by verify.pl>
+In process: top.m.stat_method @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_on()
+In file: <removed by verify.pl>
+In process: top.m.stat_method @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: terminated_event()
+In file: <removed by verify.pl>
+In process: top.m.stat_method @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: throw_it()
+In file: <removed by verify.pl>
+In process: top.m.stat_method @ 0 s
+End of warning messages
+There should be warning 11 messages
+
+Warning: (W570) attempt to use an empty process handle ignored: disable()
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: enable()
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: is_unwinding()
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: kill()
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: reset()
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: resume()
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: suspend()
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_off()
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_on()
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: terminated_event()
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: throw_it()
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+End of warning messages
+There should be warning 11 messages
+
+Warning: (W570) attempt to use an empty process handle ignored: disable()
+In file: <removed by verify.pl>
+In process: top.m.stat_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: enable()
+In file: <removed by verify.pl>
+In process: top.m.stat_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: is_unwinding()
+In file: <removed by verify.pl>
+In process: top.m.stat_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: kill()
+In file: <removed by verify.pl>
+In process: top.m.stat_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: reset()
+In file: <removed by verify.pl>
+In process: top.m.stat_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: resume()
+In file: <removed by verify.pl>
+In process: top.m.stat_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: suspend()
+In file: <removed by verify.pl>
+In process: top.m.stat_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_off()
+In file: <removed by verify.pl>
+In process: top.m.stat_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_on()
+In file: <removed by verify.pl>
+In process: top.m.stat_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: terminated_event()
+In file: <removed by verify.pl>
+In process: top.m.stat_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: throw_it()
+In file: <removed by verify.pl>
+In process: top.m.stat_thread @ 0 s
+End of warning messages
+There should be warning 11 messages
+
+Warning: (W570) attempt to use an empty process handle ignored: disable()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: enable()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: is_unwinding()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: kill()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: reset()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: resume()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: suspend()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_off()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_on()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: terminated_event()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_thread @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: throw_it()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_thread @ 0 s
+End of warning messages
+There should be warning 11 messages
+
+Warning: (W570) attempt to use an empty process handle ignored: disable()
+In file: <removed by verify.pl>
+In process: top.m.CT @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: enable()
+In file: <removed by verify.pl>
+In process: top.m.CT @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: is_unwinding()
+In file: <removed by verify.pl>
+In process: top.m.CT @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: kill()
+In file: <removed by verify.pl>
+In process: top.m.CT @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: reset()
+In file: <removed by verify.pl>
+In process: top.m.CT @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: resume()
+In file: <removed by verify.pl>
+In process: top.m.CT @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: suspend()
+In file: <removed by verify.pl>
+In process: top.m.CT @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_off()
+In file: <removed by verify.pl>
+In process: top.m.CT @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_on()
+In file: <removed by verify.pl>
+In process: top.m.CT @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: terminated_event()
+In file: <removed by verify.pl>
+In process: top.m.CT @ 0 s
+
+Warning: (W570) attempt to use an empty process handle ignored: throw_it()
+In file: <removed by verify.pl>
+In process: top.m.CT @ 0 s
+End of warning messages
+There should be warning 11 messages
+
+Warning: (W570) attempt to use an empty process handle ignored: disable()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_method @ 1 ns
+
+Warning: (W570) attempt to use an empty process handle ignored: enable()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_method @ 1 ns
+
+Warning: (W570) attempt to use an empty process handle ignored: is_unwinding()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_method @ 1 ns
+
+Warning: (W570) attempt to use an empty process handle ignored: kill()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_method @ 1 ns
+
+Warning: (W570) attempt to use an empty process handle ignored: reset()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_method @ 1 ns
+
+Warning: (W570) attempt to use an empty process handle ignored: resume()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_method @ 1 ns
+
+Warning: (W570) attempt to use an empty process handle ignored: suspend()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_method @ 1 ns
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_off()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_method @ 1 ns
+
+Warning: (W570) attempt to use an empty process handle ignored: sync_reset_on()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_method @ 1 ns
+
+Warning: (W570) attempt to use an empty process handle ignored: terminated_event()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_method @ 1 ns
+
+Warning: (W570) attempt to use an empty process handle ignored: throw_it()
+In file: <removed by verify.pl>
+In process: top.m.T.dyn_method @ 1 ns
+End of warning messages
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test203a/test203a.cpp b/src/systemc/tests/systemc/compliance_1666/test203a/test203a.cpp
new file mode 100644
index 000000000..ad2a6b0f0
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test203a/test203a.cpp
@@ -0,0 +1,265 @@
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+
+#include <systemc>
+#include <cstring>
+using namespace sc_core;
+using namespace sc_dt;
+using std::cout;
+using std::endl;
+
+// 3) Process handle methods, including invalid and terminated process
+
+void invalid_handle_check(sc_process_handle& h)
+{
+
+ sc_assert(h.valid() == false);
+ sc_assert(strcmp(h.name(), "") == 0);
+ sc_assert(h.proc_kind() == SC_NO_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() == 0);
+ sc_assert(h.terminated() == false);
+ sc_assert(h.dynamic() == false);
+ sc_assert( !(h == h) );
+ sc_assert(h != h);
+
+ cout << "There should be warning 11 messages" << endl;
+
+ h.disable();
+ h.enable();
+ h.is_unwinding();
+ h.kill();
+ h.reset();
+ h.resume();
+ h.suspend();
+ h.sync_reset_off();
+ h.sync_reset_on();
+ h.terminated_event();
+ h.throw_it(sc_user(), SC_NO_DESCENDANTS);
+
+ cout << "End of warning messages" << endl;
+}
+
+SC_MODULE(M)
+{
+ sc_in_clk clk;
+ SC_CTOR(M)
+ {
+ sc_process_handle h;
+ invalid_handle_check(h);
+
+ SC_THREAD(T);
+ SC_CTHREAD(CT, clk.pos());
+ SC_METHOD(ME);
+
+ sc_process_handle h3 = sc_spawn(sc_bind(&M::stat_thread, this), "stat_thread");
+ sc_spawn_options opt;
+ opt.spawn_method();
+ sc_process_handle h4 = sc_spawn(sc_bind(&M::stat_method, this), "stat_method", &opt);
+
+ std::vector<sc_object*> children = this->get_child_objects();
+ sc_assert(children.size() == 6);
+ }
+ void T()
+ {
+ sc_process_handle h;
+ invalid_handle_check(h);
+
+ sc_process_handle h2 = sc_get_current_process_handle();
+ sc_assert(h2.valid() == true);
+ sc_assert(strcmp(h2.name(), "top.m.T") == 0);
+ sc_assert(h2.proc_kind() == SC_THREAD_PROC_);
+ sc_assert(h2.get_process_object() != 0);
+ std::vector<sc_object*> children2 = h2.get_child_objects();
+ sc_assert(children2.size() == 0);
+ sc_assert(h2.get_parent_object() == this);
+ sc_assert(h2.terminated() == false);
+ sc_assert(h2.dynamic() == false);
+ sc_assert(h2 == h2);
+ sc_assert(h2 != h);
+
+ sc_process_handle h3 = sc_spawn(sc_bind(&M::dyn_thread, this), "dyn_thread");
+ wait(1, SC_NS);
+
+ if (h3.valid() == true)
+ {
+ sc_assert(strcmp(h3.name(), "top.m.T.dyn_thread") == 0);
+ sc_assert(h3.proc_kind() == SC_THREAD_PROC_);
+ sc_assert(h3.get_process_object() != 0);
+ std::vector<sc_object*> children3 = h3.get_child_objects();
+ sc_assert(children3.size() == 0);
+ sc_assert(h3.get_parent_object() == sc_get_current_process_handle().get_process_object());
+ sc_assert(h3.terminated() == true);
+ sc_assert(h3.dynamic() == true);
+ sc_assert(h3 == h3);
+ sc_assert( !(h3 != h3) );
+ }
+
+ sc_spawn_options opt;
+ opt.spawn_method();
+ sc_process_handle h4 = sc_spawn(sc_bind(&M::dyn_method, this), "dyn_method", &opt);
+ sc_assert(h4 != h3);
+
+ wait(10, SC_NS);
+ sc_stop();
+ }
+
+ void stat_thread()
+ {
+ sc_process_handle h;
+ invalid_handle_check(h);
+
+ wait(5, SC_NS);
+
+ sc_process_handle h3 = sc_get_current_process_handle();
+ sc_assert(h3.valid() == true);
+ sc_assert(strcmp(h3.name(), "top.m.stat_thread") == 0);
+ sc_assert(h3.proc_kind() == SC_THREAD_PROC_);
+ sc_assert(h3.get_process_object() != 0);
+ std::vector<sc_object*> children3 = h3.get_child_objects();
+ sc_assert(children3.size() == 0);
+ sc_assert(h3.get_parent_object() != 0);
+ sc_assert(h3.terminated() == false);
+ sc_assert(h3.dynamic() == false);
+ sc_assert(h3 == h3);
+ sc_assert(h3 != h);
+
+ sc_process_handle h4;
+ h4 = h3;
+ sc_assert(h4 == h3);
+ sc_assert(h4 != h);
+ }
+
+ void stat_method()
+ {
+ sc_process_handle h;
+ invalid_handle_check(h);
+
+ sc_process_handle h3 = sc_get_current_process_handle();
+ sc_assert(h3.valid() == true);
+ sc_assert(strcmp(h3.name(), "top.m.stat_method") == 0);
+ sc_assert(h3.proc_kind() == SC_METHOD_PROC_);
+ sc_assert(h3.get_process_object() != 0);
+ std::vector<sc_object*> children3 = h3.get_child_objects();
+ sc_assert(children3.size() == 0);
+ sc_assert(h3.get_parent_object() != 0);
+ sc_assert(h3.terminated() == false);
+ sc_assert(h3.dynamic() == false);
+ sc_assert(h3 == h3);
+ sc_assert(h3 != h);
+
+ sc_process_handle h4;
+ h4 = h3;
+ sc_assert(h4 == h3);
+ sc_assert(h4 != h);
+ }
+
+ void dyn_thread()
+ {
+ sc_process_handle h;
+ invalid_handle_check(h);
+
+ sc_process_handle h3 = sc_get_current_process_handle();
+ sc_assert(h3.valid() == true);
+ sc_assert(strcmp(h3.name(), "top.m.T.dyn_thread") == 0);
+ sc_assert(h3.proc_kind() == SC_THREAD_PROC_);
+ sc_assert(h3.get_process_object() != 0);
+ std::vector<sc_object*> children3 = h3.get_child_objects();
+ sc_assert(children3.size() == 0);
+ sc_assert(h3.get_parent_object() != 0);
+ sc_assert(h3.terminated() == false);
+ sc_assert(h3.dynamic() == true);
+ sc_assert(h3 == h3);
+ sc_assert(h3 != h);
+
+ sc_process_handle h4(h3);
+ sc_assert(h4 == h3);
+ }
+
+ void dyn_method()
+ {
+ sc_process_handle h;
+ invalid_handle_check(h);
+
+ sc_process_handle h3 = sc_get_current_process_handle();
+ sc_assert(h3.valid() == true);
+ sc_assert(strcmp(h3.name(), "top.m.T.dyn_method") == 0);
+ sc_assert(h3.proc_kind() == SC_METHOD_PROC_);
+ sc_assert(h3.get_process_object() != 0);
+ std::vector<sc_object*> children3 = h3.get_child_objects();
+ sc_assert(children3.size() == 0);
+ sc_assert(h3.get_parent_object() != 0);
+ sc_assert(h3.terminated() == false);
+ sc_assert(h3.dynamic() == true);
+ sc_assert(h3 == h3);
+ sc_assert(h3 != h);
+
+ sc_process_handle h4(h3);
+ sc_assert(h4 == h3);
+ }
+
+ void CT()
+ {
+ sc_process_handle h;
+ invalid_handle_check(h);
+
+ sc_process_handle h2 = sc_get_current_process_handle();
+ sc_assert(h2.valid() == true);
+ sc_assert(strcmp(h2.name(), "top.m.CT") == 0);
+ sc_assert(h2.proc_kind() == SC_CTHREAD_PROC_);
+ sc_assert(h2.get_process_object() != 0);
+ std::vector<sc_object*> children2 = h2.get_child_objects();
+ sc_assert(children2.size() == 0);
+ sc_assert(h2.get_parent_object() == this);
+ sc_assert(h2.terminated() == false);
+ sc_assert(h2.dynamic() == false);
+ sc_assert(h2 == h2);
+ sc_assert(h2 != h);
+ }
+
+ void ME()
+ {
+ sc_process_handle h;
+ invalid_handle_check(h);
+
+ sc_process_handle h2 = sc_get_current_process_handle();
+ sc_assert(h2.valid() == true);
+ sc_assert(strcmp(h2.name(), "top.m.ME") == 0);
+ sc_assert(h2.proc_kind() == SC_METHOD_PROC_);
+ sc_assert(h2.get_process_object() != 0);
+ std::vector<sc_object*> children2 = h2.get_child_objects();
+ sc_assert(children2.size() == 0);
+ sc_assert(h2.get_parent_object() == this);
+ sc_assert(h2.terminated() == false);
+ sc_assert(h2.dynamic() == false);
+ sc_assert(h2 == h2);
+ sc_assert(h2 != h);
+ }
+
+};
+
+struct Top: sc_module
+{
+ M *m;
+ sc_clock clk;
+ Top(sc_module_name)
+ {
+ m = new M("m");
+ m->clk(clk);
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ cout << "Should be silent except for warning messages" << endl;
+
+ sc_process_handle h;
+ invalid_handle_check(h);
+
+ Top top("top");
+ sc_start();
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test203b/golden/test203b.log b/src/systemc/tests/systemc/compliance_1666/test203b/golden/test203b.log
new file mode 100644
index 000000000..d1a84db9a
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test203b/golden/test203b.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+Should be silent...
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test203b/test203b.cpp b/src/systemc/tests/systemc/compliance_1666/test203b/test203b.cpp
new file mode 100644
index 000000000..07f4cb506
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test203b/test203b.cpp
@@ -0,0 +1,68 @@
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+
+#include <systemc>
+using namespace sc_core;
+using namespace sc_dt;
+using std::cout;
+using std::endl;
+
+// 3) terminated_event()
+
+SC_MODULE(M)
+{
+ SC_CTOR(M)
+ {
+ SC_THREAD(T);
+ }
+
+ void T()
+ {
+ sc_process_handle h1 = sc_spawn(sc_bind(&M::proc, this, 2));
+ sc_process_handle h2 = sc_spawn(sc_bind(&M::proc, this, 3));
+ sc_process_handle h3 = sc_spawn(sc_bind(&M::proc, this, 1));
+ sc_assert(sc_time_stamp() == sc_time(0, SC_NS));
+ wait(h1.terminated_event() & h2.terminated_event() & h3.terminated_event());
+ sc_assert(sc_time_stamp() == sc_time(3, SC_NS));
+ if (h1.valid()) sc_assert (h1.terminated());
+ if (h2.valid()) sc_assert (h2.terminated());
+ if (h3.valid()) sc_assert (h3.terminated());
+
+ h1 = sc_spawn(sc_bind(&M::proc, this, 10));
+ h2 = sc_spawn(sc_bind(&M::proc, this, 30));
+ h3 = sc_spawn(sc_bind(&M::proc, this, 20));
+ sc_assert(sc_time_stamp() == sc_time(3, SC_NS));
+ wait(h1.terminated_event() | h2.terminated_event() | h3.terminated_event());
+ sc_assert(sc_time_stamp() == sc_time(13, SC_NS));
+ sc_assert(h2.valid());
+ sc_assert( !h2.terminated() );
+ sc_assert(h3.valid());
+ sc_assert( !h3.terminated() );
+
+ wait(h2.terminated_event() & h3.terminated_event());
+ sc_assert(sc_time_stamp() == sc_time(33, SC_NS));
+ }
+ void proc(int delay)
+ {
+ wait(delay * sc_time(1, SC_NS));
+ }
+};
+
+SC_MODULE(Top)
+{
+ M *m;
+ SC_CTOR(Top)
+ {
+ 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;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test205/golden/test205.log b/src/systemc/tests/systemc/compliance_1666/test205/golden/test205.log
new file mode 100644
index 000000000..6dbc6d5c7
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test205/golden/test205.log
@@ -0,0 +1,6 @@
+SystemC Simulation
+Should be silent...
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test205/test205.cpp b/src/systemc/tests/systemc/compliance_1666/test205/test205.cpp
new file mode 100644
index 000000000..2e0810abb
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test205/test205.cpp
@@ -0,0 +1,69 @@
+#include <systemc>
+using namespace sc_core;
+using namespace sc_dt;
+using sc_core::wait;
+using std::cout;
+using std::endl;
+
+// 5) wait( int ) for SC_THREAD, primitives and global
+
+void global()
+{
+ wait();
+ sc_assert(sc_time_stamp() == sc_time(0, SC_NS));
+ wait(3);
+ sc_assert(sc_time_stamp() == sc_time(3, SC_NS));
+}
+
+struct Prim: sc_prim_channel
+{
+ void method()
+ {
+ wait();
+ sc_assert(sc_time_stamp() == sc_time(4, SC_NS));
+ wait(3);
+ sc_assert(sc_time_stamp() == sc_time(7, SC_NS));
+ }
+};
+
+SC_MODULE(M)
+{
+ sc_in_clk clk;
+ Prim prim;
+ SC_CTOR(M)
+ {
+ SC_THREAD(T);
+ sensitive << clk.pos();
+ }
+ void T()
+ {
+ global();
+ prim.method();
+ wait();
+ sc_assert(sc_time_stamp() == sc_time(8, SC_NS));
+ wait(3);
+ sc_assert(sc_time_stamp() == sc_time(11, SC_NS));
+ sc_stop();
+ }
+};
+
+struct Top: sc_module
+{
+ M *m;
+ sc_clock clk;
+ Top(sc_module_name)
+ {
+ m = new M("m");
+ m->clk.bind(clk);
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ cout << "Should be silent..." << endl;
+ Top top("top");
+ sc_start();
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test206/golden/test206.log b/src/systemc/tests/systemc/compliance_1666/test206/golden/test206.log
new file mode 100644
index 000000000..d1a84db9a
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test206/golden/test206.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+Should be silent...
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test206/test206.cpp b/src/systemc/tests/systemc/compliance_1666/test206/test206.cpp
new file mode 100644
index 000000000..9ab52e9b0
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test206/test206.cpp
@@ -0,0 +1,103 @@
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+
+#include <systemc>
+#include <cstring>
+using namespace sc_core;
+using namespace sc_dt;
+using std::cout;
+using std::endl;
+
+// 6) sc_get_current_process_handle
+
+SC_MODULE(M)
+{
+ SC_CTOR(M)
+ {
+ sc_process_handle h;
+ sc_assert (!h.valid());
+ h = sc_get_current_process_handle();
+ sc_assert (!h.valid());
+ SC_THREAD(T);
+ h = sc_get_current_process_handle();
+ sc_assert (h.valid());
+ sc_assert (strcmp(h.name(),"top.m.T") == 0);
+ sc_assert (h.proc_kind()==SC_THREAD_PROC_);
+ sc_assert (h.dynamic()==false);
+ sc_assert (h.terminated()==false);
+ sc_assert (h.get_process_object() != 0);
+ sc_assert (h.get_parent_object() == this);
+
+ sc_spawn(sc_bind(&M::proc, this), "static_proc");
+ h = sc_get_current_process_handle();
+ sc_assert (h.valid());
+ sc_assert (strcmp(h.name(),"top.m.static_proc") == 0);
+ sc_assert (h.proc_kind()==SC_THREAD_PROC_);
+ sc_assert (h.dynamic()==false);
+ sc_assert (h.terminated()==false);
+ sc_assert (h.get_process_object() != 0);
+ sc_assert (h.get_parent_object() == this);
+ }
+ sc_object* obj;
+ void T()
+ {
+ sc_process_handle h;
+ sc_assert (!h.valid());
+ h = sc_get_current_process_handle();
+ sc_assert (h.valid());
+ sc_assert (strcmp(h.name(),"top.m.T") == 0);
+ sc_assert (h.proc_kind()==SC_THREAD_PROC_);
+ sc_assert (h.dynamic()==false);
+ sc_assert (h.terminated()==false);
+ sc_assert (h.get_process_object() != 0);
+ sc_assert (h.get_parent_object() == this);
+
+ obj = h.get_process_object();
+ sc_spawn_options opt;
+ opt.spawn_method();
+ sc_spawn(sc_bind(&M::proc, this), "dynamic_proc", &opt);
+ wait(1, SC_NS);
+ }
+ void proc()
+ {
+ sc_process_handle h = sc_get_current_process_handle();
+ sc_assert (h.valid());
+ if (h.dynamic())
+ {
+ sc_assert (strcmp(h.name(),"top.m.T.dynamic_proc") == 0);
+ sc_assert (h.proc_kind()==SC_METHOD_PROC_);
+ sc_assert (h.get_parent_object() == obj);
+ }
+ else
+ {
+ sc_assert (strcmp(h.name(),"top.m.static_proc") == 0);
+ sc_assert (h.proc_kind()==SC_THREAD_PROC_);
+ sc_assert (h.get_parent_object() == this);
+ }
+ sc_assert (h.terminated()==false);
+ sc_assert (h.get_process_object() != 0);
+ }
+};
+
+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;
+ sc_process_handle h;
+ sc_assert (!h.valid());
+ h = sc_get_current_process_handle();
+ sc_assert (!h.valid());
+
+ Top top("top");
+ sc_start();
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test207/golden/test207.log b/src/systemc/tests/systemc/compliance_1666/test207/golden/test207.log
new file mode 100644
index 000000000..d1a84db9a
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test207/golden/test207.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+Should be silent...
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test207/test207.cpp b/src/systemc/tests/systemc/compliance_1666/test207/test207.cpp
new file mode 100644
index 000000000..76910ef84
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test207/test207.cpp
@@ -0,0 +1,67 @@
+#include <systemc>
+using namespace sc_core;
+using namespace sc_dt;
+using std::cout;
+using std::endl;
+
+// 7) "event_queue"
+
+void check_form_of_suffix(std::string s)
+{
+ std::string charset = "0123456789";
+ while (!s.empty())
+ {
+ sc_assert(s[0] == '_');
+ s = s.substr(1);
+ sc_assert(!s.empty());
+ do
+ {
+ sc_assert(charset.find(s[0]) < charset.size());
+ s = s.substr(1);
+ } while (!s.empty() && (s[0] != '_'));
+ }
+}
+
+SC_MODULE(M)
+{
+ SC_CTOR(M)
+ {
+ SC_THREAD(T);
+ }
+ void T()
+ {
+ }
+};
+
+struct Top: sc_module
+{
+ sc_event_queue eq;
+ M *m;
+ Top(sc_module_name)
+ {
+ m = new M("m");
+
+ std::string s = eq.basename();
+ sc_assert (s.substr(0,11) == "event_queue");
+ sc_assert (s.size() > 11);
+ check_form_of_suffix(s.substr(11));
+
+ s = eq.name();
+ sc_assert (s.substr(0,15) == "top.event_queue");
+ sc_assert (s.size() > 15);
+ check_form_of_suffix(s.substr(15));
+
+ sc_assert (std::string(eq.kind()) == "sc_event_queue");
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ cout << "Should be silent..." << endl;
+
+ Top top("top");
+ sc_start();
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test208/golden/test208.log b/src/systemc/tests/systemc/compliance_1666/test208/golden/test208.log
new file mode 100644
index 000000000..d1a84db9a
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test208/golden/test208.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+Should be silent...
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test208/test208.cpp b/src/systemc/tests/systemc/compliance_1666/test208/test208.cpp
new file mode 100644
index 000000000..1b526484a
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test208/test208.cpp
@@ -0,0 +1,238 @@
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+
+#include <systemc>
+#include <cstring>
+using namespace sc_core;
+using namespace sc_dt;
+using sc_core::wait;
+using std::cout;
+using std::endl;
+
+// 8) get_parent_object, get_child_objects
+
+struct Object: sc_object
+{
+ Object(const char* _n) : sc_object(_n) {}
+};
+
+SC_MODULE(M)
+{
+ sc_signal<bool> sig;
+ sc_object* T_obj;
+
+ SC_CTOR(M)
+ {
+ std::vector<sc_object*> children = sig.get_child_objects();
+ sc_assert (children.size() == 0);
+ SC_THREAD(T);
+ sc_process_handle h = sc_get_current_process_handle();
+ sc_assert (h.valid());
+ T_obj = h.get_process_object();
+ children = h.get_child_objects();
+ sc_assert (children.size() == 0);
+ children = h.get_process_object()->get_child_objects();
+ sc_assert (children.size() == 0);
+
+ Object obj("obj");
+ children = obj.get_child_objects();
+ sc_assert (children.size() == 0);
+ sc_assert (obj.get_parent_object() == this);
+ }
+
+ void T()
+ {
+ sc_process_handle h = sc_get_current_process_handle();
+ sc_assert (h.valid());
+ sc_assert (h.dynamic() == false);
+ sc_assert (h.get_process_object() == T_obj);
+ sc_assert (h.get_parent_object() == this);
+ std::vector<sc_object*> children = h.get_child_objects();
+ sc_assert (children.size() == 0);
+ children = h.get_process_object()->get_child_objects();
+ sc_assert (children.size() == 0);
+
+ Object obj("obj");
+ children = obj.get_child_objects();
+ sc_assert (children.size() == 0);
+ sc_assert (obj.get_parent_object() == h.get_process_object());
+
+ children = h.get_child_objects();
+ sc_assert (children.size() == 1);
+ sc_assert (children[0] == &obj);
+ sc_assert (strcmp(children[0]->name(), "top.m.T.obj") == 0);
+ sc_assert (children[0]->get_parent_object() == h.get_process_object());
+
+ Object obj2("obj2");
+ children = h.get_child_objects();
+ sc_assert (children.size() == 2);
+ sc_assert (children[0] == &obj);
+ sc_assert (children[1] == &obj2);
+ sc_assert (children[0]->get_parent_object() == h.get_process_object());
+ sc_assert (children[1]->get_parent_object() == h.get_process_object());
+
+ wait (1, SC_NS);
+ sc_spawn(sc_bind(&M::dynamic_proc, this), "dynamic_proc");
+ wait (1, SC_NS);
+
+ sc_assert (h.valid());
+ }
+
+ sc_object* dynamic_proc_obj;
+
+ void dynamic_proc()
+ {
+ sc_process_handle h = sc_get_current_process_handle();
+ sc_assert (h.valid());
+ dynamic_proc_obj = h.get_process_object();
+ sc_assert (h.dynamic() == true);
+ sc_assert (h.get_parent_object() == T_obj);
+ std::vector<sc_object*> children = h.get_child_objects();
+ sc_assert (children.size() == 0);
+ children = h.get_process_object()->get_child_objects();
+ sc_assert (children.size() == 0);
+
+ Object obj("obj");
+ children = obj.get_child_objects();
+ sc_assert (children.size() == 0);
+ sc_assert (obj.get_parent_object() == dynamic_proc_obj);
+
+ children = h.get_child_objects();
+ sc_assert (children.size() == 1);
+ sc_assert (children[0] == &obj);
+ sc_assert (strcmp(children[0]->name(), "top.m.T.dynamic_proc.obj") == 0);
+ sc_assert (children[0]->get_parent_object() == dynamic_proc_obj);
+
+ Object obj2("obj2");
+ children = h.get_child_objects();
+ sc_assert (children.size() == 2);
+ sc_assert (children[0] == &obj);
+ sc_assert (children[1] == &obj2);
+ sc_assert (children[0]->get_parent_object() == dynamic_proc_obj);
+ sc_assert (children[1]->get_parent_object() == dynamic_proc_obj);
+
+ wait (1, SC_NS);
+ sc_process_handle h2 = sc_spawn(sc_bind(&M::dynamic_proc2, this), "dynamic_proc2");
+ wait (1, SC_NS);
+
+ children = h.get_child_objects();
+ sc_assert (children.size() == 3);
+ sc_assert (children[0] == &obj);
+ sc_assert (children[1] == &obj2);
+ sc_assert (children[2] == h2.get_process_object());
+ sc_assert (children[0]->get_parent_object() == dynamic_proc_obj);
+ sc_assert (children[1]->get_parent_object() == dynamic_proc_obj);
+ sc_assert (children[2]->get_parent_object() == dynamic_proc_obj);
+
+ sc_assert (h.valid());
+ }
+
+ void dynamic_proc2()
+ {
+ sc_process_handle h = sc_get_current_process_handle();
+ sc_assert (h.valid());
+ sc_assert (h.dynamic() == true);
+ sc_assert (h.get_parent_object() == dynamic_proc_obj);
+ std::vector<sc_object*> children = h.get_child_objects();
+ sc_assert (children.size() == 0);
+ children = h.get_process_object()->get_child_objects();
+ sc_assert (children.size() == 0);
+
+ Object obj("obj");
+ children = obj.get_child_objects();
+ sc_assert (children.size() == 0);
+ sc_assert (obj.get_parent_object() == h.get_process_object());
+
+ children = h.get_child_objects();
+ sc_assert (children.size() == 1);
+ sc_assert (children[0] == &obj);
+ sc_assert (strcmp(children[0]->name(), "top.m.T.dynamic_proc.dynamic_proc2.obj") == 0);
+ sc_assert (children[0]->get_parent_object() == h.get_process_object());
+
+ Object obj2("obj2");
+ children = h.get_child_objects();
+ sc_assert (children.size() == 2);
+ sc_assert (children[0] == &obj);
+ sc_assert (children[1] == &obj2);
+ sc_assert (children[0]->get_parent_object() == h.get_process_object());
+ sc_assert (children[1]->get_parent_object() == h.get_process_object());
+
+ wait(10, SC_NS);
+
+ sc_assert (h.valid());
+ }
+};
+
+void g(sc_object* obj)
+{
+ sc_process_handle h = sc_get_current_process_handle();
+ sc_object* this_process = h.get_process_object();
+ sc_assert(this_process->get_parent_object() == obj);
+}
+void f()
+{
+ sc_object* obj = sc_get_current_process_handle().get_process_object();
+ sc_process_handle h = sc_spawn(sc_bind(&g, obj));
+ std::vector<sc_object*> children = obj->get_child_objects();
+ sc_assert (children.size() == 1);
+ wait(1, SC_NS);
+}
+
+SC_MODULE(Top)
+{
+ sc_in_clk clk;
+ sc_port<sc_signal_in_if<int>, 1, SC_ZERO_OR_MORE_BOUND> p;
+ sc_export<sc_signal_in_if<int> > xp;
+ sc_signal<int> sig;
+
+ M *m;
+ SC_CTOR(Top)
+ : clk("clk"), p("p"), xp("xp"), sig("sig")
+ {
+ m = new M("m");
+ xp.bind(sig);
+
+ SC_THREAD(p1);
+ SC_CTHREAD(p2,clk);
+ SC_METHOD(p3);
+ sc_spawn(&f,"p4");
+
+ sc_object* parent = this->get_parent_object();
+ sc_assert (parent == 0);
+
+ std::vector<sc_object*> children = this->get_child_objects();
+ sc_assert (children.size() == 9);
+ sc_assert (strcmp(children[0]->name(), "top.clk") == 0);
+ sc_assert (strcmp(children[1]->name(), "top.p") == 0);
+ sc_assert (strcmp(children[2]->name(), "top.xp") == 0);
+ sc_assert (strcmp(children[3]->name(), "top.sig") == 0);
+ sc_assert (strcmp(children[4]->name(), "top.m") == 0);
+ sc_assert (strcmp(children[5]->name(), "top.p1") == 0);
+ sc_assert (strcmp(children[6]->name(), "top.p2") == 0);
+ sc_assert (strcmp(children[7]->name(), "top.p3") == 0);
+ sc_assert (strcmp(children[8]->name(), "top.p4") == 0);
+
+ for (unsigned i = 0; i < children.size(); i++)
+ sc_assert (children[i]->get_parent_object() == this);
+ }
+ void p1() {}
+ void p2() {}
+ void p3() {}
+};
+
+int sc_main(int argc, char* argv[])
+{
+ cout << "Should be silent..." << endl;
+
+ Object obj("obj");
+ std::vector<sc_object*> children = obj.get_child_objects();
+ sc_assert (children.size() == 0);
+ sc_assert (obj.get_parent_object() == 0);
+
+ sc_signal<bool> clk;
+ Top top("top");
+ top.clk(clk);
+ sc_start();
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test209/golden/test209.log b/src/systemc/tests/systemc/compliance_1666/test209/golden/test209.log
new file mode 100644
index 000000000..d1a84db9a
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test209/golden/test209.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+Should be silent...
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test209/test209.cpp b/src/systemc/tests/systemc/compliance_1666/test209/test209.cpp
new file mode 100644
index 000000000..da1066aef
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test209/test209.cpp
@@ -0,0 +1,136 @@
+#include <systemc>
+using namespace sc_core;
+using namespace sc_dt;
+using std::cout;
+using std::endl;
+
+// 9) sc_object registered and named
+
+struct i_f: virtual sc_interface
+{
+};
+
+struct Chan: i_f, sc_object
+{
+ Chan() {}
+ Chan(const char* _n): sc_object(_n) {}
+};
+
+SC_MODULE(M)
+{
+ SC_CTOR(M)
+ {
+ SC_THREAD(T);
+ }
+ void T()
+ {
+ }
+};
+
+struct Top: sc_module
+{
+ M *m;
+ Top(sc_module_name)
+ {
+ m = new M("m");
+ }
+};
+
+void check_form_of_suffix(std::string s)
+{
+ std::string charset = "0123456789";
+ while (!s.empty())
+ {
+ sc_assert(s[0] == '_');
+ s = s.substr(1);
+ sc_assert(!s.empty());
+ do
+ {
+ sc_assert(charset.find(s[0]) < charset.size());
+ s = s.substr(1);
+ } while (!s.empty() && (s[0] != '_'));
+ }
+}
+
+int sc_main(int argc, char* argv[])
+{
+ cout << "Should be silent..." << endl;
+ sc_report_handler::set_actions(SC_WARNING, SC_DO_NOTHING);
+
+ Chan ch1(""); // object
+ std::string s1 = std::string(ch1.name());
+ sc_assert(s1.substr(0,6) == "object");
+ check_form_of_suffix(s1.substr(6));
+
+ Chan ch2; // object_0
+ const std::string s2 = std::string(ch2.name());
+ sc_assert(s2.substr(0,6) == "object");
+ check_form_of_suffix(s2.substr(6));
+ sc_assert(s2 != s1);
+
+ Chan ch3(s2.c_str()); // object_0_0 or object_1
+ std::string s3 = std::string(ch3.name());
+ sc_assert(s3.substr(0,6) == "object");
+ check_form_of_suffix(s3.substr(6));
+ sc_assert(s3 != s1);
+ sc_assert(s3 != s2);
+
+ Chan ch4("object_2");
+ std::string s4 = std::string(ch4.name());
+ sc_assert(s4.substr(0,6) == "object");
+ check_form_of_suffix(s4.substr(6));
+ sc_assert(s4 != s1);
+ sc_assert(s4 != s2);
+ sc_assert(s4 != s3);
+
+ Chan ch5;
+ std::string s5 = std::string(ch5.name());
+ sc_assert(s5.substr(0,6) == "object");
+ check_form_of_suffix(s5.substr(6));
+ sc_assert(s5 != s1);
+ sc_assert(s5 != s2);
+ sc_assert(s5 != s3);
+ sc_assert(s5 != s4);
+
+ Chan ch6("");
+ std::string s6 = std::string(ch6.name());
+ sc_assert(s6.substr(0,6) == "object");
+ check_form_of_suffix(s6.substr(6));
+ sc_assert(s6 != s1);
+ sc_assert(s6 != s2);
+ sc_assert(s6 != s3);
+ sc_assert(s6 != s4);
+ sc_assert(s6 != s5);
+
+ sc_signal<int> sig7("signal_0");
+ std::string s7 = std::string(sig7.name());
+ sc_assert(s7 == "signal_0");
+ sc_assert(s7 != s1);
+ sc_assert(s7 != s2);
+ sc_assert(s7 != s3);
+ sc_assert(s7 != s4);
+ sc_assert(s7 != s5);
+ sc_assert(s7 != s6);
+
+ sc_signal<int> sig8;
+ std::string s8 = std::string(sig8.name());
+ sc_assert(s8.substr(0,6) == "signal");
+ sc_assert(s8.size() > 6);
+ check_form_of_suffix(s8.substr(6));
+ sc_assert(s8 != s1);
+ sc_assert(s8 != s2);
+ sc_assert(s8 != s3);
+ sc_assert(s8 != s4);
+ sc_assert(s8 != s5);
+ sc_assert(s8 != s6);
+ sc_assert(s8 != s7);
+
+ std::vector<sc_object*> children = sc_get_top_level_objects();
+ sc_assert (children.size() == 8);
+
+ Top top("top");
+ sc_start();
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test210/golden/test210.log b/src/systemc/tests/systemc/compliance_1666/test210/golden/test210.log
new file mode 100644
index 000000000..d1a84db9a
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test210/golden/test210.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+Should be silent...
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test210/test210.cpp b/src/systemc/tests/systemc/compliance_1666/test210/test210.cpp
new file mode 100644
index 000000000..d328fbefb
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test210/test210.cpp
@@ -0,0 +1,120 @@
+#include <systemc>
+#include <cstring>
+using namespace sc_core;
+using namespace sc_dt;
+using std::cout;
+using std::endl;
+
+// 10) sc_find_object, sc_get_top_level_objects
+
+static int object_count = 0;
+
+void recurse_hierarchy(sc_object* obj)
+{
+ ++ object_count;
+ std::vector<sc_object*> children = obj->get_child_objects();
+ for (std::vector<sc_object*>::iterator i = children.begin(); i != children.end(); i++)
+ recurse_hierarchy(*i);
+}
+
+SC_MODULE(M)
+{
+ SC_CTOR(M)
+ : sig("sig")
+ {
+ SC_THREAD(T);
+ }
+ void T()
+ {
+ }
+ sc_signal<int> sig;
+};
+
+SC_MODULE(Top)
+{
+ M *m;
+ SC_CTOR(Top)
+ {
+ m = new M("m");
+
+ sc_object* obj;
+ obj = sc_find_object("");
+ sc_assert(obj == 0);
+ obj = sc_find_object("foo");
+ sc_assert(obj == 0);
+ obj = sc_find_object("top.m.foo");
+ sc_assert(obj == 0);
+ obj = sc_find_object("top");
+ sc_assert(strcmp(obj->kind(), "sc_module") == 0);
+ obj = sc_find_object("top.m");
+ sc_assert(strcmp(obj->kind(), "sc_module") == 0);
+ obj = sc_find_object("top.m.sig");
+ sc_assert(strcmp(obj->kind(), "sc_signal") == 0);
+ obj = sc_find_object("top.m.T");
+ sc_assert(sc_process_handle(obj).valid());
+ sc_assert(strcmp(sc_process_handle(obj).name(), "top.m.T") == 0);
+
+ object_count = 0;
+ recurse_hierarchy(m);
+ sc_assert(object_count == 3);
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ cout << "Should be silent..." << endl;
+
+ std::vector<sc_object*> tops = sc_get_top_level_objects();
+ sc_assert(tops.size() == 0);
+
+ Top top("top");
+
+ tops = sc_get_top_level_objects();
+ sc_assert(tops.size() == 1);
+ sc_assert(strcmp(tops[0]->name(), "top") == 0);
+
+ M m2("m2");
+
+ tops = sc_get_top_level_objects();
+ sc_assert(tops.size() == 2);
+ sc_assert(strcmp(tops[0]->name(), "top") == 0);
+ sc_assert(strcmp(tops[1]->name(), "m2") == 0);
+
+ sc_signal<int> sig("sig2");
+
+ tops = sc_get_top_level_objects();
+ sc_assert(tops.size() == 3);
+ sc_assert(strcmp(tops[0]->name(), "top") == 0);
+ sc_assert(strcmp(tops[1]->name(), "m2") == 0);
+ sc_assert(strcmp(tops[2]->name(), "sig2") == 0);
+
+ sc_object* obj;
+ obj = sc_find_object("");
+ sc_assert(obj == 0);
+ obj = sc_find_object("foo");
+ sc_assert(obj == 0);
+ obj = sc_find_object("top.m.foo");
+ sc_assert(obj == 0);
+ obj = sc_find_object("top");
+ sc_assert(strcmp(obj->kind(), "sc_module") == 0);
+ obj = sc_find_object("sig2");
+ sc_assert(strcmp(obj->kind(), "sc_signal") == 0);
+ obj = sc_find_object("m2");
+ sc_assert(strcmp(obj->kind(), "sc_module") == 0);
+ obj = sc_find_object("top.m");
+ sc_assert(strcmp(obj->kind(), "sc_module") == 0);
+ obj = sc_find_object("top.m.sig");
+ sc_assert(strcmp(obj->kind(), "sc_signal") == 0);
+ obj = sc_find_object("top.m.T");
+ sc_assert(sc_process_handle(obj).valid());
+ sc_assert(strcmp(sc_process_handle(obj).name(), "top.m.T") == 0);
+
+ object_count = 0;
+ recurse_hierarchy(tops[0]);
+ sc_assert(object_count == 4);
+
+ sc_start();
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test211/golden/test211.log b/src/systemc/tests/systemc/compliance_1666/test211/golden/test211.log
new file mode 100644
index 000000000..d1a84db9a
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test211/golden/test211.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+Should be silent...
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test211/test211.cpp b/src/systemc/tests/systemc/compliance_1666/test211/test211.cpp
new file mode 100644
index 000000000..e336d541b
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test211/test211.cpp
@@ -0,0 +1,110 @@
+#include <systemc>
+using namespace sc_core;
+using namespace sc_dt;
+using std::cout;
+using std::endl;
+
+// 11) sc_is_running()
+
+struct my_port: sc_port<sc_signal_in_if<int> >
+{
+ my_port()
+ {
+ sc_assert(sc_is_running() == false);
+ }
+ ~my_port()
+ {
+ sc_assert(sc_is_running() == false);
+ }
+ void before_end_of_elaboration()
+ {
+ sc_assert(sc_is_running() == false);
+ }
+ void end_of_elaboration()
+ {
+ sc_assert(sc_is_running() == false);
+ }
+ void start_of_simulation()
+ {
+ sc_assert(sc_is_running() == false);
+ }
+ void end_of_simulation()
+ {
+ sc_assert(sc_is_running() == false);
+ }
+ int read()
+ {
+ sc_assert(sc_is_running() == true);
+ return (*this)->read();
+ }
+};
+
+SC_MODULE(M)
+{
+ my_port p;
+ SC_CTOR(M)
+ {
+ sc_assert(sc_is_running() == false);
+ SC_THREAD(T);
+ SC_METHOD(ME);
+ }
+ ~M()
+ {
+ sc_assert(sc_is_running() == false);
+ }
+ void T()
+ {
+ int i = p.read();
+ sc_assert(sc_is_running() == true);
+ wait (1, SC_NS);
+ sc_assert(sc_is_running() == true);
+ wait (1, SC_NS);
+ sc_assert(sc_is_running() == true);
+ wait (1, SC_NS);
+ }
+ void ME()
+ {
+ sc_assert(sc_is_running() == true);
+ }
+ void before_end_of_elaboration()
+ {
+ sc_assert(sc_is_running() == false);
+ }
+ void end_of_elaboration()
+ {
+ sc_assert(sc_is_running() == false);
+ }
+ void start_of_simulation()
+ {
+ sc_assert(sc_is_running() == false);
+ }
+ void end_of_simulation()
+ {
+ sc_assert(sc_is_running() == false);
+ }
+};
+
+struct Top: sc_module
+{
+ M *m;
+ sc_signal<int> sig;
+ Top(sc_module_name)
+ {
+ sc_assert(sc_is_running() == false);
+ m = new M("m");
+ m->p.bind(sig);
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ cout << "Should be silent..." << endl;
+
+ sc_assert(sc_is_running() == false);
+ Top top("top");
+ sc_assert(sc_is_running() == false);
+ sc_start();
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test219/golden/test219.log b/src/systemc/tests/systemc/compliance_1666/test219/golden/test219.log
new file mode 100644
index 000000000..d1a84db9a
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test219/golden/test219.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+Should be silent...
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test219/test219.cpp b/src/systemc/tests/systemc/compliance_1666/test219/test219.cpp
new file mode 100644
index 000000000..0dc0f5361
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test219/test219.cpp
@@ -0,0 +1,79 @@
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+
+#include <systemc>
+using namespace sc_core;
+using namespace sc_dt;
+using std::cout;
+using std::endl;
+
+// 19) Call to sc_spawn in what would have been the final update phase...
+
+sc_event ev;
+
+struct Prim: sc_prim_channel, sc_interface
+{
+ Prim() : count(0) {}
+
+ void write() {
+ request_update();
+ }
+ void update() {
+ sc_spawn(sc_bind(&Prim::spawned_proc, this));
+ }
+ void spawned_proc()
+ {
+ ++ count;
+ ev.notify(5, SC_NS);
+ }
+ const sc_event& default_event() const { return ev; }
+ int count;
+};
+
+SC_MODULE(M)
+{
+ Prim prim;
+ SC_CTOR(M)
+ : ME_count(0)
+ {
+ SC_THREAD(T);
+ SC_METHOD(ME);
+ sensitive << prim;
+ dont_initialize();
+ }
+ void T()
+ {
+ wait(10, SC_NS);
+ prim.write();
+ sc_assert(sc_time_stamp() == sc_time(10, SC_NS));
+ }
+ void ME()
+ {
+ ++ ME_count;
+ sc_assert(sc_time_stamp() == sc_time(15, SC_NS));
+ }
+ int ME_count;
+};
+
+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();
+
+ sc_assert(top.m->prim.count == 1);
+ sc_assert(top.m->ME_count == 1);
+
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test220/golden/test220.log b/src/systemc/tests/systemc/compliance_1666/test220/golden/test220.log
new file mode 100644
index 000000000..82a7635b4
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test220/golden/test220.log
@@ -0,0 +1,16 @@
+SystemC Simulation
+Should be silent except for 3 fatal errors...
+
+Fatal: /JA: A bad thing has happened
+In file: <removed by verify.pl>
+In process: top.m.T @ 0 s
+
+Fatal: /JA: A bad thing has happened
+In file: <removed by verify.pl>
+In process: top.m.T @ 1 ns
+
+Fatal: /JA: A bad thing has happened
+In file: <removed by verify.pl>
+In process: top.m.T @ 2 ns
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test220/test220.cpp b/src/systemc/tests/systemc/compliance_1666/test220/test220.cpp
new file mode 100644
index 000000000..0d25509b6
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test220/test220.cpp
@@ -0,0 +1,68 @@
+#include <systemc>
+using namespace sc_core;
+using namespace sc_dt;
+using std::cout;
+using std::endl;
+
+// 20) sc_report_handler::stop_after(SC_FATAL,-1) should NOT call sc_stop on 1st fatal error
+
+static bool global_flag_1 = false;
+static bool global_flag_2 = false;
+static bool global_flag_3 = false;
+
+SC_MODULE(M)
+{
+ SC_CTOR(M)
+ {
+ SC_THREAD(T);
+ }
+ void T()
+ {
+ SC_REPORT_FATAL("/JA", "A bad thing has happened");
+ wait(1, SC_NS);
+ sc_assert(sc_report_handler::get_count(SC_FATAL) == 1);
+ global_flag_1 = true;
+
+ sc_report_handler::stop_after(SC_FATAL, 0);
+ SC_REPORT_FATAL("/JA", "A bad thing has happened");
+ wait(1, SC_NS);
+ sc_assert(sc_report_handler::get_count(SC_FATAL) == 2);
+ global_flag_2 = true;
+
+ sc_report_handler::stop_after(SC_FATAL, -1);
+ SC_REPORT_FATAL("/JA", "A bad thing has happened");
+ wait(1, SC_NS);
+ sc_assert(sc_report_handler::get_count(SC_FATAL) == 3);
+ global_flag_3 = 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 except for 3 fatal errors..." << endl;
+
+ sc_report_handler::set_actions(SC_FATAL, SC_DISPLAY);
+
+ Top top("top");
+ sc_start();
+
+ sc_assert(global_flag_1);
+ sc_assert(global_flag_2);
+ sc_assert(global_flag_3);
+ sc_assert(sc_report_handler::get_count(SC_INFO) == 0);
+ sc_assert(sc_report_handler::get_count(SC_WARNING) == 0);
+ sc_assert(sc_report_handler::get_count(SC_ERROR) == 0);
+ sc_assert(sc_report_handler::get_count(SC_FATAL) == 3);
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test228/golden/test228.log b/src/systemc/tests/systemc/compliance_1666/test228/golden/test228.log
new file mode 100644
index 000000000..a84cdf31f
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test228/golden/test228.log
@@ -0,0 +1,6 @@
+SystemC Simulation
+Should be silent except for some renaming warnings...
+
+Info: (I703) tracing timescale unit set: 1 ns (vcd.vcd)
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test228/test228.cpp b/src/systemc/tests/systemc/compliance_1666/test228/test228.cpp
new file mode 100644
index 000000000..a7cff6a6b
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test228/test228.cpp
@@ -0,0 +1,107 @@
+#define SC_INCLUDE_FX
+
+#include <systemc.h>
+
+// 28) sc_core and sc_dt - check names still visible in <systemc.h>
+
+SC_MODULE(Mod)
+{
+ SC_CTOR(Mod)
+ {
+ SC_THREAD(T);
+ };
+ void T()
+ {
+ sc_int<4> i;
+ sc_uint<4> ui;
+ sc_bigint<4> bi;
+ sc_biguint<4> bui;
+ sc_fixed<4,2> f;
+ sc_ufixed<4,2> uf;
+ sc_fixed_fast<4,2> ff;
+ sc_ufixed_fast<4,2> uff;
+ sc_bv<4> bv;
+ sc_lv<4> lv;
+
+ sc_int_base ib;
+ sc_int_base uib;
+ sc_signed s;
+ sc_unsigned u;
+ sc_fix fi;
+ sc_ufix ufi;
+ sc_fix_fast ffi;
+ sc_ufix_fast uffi;
+ sc_logic l;
+ sc_bv_base bvb;
+ sc_lv_base lvb;
+
+ //sc_value_base vb;
+ //sc_fxnum fx;
+ //sc_fxnum_fast fxf;
+ sc_fxval fxv;
+ sc_fxval_fast fxvf;
+
+ sc_assert(sc_abs(-1) == 1);
+ sc_assert(sc_max(1, 2) == 2);
+ sc_assert(sc_min(1, 2) == 1);
+ sc_copyright();
+ sc_version();
+ sc_release();
+ }
+ void f(sc_report& rpt)
+ {
+ sc_severity sev;
+ sev = SC_INFO;
+ sev = SC_WARNING;
+ sev = SC_ERROR;
+ sev = SC_FATAL;
+ sc_assert (sev == SC_FATAL);
+
+ sc_actions act;
+ act = SC_DO_NOTHING;
+ }
+ void g(sc_exception x) {}
+};
+
+struct Top: sc_module
+{
+ Top(sc_module_name)
+ {
+ tf = sc_create_vcd_trace_file("vcd");
+ tf->set_time_unit(1.0, SC_NS);
+ sc_trace(tf, sig, "sig");
+ sc_write_comment(tf, "Hello");
+ }
+ ~Top()
+ {
+ sc_close_vcd_trace_file(tf);
+ }
+ sc_trace_file* tf;
+ sc_signal<sc_logic> sig;
+};
+
+int sc_main(int argc, char* argv[])
+{
+#if defined(_MSC_VER) && _MSC_VER < 1900
+ _set_output_format(_TWO_DIGIT_EXPONENT);
+#endif
+
+ cout << "Should be silent except for some renaming warnings..." << endl;
+
+ Top top("top");
+
+ sc_attr_base ab("base");
+ sc_attribute<int> at("attr");
+
+ sc_buffer<int> bu;
+ sc_signal_resolved sr;
+ sc_fifo<int> fi;
+ sc_mutex mut;
+ sc_semaphore sem(2);
+ sc_event_queue eq;
+
+ sc_start(100, SC_NS);
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
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;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test234/golden/test234.log b/src/systemc/tests/systemc/compliance_1666/test234/golden/test234.log
new file mode 100644
index 000000000..6dbc6d5c7
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test234/golden/test234.log
@@ -0,0 +1,6 @@
+SystemC Simulation
+Should be silent...
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test234/test234.cpp b/src/systemc/tests/systemc/compliance_1666/test234/test234.cpp
new file mode 100644
index 000000000..1b5467544
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test234/test234.cpp
@@ -0,0 +1,110 @@
+#include <systemc>
+using namespace sc_core;
+using namespace sc_dt;
+using std::cout;
+using std::endl;
+
+// 34) event finder on multiport
+
+struct i_f: virtual sc_interface
+{
+ virtual const sc_event& event() const = 0;
+};
+
+struct Chan: i_f, sc_object
+{
+ virtual const sc_event& event() const { return ev; }
+ sc_event ev;
+};
+
+struct Port: sc_port<i_f,0>
+{
+ sc_event_finder& find_event() const
+ {
+ return *new sc_event_finder_t<i_f>( *this, &i_f::event );
+ }
+};
+
+SC_MODULE(M)
+{
+ Port mp;
+ bool flag, flag2;
+
+ SC_CTOR(M)
+ : flag(false), flag2(false)
+ {
+ SC_THREAD(T);
+ sensitive << mp.find_event();
+ }
+ void T()
+ {
+ wait();
+ sc_assert(sc_time_stamp() == sc_time(1, SC_NS));
+ wait();
+ sc_assert(sc_time_stamp() == sc_time(11, SC_NS));
+ wait();
+ sc_assert(sc_time_stamp() == sc_time(111, SC_NS));
+ flag = true;
+ wait();
+ flag = false;
+ }
+ void end_of_elaboration()
+ {
+ SC_THREAD(T2);
+ for (int i = 0; i < mp.size(); i++)
+ sensitive << mp[i]->event();
+ }
+ void T2()
+ {
+ wait();
+ sc_assert(sc_time_stamp() == sc_time(1, SC_NS));
+ wait();
+ sc_assert(sc_time_stamp() == sc_time(11, SC_NS));
+ wait();
+ sc_assert(sc_time_stamp() == sc_time(111, SC_NS));
+ flag2 = true;
+ wait();
+ flag2 = false;
+ }
+ void end_of_simulation()
+ {
+ sc_assert( flag );
+ sc_assert( flag2 );
+ }
+};
+
+SC_MODULE(Top)
+{
+ M *m;
+ Chan chan1, chan2, chan3;
+ SC_CTOR(Top)
+ {
+ m = new M("m");
+ m->mp(chan1);
+ m->mp(chan2);
+ m->mp(chan3);
+ SC_THREAD(T);
+ }
+ void T()
+ {
+ wait(1, SC_NS);
+ chan1.ev.notify();
+ wait(10, SC_NS);
+ chan2.ev.notify();
+ wait(100, SC_NS);
+ chan3.ev.notify();
+ wait(1, SC_NS);
+ sc_stop();
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ cout << "Should be silent..." << endl;
+
+ Top top("top");
+ sc_start();
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test235a/golden/test235a.log b/src/systemc/tests/systemc/compliance_1666/test235a/golden/test235a.log
new file mode 100644
index 000000000..d1a84db9a
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test235a/golden/test235a.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+Should be silent...
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test235a/test235a.cpp b/src/systemc/tests/systemc/compliance_1666/test235a/test235a.cpp
new file mode 100644
index 000000000..1df0f5fde
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test235a/test235a.cpp
@@ -0,0 +1,175 @@
+#include <systemc>
+using namespace sc_core;
+using namespace sc_dt;
+using std::cout;
+using std::endl;
+
+// 35) Port policy (correct binding)
+
+SC_MODULE(M)
+{
+ sc_port<sc_signal_in_if<int>,1,SC_ONE_OR_MORE_BOUND> p1;
+ sc_port<sc_signal_in_if<int>,2,SC_ONE_OR_MORE_BOUND> p2;
+ sc_port<sc_signal_in_if<int>,2,SC_ONE_OR_MORE_BOUND> p3;
+ sc_port<sc_signal_in_if<int>,0,SC_ONE_OR_MORE_BOUND> p4;
+ sc_port<sc_signal_in_if<int>,2,SC_ZERO_OR_MORE_BOUND> p5;
+ sc_port<sc_signal_in_if<int>,2,SC_ZERO_OR_MORE_BOUND> p6;
+ sc_port<sc_signal_in_if<int>,2,SC_ZERO_OR_MORE_BOUND> p7;
+ sc_port<sc_signal_in_if<int>,0,SC_ZERO_OR_MORE_BOUND> p8;
+ sc_port<sc_signal_in_if<int>,0,SC_ZERO_OR_MORE_BOUND> p9;
+ sc_port<sc_signal_in_if<int>,0,SC_ZERO_OR_MORE_BOUND> p10;
+ sc_port<sc_signal_in_if<int>,1,SC_ALL_BOUND> p11;
+ sc_port<sc_signal_in_if<int>,3,SC_ALL_BOUND> p12;
+
+ sc_port<sc_signal_in_if<int>,2,SC_ALL_BOUND> p1_all_2;
+ sc_port<sc_signal_in_if<int>,2,SC_ALL_BOUND> p2_all_2;
+ sc_port<sc_signal_in_if<int>,2,SC_ALL_BOUND> p3_all_2;
+ sc_port<sc_signal_in_if<int>,5,SC_ALL_BOUND> p4_all_5;
+ sc_port<sc_signal_in_if<int>,2,SC_ALL_BOUND> p5_all_2;
+
+ sc_port<sc_signal_in_if<int>,2,SC_ZERO_OR_MORE_BOUND> p6_zero;
+ sc_port<sc_signal_in_if<int>,2,SC_ZERO_OR_MORE_BOUND> p7_one;
+ sc_port<sc_signal_in_if<int>,2,SC_ZERO_OR_MORE_BOUND> p8_two;
+
+ SC_CTOR(M)
+ : p1("p1"),
+ p2("p2"),
+ p3("p3"),
+ p4("p4"),
+ p5("p5"),
+ p6("p6"),
+ p7("p7"),
+ p8("p8"),
+ p9("p9"),
+ p10("p10"),
+ p11("p11"),
+ p12("p12"),
+ p1_all_2("p1_all_2"),
+ p2_all_2("p2_all_2"),
+ p3_all_2("p3_all_2"),
+ p4_all_5("p4_all_5"),
+ p5_all_2("p5_all_2"),
+ p6_zero("p6_zero"),
+ p7_one("p7_one"),
+ p8_two("p8_two")
+ {}
+ void end_of_elaboration()
+ {
+ sc_assert(p1.size() == 1);
+ sc_assert(p2.size() == 1);
+ sc_assert(p3.size() == 2);
+ sc_assert(p4.size() == 3);
+ sc_assert(p5.size() == 0);
+ sc_assert(p6.size() == 1);
+ sc_assert(p7.size() == 2);
+ sc_assert(p8.size() == 0);
+ sc_assert(p9.size() == 1);
+ sc_assert(p10.size() == 2);
+ sc_assert(p11.size() == 1);
+ sc_assert(p12.size() == 3);
+
+ sc_assert(p1_all_2.size() == 2);
+ sc_assert(p2_all_2.size() == 2);
+ sc_assert(p3_all_2.size() == 2);
+ sc_assert(p4_all_5.size() == 5);
+ sc_assert(p5_all_2.size() == 2);
+
+ sc_assert(p6_zero.size() == 0);
+ sc_assert(p7_one.size() == 1);
+ sc_assert(p8_two.size() == 2);
+ }
+};
+
+SC_MODULE(Top)
+{
+ sc_port<sc_signal_in_if<int>,0,SC_ZERO_OR_MORE_BOUND> p1_twice;
+ sc_port<sc_signal_in_if<int>,0,SC_ZERO_OR_MORE_BOUND> p2_once;
+ sc_port<sc_signal_in_if<int>,0,SC_ZERO_OR_MORE_BOUND> p3_once;
+ sc_port<sc_signal_in_if<int>,0,SC_ZERO_OR_MORE_BOUND> p4_unbound;
+
+ M *m;
+ sc_signal<int> sig1, sig2, sig3, sig4;
+
+ SC_CTOR(Top)
+ {
+ m = new M("m");
+ m->p1(sig1);
+
+ m->p2(sig1);
+
+ m->p3(sig1);
+ m->p3(sig2);
+
+ m->p4(sig1);
+ m->p4(sig2);
+ m->p4(sig3);
+
+ m->p6(sig3);
+
+ m->p7(sig1);
+ m->p7(sig2);
+
+ m->p9(sig1);
+
+ m->p10(sig1);
+ m->p10(sig2);
+
+ m->p11(sig1);
+
+ m->p12(sig1);
+ m->p12(sig2);
+ m->p12(sig3);
+
+ m->p1_all_2(p1_twice);
+
+ m->p2_all_2(p2_once);
+ m->p2_all_2(p3_once);
+
+ m->p3_all_2(sig1);
+ m->p3_all_2(p2_once);
+
+ m->p4_all_5(p2_once);
+ m->p4_all_5(sig1);
+ m->p4_all_5(p1_twice);
+ m->p4_all_5(p3_once);
+ m->p4_all_5(p4_unbound);
+
+ m->p5_all_2(p2_once);
+ m->p5_all_2(p4_unbound);
+
+ m->p6_zero(p4_unbound);
+
+ m->p7_one(p2_once);
+
+ m->p8_two(p2_once);
+ }
+ void before_end_of_elaboration()
+ {
+ m->p5_all_2(p4_unbound);
+ m->p5_all_2(p3_once);
+ m->p5_all_2(p4_unbound);
+
+ m->p6_zero(p4_unbound);
+
+ m->p8_two(sig1);
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ cout << "Should be silent..." << endl;
+
+ sc_signal<int> sig1, sig2, sig3, sig4;
+
+ Top top("top");
+ top.p1_twice(sig1);
+ top.p1_twice(sig2);
+
+ top.p2_once(sig3);
+ top.p3_once(sig4);
+
+ sc_start(1, SC_NS);
+
+ cout << endl << "Success" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/compliance_1666/test235b/golden/test235b.log b/src/systemc/tests/systemc/compliance_1666/test235b/golden/test235b.log
new file mode 100644
index 000000000..90ff5e501
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test235b/golden/test235b.log
@@ -0,0 +1,25 @@
+SystemC Simulation
+Should be 7 errors but no aborts ...
+
+Error: (E107) bind interface to port failed: interface already bound to port: port 'top.m.p7' (sc_port)
+In file: <removed by verify.pl>
+
+Error: (E109) complete binding failed: 0 actual binds is less than required 5: port 'top.m.p6' (sc_port)
+In file: <removed by verify.pl>
+
+Error: (E109) complete binding failed: 6 binds exceeds maximum of 5 allowed: port 'top.m.p5' (sc_port)
+In file: <removed by verify.pl>
+
+Error: (E109) complete binding failed: 2 binds exceeds maximum of 1 allowed: port 'top.m.p4' (sc_port)
+In file: <removed by verify.pl>
+
+Error: (E109) complete binding failed: 3 binds exceeds maximum of 2 allowed: port 'top.m.p3' (sc_port)
+In file: <removed by verify.pl>
+
+Error: (E109) complete binding failed: 1 actual binds is less than required 2: port 'top.m.p2' (sc_port)
+In file: <removed by verify.pl>
+
+Error: (E109) complete binding failed: port not bound: port 'top.m.p1' (sc_port)
+In file: <removed by verify.pl>
+
+Success
diff --git a/src/systemc/tests/systemc/compliance_1666/test235b/test235b.cpp b/src/systemc/tests/systemc/compliance_1666/test235b/test235b.cpp
new file mode 100644
index 000000000..d5855e1cc
--- /dev/null
+++ b/src/systemc/tests/systemc/compliance_1666/test235b/test235b.cpp
@@ -0,0 +1,92 @@
+#include <systemc>
+using namespace sc_core;
+using namespace sc_dt;
+using std::cout;
+using std::endl;
+
+// 35) Port policy (incorrect binding)
+
+SC_MODULE(M)
+{
+ sc_port<sc_signal_in_if<int>,1,SC_ONE_OR_MORE_BOUND> p1;
+ sc_port<sc_signal_in_if<int>,2,SC_ALL_BOUND> p2;
+ sc_port<sc_signal_in_if<int>,2,SC_ZERO_OR_MORE_BOUND> p3;
+ sc_port<sc_signal_in_if<int>,1,SC_ONE_OR_MORE_BOUND> p4;
+ sc_port<sc_signal_in_if<int>,5,SC_ALL_BOUND> p5;
+ sc_port<sc_signal_in_if<int>,5,SC_ALL_BOUND> p6;
+ sc_port<sc_signal_in_if<int>,0,SC_ZERO_OR_MORE_BOUND> p7;
+
+ SC_CTOR(M)
+ : p1("p1"),
+ p2("p2"),
+ p3("p3"),
+ p4("p4"),
+ p5("p5"),
+ p6("p6"),
+ p7("p7")
+ {}
+ void end_of_elaboration()
+ {
+ sc_assert(p1.size() == 0);
+ sc_assert(p2.size() == 1);
+ sc_assert(p3.size() == 3);
+ sc_assert(p4.size() == 2);
+ sc_assert(p5.size() == 6);
+ sc_assert(p6.size() == 0);
+ sc_assert(p7.size() == 2);
+ }
+};
+
+SC_MODULE(Top)
+{
+ sc_port<sc_signal_in_if<int>,0,SC_ZERO_OR_MORE_BOUND> p0_unbound;
+ sc_port<sc_signal_in_if<int>,0,SC_ZERO_OR_MORE_BOUND> p1_once;
+ sc_port<sc_signal_in_if<int>,0,SC_ZERO_OR_MORE_BOUND> p2_twice;
+
+ M *m;
+ sc_signal<int> sig1, sig2, sig3, sig4;
+
+ SC_CTOR(Top)
+ {
+ m = new M("m");
+ m->p1(p0_unbound);
+
+ m->p2(p1_once);
+
+ m->p3(p1_once);
+ m->p3(p2_twice);
+
+ m->p4(p2_twice);
+
+ m->p5(sig1);
+ m->p5(p1_once);
+ m->p5(sig2);
+ m->p5(p2_twice);
+ m->p5(sig3);
+
+ m->p7(sig1);
+ m->p7(sig1);
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ cout << "Should be 7 errors but no aborts ..." << endl;
+
+ sc_report_handler::set_actions(SC_ERROR, SC_DISPLAY);
+
+ sc_signal<int> sig1, sig2, sig3, sig4;
+
+ Top top("top");
+ top.p1_once(sig1);
+
+ top.p2_twice(sig2);
+ top.p2_twice(sig3);
+
+ sc_start(1, SC_NS);
+
+ sc_assert(sc_report_handler::get_count(SC_ERROR) == 7);
+
+ cout << endl << "Success" << endl;
+ return 0;
+}