summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/compliance_1666/test235b
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/tests/systemc/compliance_1666/test235b')
-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
2 files changed, 117 insertions, 0 deletions
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;
+}