summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/kernel/sc_event
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/tests/systemc/kernel/sc_event')
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test01/golden/test01.log43
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test01/test01.cpp95
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test02/golden/test02.log140
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test02/test02.cpp127
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test03/golden/test03.log4
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test03/test03.cpp72
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test04/golden/test04.log43
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test04/test04.cpp199
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test05/golden/test05.log43
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test05/test05.cpp204
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test06/golden/test06.log43
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test06/test06.cpp200
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test07/golden/test07.log43
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test07/test07.cpp204
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test08/golden/test08.log76
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test08/test08.cpp240
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test09/golden/test09.log43
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test09/test09.cpp199
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test10/golden/test10.log60
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test10/test10.cpp190
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test11/golden/test11.log60
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test11/test11.cpp241
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test12/golden/test12.log60
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test12/test12.cpp261
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test13/golden/test13.log13
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test13/test13.cpp89
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test14/golden/test14.log36
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test14/test14.cpp120
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test15/event_triggered.cpp203
-rw-r--r--src/systemc/tests/systemc/kernel/sc_event/test15/golden/event_triggered.log48
30 files changed, 3399 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_event/test01/golden/test01.log
new file mode 100644
index 000000000..b4230bf13
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test01/golden/test01.log
@@ -0,0 +1,43 @@
+SystemC Simulation
+1 1
+Triggered by event e_b
+1 2
+Triggered by event e_b
+1 3
+Triggered by event e_b
+1 4
+Triggered by event e_b
+1 5
+Triggered by event e_b
+1 6
+Triggered by event e_b
+1 7
+Triggered by event e_b
+1 8
+Triggered by event e_b
+1 9
+Triggered by event e_b
+1 10
+Triggered by event e_b
+1 11
+Triggered by event e_b
+1 12
+Triggered by event e_b
+1 13
+Triggered by event e_b
+1 14
+Triggered by event e_b
+1 15
+Triggered by event e_b
+1 16
+Triggered by event e_b
+1 17
+Triggered by event e_b
+1 18
+Triggered by event e_b
+1 19
+Triggered by event e_b
+1 20
+Issuing sc_stop()
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_event/test01/test01.cpp
new file mode 100644
index 000000000..81c9bc445
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test01/test01.cpp
@@ -0,0 +1,95 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test01.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date: Bishnupriya Bhattacharya, Cadence Design Systems,
+ September 5, 2003
+ Description of Modification: - set stop mode to SC_STOP_IMMEDIATE;
+ - add more output printout to make sure that
+ the immdiate event notification of "e_b" after
+ issuing sc_stop() does not make the
+ sensitive process "thread_a" run
+
+ *****************************************************************************/
+
+// test of immediate event notification
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_event e_a;
+ sc_event e_b;
+
+ int n;
+
+ void thread_a()
+ {
+ wait( SC_ZERO_TIME );
+ n = 0;
+ while( true ) {
+ n ++;
+ e_a.notify();
+ wait( e_b );
+ cout << "Triggered by event e_b" << endl;
+ }
+ }
+
+ void thread_b()
+ {
+ while( true ) {
+ wait( e_a );
+ cout << sc_delta_count() << " " << n << endl;
+ if( n == 20 ) {
+ cout << "Issuing sc_stop() " << endl;
+ sc_stop();
+ }
+ e_b.notify();
+ }
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_THREAD( thread_a );
+ SC_THREAD( thread_b );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+
+ sc_set_stop_mode(SC_STOP_IMMEDIATE);
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/sc_event/test02/golden/test02.log
new file mode 100644
index 000000000..4608d4fd4
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test02/golden/test02.log
@@ -0,0 +1,140 @@
+SystemC Simulation
+1 -- 0
+1 AA 0
+4 -- 0
+4 BB 0
+7 -- 1
+10 -- 2
+13 -- 3
+13 CC 3
+16 -- 4
+19 -- 5
+22 -- 6
+22 DD 6
+25 -- 7
+28 -- 8
+31 -- 9
+31 EE 9
+34 -- 10
+37 -- 11
+40 -- 12
+40 FF 12
+42 GG 13
+44 -- 13
+47 -- 14
+50 -- 15
+50 AA 15
+53 -- 16
+56 -- 17
+59 -- 18
+59 BB 18
+62 -- 19
+65 -- 20
+68 -- 21
+68 CC 21
+71 -- 22
+74 -- 23
+77 -- 24
+77 DD 24
+80 -- 25
+83 -- 26
+86 -- 27
+86 EE 27
+89 -- 28
+92 -- 29
+95 -- 30
+95 FF 30
+97 GG 31
+99 -- 31
+102 -- 32
+105 -- 33
+105 AA 33
+108 -- 34
+111 -- 35
+114 -- 36
+114 BB 36
+117 -- 37
+120 -- 38
+123 -- 39
+123 CC 39
+126 -- 40
+129 -- 41
+132 -- 42
+132 DD 42
+135 -- 43
+138 -- 44
+141 -- 45
+141 EE 45
+144 -- 46
+147 -- 47
+150 -- 48
+150 FF 48
+152 GG 49
+154 -- 49
+157 -- 50
+160 -- 51
+160 AA 51
+163 -- 52
+166 -- 53
+169 -- 54
+169 BB 54
+172 -- 55
+175 -- 56
+178 -- 57
+178 CC 57
+181 -- 58
+184 -- 59
+187 -- 60
+187 DD 60
+190 -- 61
+193 -- 62
+196 -- 63
+196 EE 63
+199 -- 64
+202 -- 65
+205 -- 66
+205 FF 66
+207 GG 67
+209 -- 67
+212 -- 68
+215 -- 69
+215 AA 69
+218 -- 70
+221 -- 71
+224 -- 72
+224 BB 72
+227 -- 73
+230 -- 74
+233 -- 75
+233 CC 75
+236 -- 76
+239 -- 77
+242 -- 78
+242 DD 78
+245 -- 79
+248 -- 80
+251 -- 81
+251 EE 81
+254 -- 82
+257 -- 83
+260 -- 84
+260 FF 84
+262 GG 85
+264 -- 85
+267 -- 86
+270 -- 87
+270 AA 87
+273 -- 88
+276 -- 89
+279 -- 90
+279 BB 90
+282 -- 91
+285 -- 92
+288 -- 93
+288 CC 93
+291 -- 94
+294 -- 95
+297 -- 96
+297 DD 96
+300 -- 97
+303 -- 98
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test02/test02.cpp b/src/systemc/tests/systemc/kernel/sc_event/test02/test02.cpp
new file mode 100644
index 000000000..0137a0012
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test02/test02.cpp
@@ -0,0 +1,127 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test02.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of immediate event notification
+
+#include "systemc.h"
+
+SC_MODULE( source )
+{
+ sc_in_clk clk;
+ sc_out<int> out;
+
+ void main_action()
+ {
+ int a = 0;
+ while( true ) {
+ wait();
+ out = a ++;
+ }
+ }
+
+ SC_CTOR( source )
+ {
+ SC_THREAD( main_action );
+ sensitive << clk.pos();
+ }
+};
+
+SC_MODULE( sink )
+{
+ sc_in_clk clk;
+ sc_in<int> in;
+
+ sc_event e;
+
+ void main_action()
+ {
+ int a;
+ while( true ) {
+ wait();
+ cout << sc_delta_count() << " -- " << in.read() << endl;
+ a = in.read();
+ if( ( a % 3 ) == 0 ) {
+ e.notify();
+ }
+ }
+ }
+
+ void other_action()
+ {
+ while( true ) {
+ wait( e );
+ cout << sc_delta_count() << " AA " << in.read() << endl;
+ wait( e | e ); // same as wait( e )
+ cout << sc_delta_count() << " BB " << in.read() << endl;
+ wait( e & e ); // same as wait( e )
+ cout << sc_delta_count() << " CC " << in.read() << endl;
+ wait( e | e | e ); // same as wait( e )
+ cout << sc_delta_count() << " DD " << in.read() << endl;
+ wait( e & e & e ); // same as wait( e )
+ cout << sc_delta_count() << " EE " << in.read() << endl;
+ wait( e & clk->negedge_event() );
+ cout << sc_delta_count() << " FF " << in.read() << endl;
+ wait( e | clk->negedge_event() );
+ cout << sc_delta_count() << " GG " << in.read() << endl;
+ }
+ }
+
+ SC_CTOR( sink )
+ {
+ SC_THREAD( main_action );
+ sensitive << clk.pos();
+ SC_THREAD( other_action );
+ }
+};
+
+int sc_main( int, char** )
+{
+ sc_clock clk;
+
+ sc_signal<int> sig;
+ source src( "src" );
+ sink snk( "snk" );
+
+ src.clk( clk );
+ src.out( sig );
+ snk.clk( clk );
+ snk.in( sig );
+
+ sc_start( 100, SC_NS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test03/golden/test03.log b/src/systemc/tests/systemc/kernel/sc_event/test03/golden/test03.log
new file mode 100644
index 000000000..6c3f9583b
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test03/golden/test03.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+
+Error: (E521) immediate notification is not allowed during update phase or elaboration
+In file: <removed by verify.pl>
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test03/test03.cpp b/src/systemc/tests/systemc/kernel/sc_event/test03/test03.cpp
new file mode 100644
index 000000000..6a9c655de
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test03/test03.cpp
@@ -0,0 +1,72 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test03.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of immediate notification check in the update phase
+
+#include "systemc.h"
+
+class my_signal
+: public sc_signal<int>
+{
+public:
+
+ my_signal()
+ : sc_signal<int>()
+ {}
+
+protected:
+
+ virtual void update()
+ {
+ if( m_new_val != m_cur_val ) {
+ m_cur_val = m_new_val;
+ ((sc_event&)value_changed_event()).notify(); // immediate notification!?
+ }
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ my_signal sig;
+
+ sig.write( 1 );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test04/golden/test04.log b/src/systemc/tests/systemc/kernel/sc_event/test04/golden/test04.log
new file mode 100644
index 000000000..645451b18
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test04/golden/test04.log
@@ -0,0 +1,43 @@
+SystemC Simulation
+*** cancel()
+1:0 s sender - immediate
+1:0 s receiver
+2:0 s sender - immediate
+2:0 s sender - canceled
+2:0 s receiver
+3:0 s sender - delta
+4:0 s receiver
+5:0 s sender - delta
+5:0 s sender - canceled
+7:0 s sender - timed 1 ns
+8:1 ns receiver
+9:1 ns sender - timed 1 ns
+9:1 ns sender - canceled
+11:2 ns sender - timed 2 ns
+12:3 ns sender - canceled
+*** notify()
+14:4 ns sender - delta
+14:4 ns sender - immediate
+14:4 ns receiver
+16:4 ns sender - timed 1 ns
+16:4 ns sender - immediate
+16:4 ns receiver
+18:5 ns sender - timed 2 ns
+19:6 ns sender - immediate
+19:6 ns receiver
+*** notify(t)
+21:7 ns sender - delta
+21:7 ns sender - timed 1 ns
+22:7 ns receiver
+24:8 ns sender - timed 1 ns
+24:8 ns sender - delta
+25:8 ns receiver
+27:9 ns sender - timed 2 ns
+27:9 ns sender - timed 1 ns
+28:10 ns receiver
+30:11 ns sender - timed 1 ns
+30:11 ns sender - timed 2 ns
+31:12 ns receiver
+33:13 ns sender - stop
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test04/test04.cpp b/src/systemc/tests/systemc/kernel/sc_event/test04/test04.cpp
new file mode 100644
index 000000000..2fbf6cc24
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test04/test04.cpp
@@ -0,0 +1,199 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test04.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of sc_event's methods; with dynamic thread receiver
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_event e;
+
+ void write( const char* msg )
+ {
+ cout << sc_delta_count() << ":" << sc_time_stamp()
+ << " " << msg << "\n";
+ }
+
+ void sender()
+ {
+ // wait one delta cycle
+ wait( SC_ZERO_TIME );
+
+ while( true ) {
+
+ // test cancel()
+ cout << "*** cancel()\n";
+
+ // immediate notification
+ e.notify();
+ write( "sender - immediate" );
+ wait( SC_ZERO_TIME );
+
+ // immediate notification -- canceled (no effect)
+ e.notify();
+ write( "sender - immediate" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( SC_ZERO_TIME );
+
+ // delta notification
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // delta notification -- canceled
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // timed notification
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- canceled
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notifiation -- canceled
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 1, SC_NS );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // test notify() -- the exception test is in test03.cpp
+ cout << "*** notify()\n";
+
+ // delta notification -- made immediate
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.notify();
+ write( "sender - immediate" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- made immediate
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify();
+ write( "sender - immediate" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- made immediate
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 1, SC_NS );
+ e.notify();
+ write( "sender - immediate" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // test notify(t)
+ cout << "*** notify(t)\n";
+
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 2, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 2, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ sc_stop();
+ write( "sender - stop" );
+ wait( SC_ZERO_TIME );
+ }
+ }
+
+ void receiver()
+ {
+ while( true ) {
+ wait( e );
+ write( "receiver" );
+ }
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_THREAD( sender );
+ SC_THREAD( receiver );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test05/golden/test05.log b/src/systemc/tests/systemc/kernel/sc_event/test05/golden/test05.log
new file mode 100644
index 000000000..645451b18
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test05/golden/test05.log
@@ -0,0 +1,43 @@
+SystemC Simulation
+*** cancel()
+1:0 s sender - immediate
+1:0 s receiver
+2:0 s sender - immediate
+2:0 s sender - canceled
+2:0 s receiver
+3:0 s sender - delta
+4:0 s receiver
+5:0 s sender - delta
+5:0 s sender - canceled
+7:0 s sender - timed 1 ns
+8:1 ns receiver
+9:1 ns sender - timed 1 ns
+9:1 ns sender - canceled
+11:2 ns sender - timed 2 ns
+12:3 ns sender - canceled
+*** notify()
+14:4 ns sender - delta
+14:4 ns sender - immediate
+14:4 ns receiver
+16:4 ns sender - timed 1 ns
+16:4 ns sender - immediate
+16:4 ns receiver
+18:5 ns sender - timed 2 ns
+19:6 ns sender - immediate
+19:6 ns receiver
+*** notify(t)
+21:7 ns sender - delta
+21:7 ns sender - timed 1 ns
+22:7 ns receiver
+24:8 ns sender - timed 1 ns
+24:8 ns sender - delta
+25:8 ns receiver
+27:9 ns sender - timed 2 ns
+27:9 ns sender - timed 1 ns
+28:10 ns receiver
+30:11 ns sender - timed 1 ns
+30:11 ns sender - timed 2 ns
+31:12 ns receiver
+33:13 ns sender - stop
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test05/test05.cpp b/src/systemc/tests/systemc/kernel/sc_event/test05/test05.cpp
new file mode 100644
index 000000000..3d3e8c8ed
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test05/test05.cpp
@@ -0,0 +1,204 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test05.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of sc_event's methods; with dynamic method receiver
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_event e;
+
+ void write( const char* msg )
+ {
+ cout << sc_delta_count() << ":" << sc_time_stamp()
+ << " " << msg << "\n";
+ }
+
+ void sender()
+ {
+ // wait one delta cycle
+ wait( SC_ZERO_TIME );
+
+ while( true ) {
+
+ // test cancel()
+ cout << "*** cancel()\n";
+
+ // immediate notification
+ e.notify();
+ write( "sender - immediate" );
+ wait( SC_ZERO_TIME );
+
+ // immediate notification -- canceled (no effect)
+ e.notify();
+ write( "sender - immediate" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( SC_ZERO_TIME );
+
+ // delta notification
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // delta notification -- canceled
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // timed notification
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- canceled
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notifiation -- canceled
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 1, SC_NS );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // test notify() -- the exception test is in test03.cpp
+ cout << "*** notify()\n";
+
+ // delta notification -- made immediate
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.notify();
+ write( "sender - immediate" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- made immediate
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify();
+ write( "sender - immediate" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- made immediate
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 1, SC_NS );
+ e.notify();
+ write( "sender - immediate" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // test notify(t)
+ cout << "*** notify(t)\n";
+
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 2, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 2, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ sc_stop();
+ write( "sender - stop" );
+ wait( SC_ZERO_TIME );
+ }
+ }
+
+ bool receiver_first;
+
+ void receiver()
+ {
+ next_trigger( e );
+ if( receiver_first ) {
+ receiver_first = false;
+ return;
+ }
+ write( "receiver" );
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_THREAD( sender );
+ SC_METHOD( receiver );
+ receiver_first = true;
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test06/golden/test06.log b/src/systemc/tests/systemc/kernel/sc_event/test06/golden/test06.log
new file mode 100644
index 000000000..645451b18
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test06/golden/test06.log
@@ -0,0 +1,43 @@
+SystemC Simulation
+*** cancel()
+1:0 s sender - immediate
+1:0 s receiver
+2:0 s sender - immediate
+2:0 s sender - canceled
+2:0 s receiver
+3:0 s sender - delta
+4:0 s receiver
+5:0 s sender - delta
+5:0 s sender - canceled
+7:0 s sender - timed 1 ns
+8:1 ns receiver
+9:1 ns sender - timed 1 ns
+9:1 ns sender - canceled
+11:2 ns sender - timed 2 ns
+12:3 ns sender - canceled
+*** notify()
+14:4 ns sender - delta
+14:4 ns sender - immediate
+14:4 ns receiver
+16:4 ns sender - timed 1 ns
+16:4 ns sender - immediate
+16:4 ns receiver
+18:5 ns sender - timed 2 ns
+19:6 ns sender - immediate
+19:6 ns receiver
+*** notify(t)
+21:7 ns sender - delta
+21:7 ns sender - timed 1 ns
+22:7 ns receiver
+24:8 ns sender - timed 1 ns
+24:8 ns sender - delta
+25:8 ns receiver
+27:9 ns sender - timed 2 ns
+27:9 ns sender - timed 1 ns
+28:10 ns receiver
+30:11 ns sender - timed 1 ns
+30:11 ns sender - timed 2 ns
+31:12 ns receiver
+33:13 ns sender - stop
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test06/test06.cpp b/src/systemc/tests/systemc/kernel/sc_event/test06/test06.cpp
new file mode 100644
index 000000000..5bc975557
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test06/test06.cpp
@@ -0,0 +1,200 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test06.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of sc_event's methods; with static thread receiver
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_event e;
+
+ void write( const char* msg )
+ {
+ cout << sc_delta_count() << ":" << sc_time_stamp()
+ << " " << msg << "\n";
+ }
+
+ void sender()
+ {
+ // wait one delta cycle
+ wait( SC_ZERO_TIME );
+
+ while( true ) {
+
+ // test cancel()
+ cout << "*** cancel()\n";
+
+ // immediate notification
+ e.notify();
+ write( "sender - immediate" );
+ wait( SC_ZERO_TIME );
+
+ // immediate notification -- canceled (no effect)
+ e.notify();
+ write( "sender - immediate" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( SC_ZERO_TIME );
+
+ // delta notification
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // delta notification -- canceled
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // timed notification
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- canceled
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notifiation -- canceled
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 1, SC_NS );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // test notify() -- the exception test is in test03.cpp
+ cout << "*** notify()\n";
+
+ // delta notification -- made immediate
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.notify();
+ write( "sender - immediate" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- made immediate
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify();
+ write( "sender - immediate" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- made immediate
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 1, SC_NS );
+ e.notify();
+ write( "sender - immediate" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // test notify(t)
+ cout << "*** notify(t)\n";
+
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 2, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 2, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ sc_stop();
+ write( "sender - stop" );
+ wait( SC_ZERO_TIME );
+ }
+ }
+
+ void receiver()
+ {
+ while( true ) {
+ wait();
+ write( "receiver" );
+ }
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_THREAD( sender );
+ SC_THREAD( receiver );
+ sensitive << e;
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test07/golden/test07.log b/src/systemc/tests/systemc/kernel/sc_event/test07/golden/test07.log
new file mode 100644
index 000000000..645451b18
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test07/golden/test07.log
@@ -0,0 +1,43 @@
+SystemC Simulation
+*** cancel()
+1:0 s sender - immediate
+1:0 s receiver
+2:0 s sender - immediate
+2:0 s sender - canceled
+2:0 s receiver
+3:0 s sender - delta
+4:0 s receiver
+5:0 s sender - delta
+5:0 s sender - canceled
+7:0 s sender - timed 1 ns
+8:1 ns receiver
+9:1 ns sender - timed 1 ns
+9:1 ns sender - canceled
+11:2 ns sender - timed 2 ns
+12:3 ns sender - canceled
+*** notify()
+14:4 ns sender - delta
+14:4 ns sender - immediate
+14:4 ns receiver
+16:4 ns sender - timed 1 ns
+16:4 ns sender - immediate
+16:4 ns receiver
+18:5 ns sender - timed 2 ns
+19:6 ns sender - immediate
+19:6 ns receiver
+*** notify(t)
+21:7 ns sender - delta
+21:7 ns sender - timed 1 ns
+22:7 ns receiver
+24:8 ns sender - timed 1 ns
+24:8 ns sender - delta
+25:8 ns receiver
+27:9 ns sender - timed 2 ns
+27:9 ns sender - timed 1 ns
+28:10 ns receiver
+30:11 ns sender - timed 1 ns
+30:11 ns sender - timed 2 ns
+31:12 ns receiver
+33:13 ns sender - stop
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test07/test07.cpp b/src/systemc/tests/systemc/kernel/sc_event/test07/test07.cpp
new file mode 100644
index 000000000..5827a3340
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test07/test07.cpp
@@ -0,0 +1,204 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test07.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of sc_event's methods; with static method receiver
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_event e;
+
+ void write( const char* msg )
+ {
+ cout << sc_delta_count() << ":" << sc_time_stamp()
+ << " " << msg << "\n";
+ }
+
+ void sender()
+ {
+ // wait one delta cycle
+ wait( SC_ZERO_TIME );
+
+ while( true ) {
+
+ // test cancel()
+ cout << "*** cancel()\n";
+
+ // immediate notification
+ e.notify();
+ write( "sender - immediate" );
+ wait( SC_ZERO_TIME );
+
+ // immediate notification -- canceled (no effect)
+ e.notify();
+ write( "sender - immediate" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( SC_ZERO_TIME );
+
+ // delta notification
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // delta notification -- canceled
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // timed notification
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- canceled
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notifiation -- canceled
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 1, SC_NS );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // test notify() -- the exception test is in test03.cpp
+ cout << "*** notify()\n";
+
+ // delta notification -- made immediate
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.notify();
+ write( "sender - immediate" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- made immediate
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify();
+ write( "sender - immediate" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- made immediate
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 1, SC_NS );
+ e.notify();
+ write( "sender - immediate" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // test notify(t)
+ cout << "*** notify(t)\n";
+
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 2, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 2, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ sc_stop();
+ write( "sender - stop" );
+ wait( SC_ZERO_TIME );
+ }
+ }
+
+ bool receiver_first;
+
+ void receiver()
+ {
+ if( receiver_first ) {
+ receiver_first = false;
+ return;
+ }
+ write( "receiver" );
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_THREAD( sender );
+ SC_METHOD( receiver );
+ sensitive << e;
+ receiver_first = true;
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test08/golden/test08.log b/src/systemc/tests/systemc/kernel/sc_event/test08/golden/test08.log
new file mode 100644
index 000000000..0a7d55583
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test08/golden/test08.log
@@ -0,0 +1,76 @@
+SystemC Simulation
+*** cancel()
+1:0 s sender - immediate
+1:0 s receiver_static_method
+1:0 s receiver_dynamic_method
+1:0 s receiver_static_thread
+1:0 s receiver_dynamic_thread
+2:0 s sender - immediate
+2:0 s sender - canceled
+2:0 s receiver_static_method
+2:0 s receiver_dynamic_method
+2:0 s receiver_static_thread
+2:0 s receiver_dynamic_thread
+3:0 s sender - delta
+4:0 s receiver_static_method
+4:0 s receiver_dynamic_method
+4:0 s receiver_static_thread
+4:0 s receiver_dynamic_thread
+5:0 s sender - delta
+5:0 s sender - canceled
+7:0 s sender - timed 1 ns
+8:1 ns receiver_static_method
+8:1 ns receiver_dynamic_method
+8:1 ns receiver_static_thread
+8:1 ns receiver_dynamic_thread
+9:1 ns sender - timed 1 ns
+9:1 ns sender - canceled
+11:2 ns sender - timed 2 ns
+12:3 ns sender - canceled
+*** notify()
+14:4 ns sender - delta
+14:4 ns sender - immediate
+14:4 ns receiver_static_method
+14:4 ns receiver_dynamic_method
+14:4 ns receiver_static_thread
+14:4 ns receiver_dynamic_thread
+16:4 ns sender - timed 1 ns
+16:4 ns sender - immediate
+16:4 ns receiver_static_method
+16:4 ns receiver_dynamic_method
+16:4 ns receiver_static_thread
+16:4 ns receiver_dynamic_thread
+18:5 ns sender - timed 2 ns
+19:6 ns sender - immediate
+19:6 ns receiver_static_method
+19:6 ns receiver_dynamic_method
+19:6 ns receiver_static_thread
+19:6 ns receiver_dynamic_thread
+*** notify(t)
+21:7 ns sender - delta
+21:7 ns sender - timed 1 ns
+22:7 ns receiver_static_method
+22:7 ns receiver_dynamic_method
+22:7 ns receiver_static_thread
+22:7 ns receiver_dynamic_thread
+24:8 ns sender - timed 1 ns
+24:8 ns sender - delta
+25:8 ns receiver_static_method
+25:8 ns receiver_dynamic_method
+25:8 ns receiver_static_thread
+25:8 ns receiver_dynamic_thread
+27:9 ns sender - timed 2 ns
+27:9 ns sender - timed 1 ns
+28:10 ns receiver_static_method
+28:10 ns receiver_dynamic_method
+28:10 ns receiver_static_thread
+28:10 ns receiver_dynamic_thread
+30:11 ns sender - timed 1 ns
+30:11 ns sender - timed 2 ns
+31:12 ns receiver_static_method
+31:12 ns receiver_dynamic_method
+31:12 ns receiver_static_thread
+31:12 ns receiver_dynamic_thread
+33:13 ns sender - stop
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test08/test08.cpp b/src/systemc/tests/systemc/kernel/sc_event/test08/test08.cpp
new file mode 100644
index 000000000..a1843adfe
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test08/test08.cpp
@@ -0,0 +1,240 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test08.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of sc_event's methods; with four different receivers
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_event e;
+
+ void write( const char* msg )
+ {
+ cout << sc_delta_count() << ":" << sc_time_stamp()
+ << " " << msg << "\n";
+ }
+
+ void sender()
+ {
+ // wait one delta cycle
+ wait( SC_ZERO_TIME );
+
+ while( true ) {
+
+ // test cancel()
+ cout << "*** cancel()\n";
+
+ // immediate notification
+ e.notify();
+ write( "sender - immediate" );
+ wait( SC_ZERO_TIME );
+
+ // immediate notification -- canceled (no effect)
+ e.notify();
+ write( "sender - immediate" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( SC_ZERO_TIME );
+
+ // delta notification
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // delta notification -- canceled
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // timed notification
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- canceled
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notifiation -- canceled
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 1, SC_NS );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // test notify() -- the exception test is in test03.cpp
+ cout << "*** notify()\n";
+
+ // delta notification -- made immediate
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.notify();
+ write( "sender - immediate" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- made immediate
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify();
+ write( "sender - immediate" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- made immediate
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 1, SC_NS );
+ e.notify();
+ write( "sender - immediate" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // test notify(t)
+ cout << "*** notify(t)\n";
+
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 2, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 2, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ sc_stop();
+ write( "sender - stop" );
+ wait( SC_ZERO_TIME );
+ }
+ }
+
+ bool receiver_static_method_first;
+ bool receiver_dynamic_method_first;
+
+ void receiver_static_method()
+ {
+ if( receiver_static_method_first ) {
+ receiver_static_method_first = false;
+ return;
+ }
+ write( "receiver_static_method" );
+ }
+
+ void receiver_dynamic_method()
+ {
+ next_trigger( e );
+ if( receiver_dynamic_method_first ) {
+ receiver_dynamic_method_first = false;
+ return;
+ }
+ write( "receiver_dynamic_method" );
+ }
+
+ void receiver_static_thread()
+ {
+ while( true ) {
+ wait();
+ write( "receiver_static_thread" );
+ }
+ }
+
+ void receiver_dynamic_thread()
+ {
+ while( true ) {
+ wait( e );
+ write( "receiver_dynamic_thread" );
+ }
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_THREAD( sender );
+
+ SC_METHOD( receiver_static_method );
+ sensitive << e;
+ receiver_static_method_first = true;
+
+ SC_METHOD( receiver_dynamic_method );
+ receiver_dynamic_method_first = true;
+
+ SC_THREAD( receiver_static_thread );
+ sensitive << e;
+
+ SC_THREAD( receiver_dynamic_thread );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test09/golden/test09.log b/src/systemc/tests/systemc/kernel/sc_event/test09/golden/test09.log
new file mode 100644
index 000000000..645451b18
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test09/golden/test09.log
@@ -0,0 +1,43 @@
+SystemC Simulation
+*** cancel()
+1:0 s sender - immediate
+1:0 s receiver
+2:0 s sender - immediate
+2:0 s sender - canceled
+2:0 s receiver
+3:0 s sender - delta
+4:0 s receiver
+5:0 s sender - delta
+5:0 s sender - canceled
+7:0 s sender - timed 1 ns
+8:1 ns receiver
+9:1 ns sender - timed 1 ns
+9:1 ns sender - canceled
+11:2 ns sender - timed 2 ns
+12:3 ns sender - canceled
+*** notify()
+14:4 ns sender - delta
+14:4 ns sender - immediate
+14:4 ns receiver
+16:4 ns sender - timed 1 ns
+16:4 ns sender - immediate
+16:4 ns receiver
+18:5 ns sender - timed 2 ns
+19:6 ns sender - immediate
+19:6 ns receiver
+*** notify(t)
+21:7 ns sender - delta
+21:7 ns sender - timed 1 ns
+22:7 ns receiver
+24:8 ns sender - timed 1 ns
+24:8 ns sender - delta
+25:8 ns receiver
+27:9 ns sender - timed 2 ns
+27:9 ns sender - timed 1 ns
+28:10 ns receiver
+30:11 ns sender - timed 1 ns
+30:11 ns sender - timed 2 ns
+31:12 ns receiver
+33:13 ns sender - stop
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test09/test09.cpp b/src/systemc/tests/systemc/kernel/sc_event/test09/test09.cpp
new file mode 100644
index 000000000..6d2307a97
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test09/test09.cpp
@@ -0,0 +1,199 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test09.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of sc_event's methods; with functional notation for notifying events.
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_event e;
+
+ void write( const char* msg )
+ {
+ cout << sc_delta_count() << ":" << sc_time_stamp()
+ << " " << msg << "\n";
+ }
+
+ void sender()
+ {
+ // wait one delta cycle
+ wait( SC_ZERO_TIME );
+
+ while( true ) {
+
+ // test cancel()
+ cout << "*** cancel()\n";
+
+ // immediate notification
+ e.notify();
+ write( "sender - immediate" );
+ wait( SC_ZERO_TIME );
+
+ // immediate notification -- canceled (no effect)
+ e.notify();
+ write( "sender - immediate" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( SC_ZERO_TIME );
+
+ // delta notification
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // delta notification -- canceled
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // timed notification
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- canceled
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notifiation -- canceled
+ e.notify(2, SC_NS);
+ write( "sender - timed 2 ns" );
+ wait( 1, SC_NS );
+ e.cancel();
+ write( "sender - canceled" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // test notify() -- the exception test is in test03.cpp
+ cout << "*** notify()\n";
+
+ // delta notification -- made immediate
+ e.notify(SC_ZERO_TIME);
+ write( "sender - delta" );
+ e.notify();
+ write( "sender - immediate" );
+ wait( SC_ZERO_TIME );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- made immediate
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify();
+ write( "sender - immediate" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // timed notification -- made immediate
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 1, SC_NS );
+ e.notify();
+ write( "sender - immediate" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ // test notify(t)
+ cout << "*** notify(t)\n";
+
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify( SC_ZERO_TIME );
+ write( "sender - delta" );
+ wait( 1, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ wait( 2, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ e.notify( 1, SC_NS );
+ write( "sender - timed 1 ns" );
+ e.notify( 2, SC_NS );
+ write( "sender - timed 2 ns" );
+ wait( 2, SC_NS );
+ wait( SC_ZERO_TIME );
+
+ sc_stop();
+ write( "sender - stop" );
+ wait( SC_ZERO_TIME );
+ }
+ }
+
+ void receiver()
+ {
+ while( true ) {
+ wait( e );
+ write( "receiver" );
+ }
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_THREAD( sender );
+ SC_THREAD( receiver );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test10/golden/test10.log b/src/systemc/tests/systemc/kernel/sc_event/test10/golden/test10.log
new file mode 100644
index 000000000..735ad78b8
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test10/golden/test10.log
@@ -0,0 +1,60 @@
+SystemC Simulation
+*** wait(e)
+
+Info: (I804) /IEEE_Std_1666/deprecated: timed_out() function is deprecated
+1:0 s sender
+1:0 s receiver - e1
+1:0 s sender
+2:0 s receiver - e2
+2:0 s sender
+3:2 ns receiver - e3
+*** wait(or_list)
+3:2 ns sender
+3:2 ns receiver - e1 | e1 | e1
+3:2 ns sender
+4:2 ns receiver - e2 | e2 | e2
+4:2 ns sender
+5:4 ns receiver - e3 | e3 | e3
+5:4 ns sender
+5:4 ns receiver - e1 | e2 | e3
+5:4 ns sender
+5:4 ns receiver - e3 | e2 | e1
+*** wait(and_list)
+5:4 ns sender
+5:4 ns receiver - e1 & e1 & e1
+5:4 ns sender
+6:4 ns receiver - e2 & e2 & e2
+6:4 ns sender
+7:6 ns receiver - e3 & e3 & e3
+7:6 ns sender
+8:8 ns receiver - e1 & e2 & e3
+8:8 ns sender
+9:10 ns receiver - e3 & e2 & e1
+*** wait(t)
+10:10 ns receiver - 0 ns
+11:11 ns sender - timed out
+11:11 ns receiver - 1 ns
+*** wait(t,e)
+11:11 ns sender
+11:11 ns receiver - 1 ns | e1
+11:11 ns sender
+12:11 ns receiver - 1 ns | e2
+12:11 ns sender
+13:12 ns receiver - 1 ns | e3 - timed out
+*** wait(t,or_list)
+13:12 ns sender
+13:12 ns receiver - 1 ns | e1 | e2 | e3
+*** wait(t,and_list)
+13:12 ns sender
+14:13 ns receiver - 1 ns | e1 & e2 & e3 - timed out
+14:13 ns receiver - stop
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+
+Info: (I804) /IEEE_Std_1666/deprecated: You can turn off warnings about
+ IEEE 1666 deprecated features by placing this method call
+ as the first statement in your sc_main() function:
+
+ sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated",
+ sc_core::SC_DO_NOTHING );
+
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test10/test10.cpp b/src/systemc/tests/systemc/kernel/sc_event/test10/test10.cpp
new file mode 100644
index 000000000..14828d75f
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test10/test10.cpp
@@ -0,0 +1,190 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test10.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of wait() for dynamic sensitivity
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_event e1;
+ sc_event e2;
+ sc_event e3;
+ sc_event e_ack;
+
+ void write( const char* msg )
+ {
+ cout << sc_delta_count() << ":" << sc_time_stamp()
+ << " " << msg << "\n";
+ }
+
+ void sender()
+ {
+ // wait one delta cycle
+ wait( SC_ZERO_TIME );
+
+ while( true ) {
+ e1.notify();
+ e2.notify( SC_ZERO_TIME );
+ e3.notify( 2, SC_NS );
+ timed_out() ? write( "sender - timed out" )
+ : write( "sender" );
+ wait( 3, SC_NS, e_ack );
+ e2.cancel();
+ e3.cancel();
+ }
+ }
+
+ void receiver()
+ {
+ sc_time t1( 1, SC_NS );
+
+ while( true ) {
+
+ // test wait(e)
+ cout << "*** wait(e)\n";
+
+ wait( e1 );
+ write( "receiver - e1" );
+ e_ack.notify();
+ wait( e2 );
+ write( "receiver - e2" );
+ e_ack.notify();
+ wait( e3 );
+ write( "receiver - e3" );
+ e_ack.notify();
+
+ // test wait(or_list)
+ cout << "*** wait(or_list)\n";
+
+ wait( e1 | e1 | e1 );
+ write( "receiver - e1 | e1 | e1" );
+ e_ack.notify();
+ wait( e2 | e2 | e2 );
+ write( "receiver - e2 | e2 | e2" );
+ e_ack.notify();
+ wait( e3 | e3 | e3 );
+ write( "receiver - e3 | e3 | e3" );
+ e_ack.notify();
+ wait( e1 | e2 | e3 );
+ write( "receiver - e1 | e2 | e3" );
+ e_ack.notify();
+ wait( e3 | e2 | e1 );
+ write( "receiver - e3 | e2 | e1" );
+ e_ack.notify();
+
+ // test wait(and_list)
+ cout << "*** wait(and_list)\n";
+
+ wait( e1 & e1 & e1 );
+ write( "receiver - e1 & e1 & e1" );
+ e_ack.notify();
+ wait( e2 & e2 & e2 );
+ write( "receiver - e2 & e2 & e2" );
+ e_ack.notify();
+ wait( e3 & e3 & e3 );
+ write( "receiver - e3 & e3 & e3" );
+ e_ack.notify();
+ wait( e1 & e2 & e3 );
+ write( "receiver - e1 & e2 & e3" );
+ e_ack.notify();
+ wait( e3 & e2 & e1 );
+ write( "receiver - e3 & e2 & e1" );
+
+ // test wait(t)
+ cout << "*** wait(t)\n";
+
+ wait( 0, SC_NS );
+ write( "receiver - 0 ns" );
+ wait( 1, SC_NS );
+ write( "receiver - 1 ns" );
+
+ e_ack.notify();
+
+ // test wait(t,e)
+ cout << "*** wait(t,e)\n";
+
+ wait( 1, SC_NS, e1 );
+ timed_out() ? write( "receiver - 1 ns | e1 - timed out" )
+ : write( "receiver - 1 ns | e1" );
+ e_ack.notify();
+ wait( t1, e2 );
+ timed_out() ? write( "receiver - 1 ns | e2 - timed out" )
+ : write( "receiver - 1 ns | e2" );
+ e_ack.notify();
+ wait( 1, SC_NS, e3 );
+ timed_out() ? write( "receiver - 1 ns | e3 - timed out" )
+ : write( "receiver - 1 ns | e3" );
+ e_ack.notify();
+
+ // test wait(t,or_list)
+ cout << "*** wait(t,or_list)\n";
+
+ wait( t1, e1 | e2 | e3 );
+ timed_out() ? write( "receiver - 1 ns | e1 | e2 | e3 - timed out" )
+ : write( "receiver - 1 ns | e1 | e2 | e3" );
+ e_ack.notify();
+
+ // test wait(t,and_list)
+ cout << "*** wait(t,and_list)\n";
+
+ wait( t1, e1 & e2 & e3 );
+ timed_out() ? write( "receiver - 1 ns | e1 & e2 & e3 - timed out" )
+ : write( "receiver - 1 ns | e1 & e2 & e3" );
+
+ sc_stop();
+ write( "receiver - stop" );
+ wait( SC_ZERO_TIME );
+ }
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_THREAD( sender );
+ SC_THREAD( receiver );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test11/golden/test11.log b/src/systemc/tests/systemc/kernel/sc_event/test11/golden/test11.log
new file mode 100644
index 000000000..3d7d9352d
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test11/golden/test11.log
@@ -0,0 +1,60 @@
+SystemC Simulation
+*** next_trigger(e)
+
+Info: (I804) /IEEE_Std_1666/deprecated: timed_out() function is deprecated
+1:0 s sender
+1:0 s receiver - e1
+1:0 s sender
+2:0 s receiver - e2
+2:0 s sender
+3:2 ns receiver - e3
+*** next_trigger(or_list)
+3:2 ns sender
+3:2 ns receiver - e1 | e1 | e1
+3:2 ns sender
+4:2 ns receiver - e2 | e2 | e2
+4:2 ns sender
+5:4 ns receiver - e3 | e3 | e3
+5:4 ns sender
+5:4 ns receiver - e1 | e2 | e3
+5:4 ns sender
+5:4 ns receiver - e3 | e2 | e1
+*** next_trigger(and_list)
+5:4 ns sender
+5:4 ns receiver - e1 & e1 & e1
+5:4 ns sender
+6:4 ns receiver - e2 & e2 & e2
+6:4 ns sender
+7:6 ns receiver - e3 & e3 & e3
+7:6 ns sender
+8:8 ns receiver - e1 & e2 & e3
+8:8 ns sender
+9:10 ns receiver - e3 & e2 & e1
+*** next_trigger(t)
+10:10 ns receiver - 0 ns
+11:11 ns sender - timed out
+11:11 ns receiver - 1 ns
+*** next_trigger(t,e)
+11:11 ns sender
+11:11 ns receiver - 1 ns | e1
+11:11 ns sender
+12:11 ns receiver - 1 ns | e2
+12:11 ns sender
+13:12 ns receiver - 1 ns | e3 - timed out
+*** next_trigger(t,or_list)
+13:12 ns sender
+13:12 ns receiver - 1 ns | e1 | e2 | e3
+*** next_trigger(t,and_list)
+13:12 ns sender
+14:13 ns receiver - 1 ns | e1 & e2 & e3 - timed out
+14:13 ns receiver - stop
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+
+Info: (I804) /IEEE_Std_1666/deprecated: You can turn off warnings about
+ IEEE 1666 deprecated features by placing this method call
+ as the first statement in your sc_main() function:
+
+ sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated",
+ sc_core::SC_DO_NOTHING );
+
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test11/test11.cpp b/src/systemc/tests/systemc/kernel/sc_event/test11/test11.cpp
new file mode 100644
index 000000000..ec52c39db
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test11/test11.cpp
@@ -0,0 +1,241 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test11.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of next_trigger() for dynamic sensitivity
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_event e1;
+ sc_event e2;
+ sc_event e3;
+ sc_event e_ack;
+
+ void write( const char* msg )
+ {
+ cout << sc_delta_count() << ":" << sc_time_stamp()
+ << " " << msg << "\n";
+ }
+
+ bool sender_first;
+
+ void sender()
+ {
+ if( sender_first ) {
+ next_trigger( SC_ZERO_TIME );
+ sender_first = false;
+ return;
+ }
+
+ e2.cancel();
+ e3.cancel();
+ e1.notify();
+ e2.notify( SC_ZERO_TIME );
+ e3.notify( 2, SC_NS );
+ timed_out() ? write( "sender - timed out" )
+ : write( "sender" );
+ next_trigger( 3, SC_NS, e_ack );
+ }
+
+ int receiver_state;
+
+ void receiver()
+ {
+ sc_time t1( 1, SC_NS );
+
+ switch( receiver_state ) {
+ case 0:
+ // test next_trigger(e)
+ cout << "*** next_trigger(e)\n";
+
+ next_trigger( e1 );
+ break;
+ case 1:
+ write( "receiver - e1" );
+ e_ack.notify();
+ next_trigger( e2 );
+ break;
+ case 2:
+ write( "receiver - e2" );
+ e_ack.notify();
+ next_trigger( e3 );
+ break;
+ case 3:
+ write( "receiver - e3" );
+ e_ack.notify();
+
+ // test next_trigger(or_list)
+ cout << "*** next_trigger(or_list)\n";
+
+ next_trigger( e1 | e1 | e1 );
+ break;
+ case 4:
+ write( "receiver - e1 | e1 | e1" );
+ e_ack.notify();
+ next_trigger( e2 | e2 | e2 );
+ break;
+ case 5:
+ write( "receiver - e2 | e2 | e2" );
+ e_ack.notify();
+ next_trigger( e3 | e3 | e3 );
+ break;
+ case 6:
+ write( "receiver - e3 | e3 | e3" );
+ e_ack.notify();
+ next_trigger( e1 | e2 | e3 );
+ break;
+ case 7:
+ write( "receiver - e1 | e2 | e3" );
+ e_ack.notify();
+ next_trigger( e3 | e2 | e1 );
+ break;
+ case 8:
+ write( "receiver - e3 | e2 | e1" );
+ e_ack.notify();
+
+ // test next_trigger(and_list)
+ cout << "*** next_trigger(and_list)\n";
+
+ next_trigger( e1 & e1 & e1 );
+ break;
+ case 9:
+ write( "receiver - e1 & e1 & e1" );
+ e_ack.notify();
+ next_trigger( e2 & e2 & e2 );
+ break;
+ case 10:
+ write( "receiver - e2 & e2 & e2" );
+ e_ack.notify();
+ next_trigger( e3 & e3 & e3 );
+ break;
+ case 11:
+ write( "receiver - e3 & e3 & e3" );
+ e_ack.notify();
+ next_trigger( e1 & e2 & e3 );
+ break;
+ case 12:
+ write( "receiver - e1 & e2 & e3" );
+ e_ack.notify();
+ next_trigger( e3 & e2 & e1 );
+ break;
+ case 13:
+ write( "receiver - e3 & e2 & e1" );
+
+ // test next_trigger(t)
+ cout << "*** next_trigger(t)\n";
+
+ next_trigger( 0, SC_NS );
+ break;
+ case 14:
+ write( "receiver - 0 ns" );
+ next_trigger( 1, SC_NS );
+ break;
+ case 15:
+ write( "receiver - 1 ns" );
+
+ e_ack.notify();
+
+ // test next_trigger(t,e)
+ cout << "*** next_trigger(t,e)\n";
+
+ next_trigger( 1, SC_NS, e1 );
+ break;
+ case 16:
+ timed_out() ? write( "receiver - 1 ns | e1 - timed out" )
+ : write( "receiver - 1 ns | e1" );
+ e_ack.notify();
+ next_trigger( t1, e2 );
+ break;
+ case 17:
+ timed_out() ? write( "receiver - 1 ns | e2 - timed out" )
+ : write( "receiver - 1 ns | e2" );
+ e_ack.notify();
+ next_trigger( 1, SC_NS, e3 );
+ break;
+ case 18:
+ timed_out() ? write( "receiver - 1 ns | e3 - timed out" )
+ : write( "receiver - 1 ns | e3" );
+ e_ack.notify();
+
+ // test next_trigger(t,or_list)
+ cout << "*** next_trigger(t,or_list)\n";
+
+ next_trigger( t1, e1 | e2 | e3 );
+ break;
+ case 19:
+ timed_out() ? write( "receiver - 1 ns | e1 | e2 | e3 - timed out" )
+ : write( "receiver - 1 ns | e1 | e2 | e3" );
+ e_ack.notify();
+
+ // test next_trigger(t,and_list)
+ cout << "*** next_trigger(t,and_list)\n";
+
+ next_trigger( t1, e1 & e2 & e3 );
+ break;
+ case 20:
+ timed_out() ? write( "receiver - 1 ns | e1 & e2 & e3 - timed out" )
+ : write( "receiver - 1 ns | e1 & e2 & e3" );
+
+ sc_stop();
+ write( "receiver - stop" );
+ next_trigger( SC_ZERO_TIME );
+ break;
+ default:
+ sc_assert( false );
+ }
+ receiver_state ++;
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_METHOD( sender );
+ sender_first = true;
+ SC_METHOD( receiver );
+ receiver_state = 0;
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test12/golden/test12.log b/src/systemc/tests/systemc/kernel/sc_event/test12/golden/test12.log
new file mode 100644
index 000000000..3d7d9352d
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test12/golden/test12.log
@@ -0,0 +1,60 @@
+SystemC Simulation
+*** next_trigger(e)
+
+Info: (I804) /IEEE_Std_1666/deprecated: timed_out() function is deprecated
+1:0 s sender
+1:0 s receiver - e1
+1:0 s sender
+2:0 s receiver - e2
+2:0 s sender
+3:2 ns receiver - e3
+*** next_trigger(or_list)
+3:2 ns sender
+3:2 ns receiver - e1 | e1 | e1
+3:2 ns sender
+4:2 ns receiver - e2 | e2 | e2
+4:2 ns sender
+5:4 ns receiver - e3 | e3 | e3
+5:4 ns sender
+5:4 ns receiver - e1 | e2 | e3
+5:4 ns sender
+5:4 ns receiver - e3 | e2 | e1
+*** next_trigger(and_list)
+5:4 ns sender
+5:4 ns receiver - e1 & e1 & e1
+5:4 ns sender
+6:4 ns receiver - e2 & e2 & e2
+6:4 ns sender
+7:6 ns receiver - e3 & e3 & e3
+7:6 ns sender
+8:8 ns receiver - e1 & e2 & e3
+8:8 ns sender
+9:10 ns receiver - e3 & e2 & e1
+*** next_trigger(t)
+10:10 ns receiver - 0 ns
+11:11 ns sender - timed out
+11:11 ns receiver - 1 ns
+*** next_trigger(t,e)
+11:11 ns sender
+11:11 ns receiver - 1 ns | e1
+11:11 ns sender
+12:11 ns receiver - 1 ns | e2
+12:11 ns sender
+13:12 ns receiver - 1 ns | e3 - timed out
+*** next_trigger(t,or_list)
+13:12 ns sender
+13:12 ns receiver - 1 ns | e1 | e2 | e3
+*** next_trigger(t,and_list)
+13:12 ns sender
+14:13 ns receiver - 1 ns | e1 & e2 & e3 - timed out
+14:13 ns receiver - stop
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+
+Info: (I804) /IEEE_Std_1666/deprecated: You can turn off warnings about
+ IEEE 1666 deprecated features by placing this method call
+ as the first statement in your sc_main() function:
+
+ sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated",
+ sc_core::SC_DO_NOTHING );
+
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test12/test12.cpp b/src/systemc/tests/systemc/kernel/sc_event/test12/test12.cpp
new file mode 100644
index 000000000..0d9bdafb7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test12/test12.cpp
@@ -0,0 +1,261 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test12.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of next_trigger() for dynamic sensitivity; last call counts
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_event e1;
+ sc_event e2;
+ sc_event e3;
+ sc_event e_ack;
+
+ void write( const char* msg )
+ {
+ cout << sc_delta_count() << ":" << sc_time_stamp()
+ << " " << msg << "\n";
+ }
+
+ bool sender_first;
+
+ void sender()
+ {
+ next_trigger( SC_ZERO_TIME );
+ if( sender_first ) {
+ sender_first = false;
+ return;
+ }
+
+ e2.cancel();
+ e3.cancel();
+ e1.notify();
+ e2.notify( SC_ZERO_TIME );
+ e3.notify( 2, SC_NS );
+ timed_out() ? write( "sender - timed out" )
+ : write( "sender" );
+ next_trigger( 3, SC_NS, e_ack );
+ }
+
+ int receiver_state;
+
+ void receiver()
+ {
+ sc_time t1( 1, SC_NS );
+
+ switch( receiver_state ) {
+ case 0:
+ // test next_trigger(e)
+ cout << "*** next_trigger(e)\n";
+
+ next_trigger( e1 );
+ break;
+ case 1:
+ write( "receiver - e1" );
+ e_ack.notify();
+ next_trigger( e1 );
+ next_trigger( e2 );
+ break;
+ case 2:
+ write( "receiver - e2" );
+ e_ack.notify();
+ next_trigger( e2 );
+ next_trigger( e3 );
+ break;
+ case 3:
+ write( "receiver - e3" );
+ e_ack.notify();
+
+ // test next_trigger(or_list)
+ cout << "*** next_trigger(or_list)\n";
+
+ next_trigger( e3 );
+ next_trigger( e1 | e1 | e1 );
+ break;
+ case 4:
+ write( "receiver - e1 | e1 | e1" );
+ e_ack.notify();
+ next_trigger( e1 | e1 | e1 );
+ next_trigger( e2 | e2 | e2 );
+ break;
+ case 5:
+ write( "receiver - e2 | e2 | e2" );
+ e_ack.notify();
+ next_trigger( e2 | e2 | e2 );
+ next_trigger( e3 | e3 | e3 );
+ break;
+ case 6:
+ write( "receiver - e3 | e3 | e3" );
+ e_ack.notify();
+ next_trigger( e3 | e3 | e3 );
+ next_trigger( e1 | e2 | e3 );
+ break;
+ case 7:
+ write( "receiver - e1 | e2 | e3" );
+ e_ack.notify();
+ next_trigger( e1 | e2 | e3 );
+ next_trigger( e3 | e2 | e1 );
+ break;
+ case 8:
+ write( "receiver - e3 | e2 | e1" );
+ e_ack.notify();
+
+ // test next_trigger(and_list)
+ cout << "*** next_trigger(and_list)\n";
+
+ next_trigger( e3 | e2 | e1 );
+ next_trigger( e1 & e1 & e1 );
+ break;
+ case 9:
+ write( "receiver - e1 & e1 & e1" );
+ e_ack.notify();
+ next_trigger( e1 & e1 & e1 );
+ next_trigger( e2 & e2 & e2 );
+ break;
+ case 10:
+ write( "receiver - e2 & e2 & e2" );
+ e_ack.notify();
+ next_trigger( e2 & e2 & e2 );
+ next_trigger( e3 & e3 & e3 );
+ break;
+ case 11:
+ write( "receiver - e3 & e3 & e3" );
+ e_ack.notify();
+ next_trigger( e3 & e3 & e3 );
+ next_trigger( e1 & e2 & e3 );
+ break;
+ case 12:
+ write( "receiver - e1 & e2 & e3" );
+ e_ack.notify();
+ next_trigger( e1 & e2 & e3 );
+ next_trigger( e3 & e2 & e1 );
+ break;
+ case 13:
+ write( "receiver - e3 & e2 & e1" );
+
+ // test next_trigger(t)
+ cout << "*** next_trigger(t)\n";
+
+ next_trigger( e3 & e2 & e1 );
+ next_trigger( 0, SC_NS );
+ break;
+ case 14:
+ write( "receiver - 0 ns" );
+ next_trigger( 0, SC_NS );
+ next_trigger( 1, SC_NS );
+ break;
+ case 15:
+ write( "receiver - 1 ns" );
+
+ e_ack.notify();
+
+ // test next_trigger(t,e)
+ cout << "*** next_trigger(t,e)\n";
+
+ next_trigger( 1, SC_NS );
+ next_trigger( 1, SC_NS, e1 );
+ break;
+ case 16:
+ timed_out() ? write( "receiver - 1 ns | e1 - timed out" )
+ : write( "receiver - 1 ns | e1" );
+ e_ack.notify();
+ next_trigger( 1, SC_NS, e1 );
+ next_trigger( t1, e2 );
+ break;
+ case 17:
+ timed_out() ? write( "receiver - 1 ns | e2 - timed out" )
+ : write( "receiver - 1 ns | e2" );
+ e_ack.notify();
+ next_trigger( t1, e2 );
+ next_trigger( 1, SC_NS, e3 );
+ break;
+ case 18:
+ timed_out() ? write( "receiver - 1 ns | e3 - timed out" )
+ : write( "receiver - 1 ns | e3" );
+ e_ack.notify();
+
+ // test next_trigger(t,or_list)
+ cout << "*** next_trigger(t,or_list)\n";
+
+ next_trigger( 1, SC_NS, e3 );
+ next_trigger( t1, e1 | e2 | e3 );
+ break;
+ case 19:
+ timed_out() ? write( "receiver - 1 ns | e1 | e2 | e3 - timed out" )
+ : write( "receiver - 1 ns | e1 | e2 | e3" );
+ e_ack.notify();
+
+ // test next_trigger(t,and_list)
+ cout << "*** next_trigger(t,and_list)\n";
+
+ next_trigger( t1, e1 | e2 | e3 );
+ next_trigger( t1, e1 & e2 & e3 );
+ break;
+ case 20:
+ timed_out() ? write( "receiver - 1 ns | e1 & e2 & e3 - timed out" )
+ : write( "receiver - 1 ns | e1 & e2 & e3" );
+
+ sc_stop();
+ write( "receiver - stop" );
+ next_trigger( t1, e1 & e2 & e3 );
+ next_trigger( SC_ZERO_TIME );
+ break;
+ default:
+ sc_assert( false );
+ }
+ receiver_state ++;
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_METHOD( sender );
+ sender_first = true;
+ SC_METHOD( receiver );
+ receiver_state = 0;
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test13/golden/test13.log b/src/systemc/tests/systemc/kernel/sc_event/test13/golden/test13.log
new file mode 100644
index 000000000..d243d6ae2
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test13/golden/test13.log
@@ -0,0 +1,13 @@
+SystemC Simulation
+sender notifies e2 after 10 ns, receiver e1 at zero time
+simulation time:0 s sender - e2
+simulation time:0 s receiver - e1
+simulation time:0 s sender - e2
+simulation time:10 ns receiver - e1
+simulation time:10 ns sender - e2
+simulation time:20 ns receiver - e1
+simulation time:20 ns sender - e2
+simulation time:30 ns receiver - e1
+simulation time:30 ns sender - e2
+simulation time:40 ns receiver - e1
+simulation time:40 ns sender - e2
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test13/test13.cpp b/src/systemc/tests/systemc/kernel/sc_event/test13/test13.cpp
new file mode 100644
index 000000000..144b46e94
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test13/test13.cpp
@@ -0,0 +1,89 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test13.cpp --
+
+ Original Author: Ucar Aziz, Synopsys, Inc., 2002-02-15
+ Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of next_trigger() for static sensitivity
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_event e1;
+ sc_event e2;
+
+ void write( const char* msg )
+ {
+ cout <<"simulation time" << ":" << sc_time_stamp()
+ << " " << msg << endl;
+
+ }
+
+ void sender()
+ {
+ write( "sender - e2" );
+ e2.notify(10, SC_NS );
+ next_trigger();
+ }
+
+
+ void receiver()
+ {
+ next_trigger();
+ write( "receiver - e1" );
+ e1.notify(SC_ZERO_TIME );
+ }
+
+
+ SC_CTOR( mod_a )
+ {
+ SC_METHOD( sender );
+ sensitive << e1;
+ SC_METHOD( receiver );
+ sensitive << e2;
+ }
+};
+
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+ cout<<"sender notifies e2 after 10 ns, receiver e1 at zero time" << endl;
+ sc_start(50,SC_NS);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test14/golden/test14.log b/src/systemc/tests/systemc/kernel/sc_event/test14/golden/test14.log
new file mode 100644
index 000000000..bdb5a2660
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test14/golden/test14.log
@@ -0,0 +1,36 @@
+SystemC Simulation
+
+sender_1 notifies e1 after 10 ns, e2 after 20 ns
+sender_2 notifies e3 after 10 ns, e4 after 15 ns
+receiver_1 notifies e5 after 10 ns
+receiver_2 notifies e6 after 10 ns
+
+simulation time:0 s sender_1 -e1 -e2
+simulation time:0 s sender_2 -e3 -e4
+simulation time:10 ns receiver_1 -e5
+simulation time:15 ns sender_1 -e1 -e2
+simulation time:15 ns receiver_2 -e6
+simulation time:20 ns receiver_2 -e6
+simulation time:20 ns sender_2 -e3 -e4
+simulation time:25 ns sender_1 -e1 -e2
+simulation time:30 ns receiver_1 -e5
+simulation time:35 ns receiver_2 -e6
+simulation time:35 ns sender_1 -e1 -e2
+simulation time:40 ns sender_2 -e3 -e4
+simulation time:45 ns sender_1 -e1 -e2
+simulation time:45 ns receiver_2 -e6
+simulation time:50 ns receiver_1 -e5
+simulation time:55 ns sender_1 -e1 -e2
+simulation time:55 ns receiver_2 -e6
+simulation time:60 ns sender_2 -e3 -e4
+simulation time:65 ns sender_1 -e1 -e2
+simulation time:65 ns receiver_2 -e6
+simulation time:70 ns receiver_1 -e5
+simulation time:75 ns sender_1 -e1 -e2
+simulation time:75 ns receiver_2 -e6
+simulation time:80 ns sender_2 -e3 -e4
+simulation time:85 ns sender_1 -e1 -e2
+simulation time:85 ns receiver_2 -e6
+simulation time:90 ns receiver_1 -e5
+simulation time:95 ns sender_1 -e1 -e2
+simulation time:95 ns receiver_2 -e6
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test14/test14.cpp b/src/systemc/tests/systemc/kernel/sc_event/test14/test14.cpp
new file mode 100644
index 000000000..544a8d046
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test14/test14.cpp
@@ -0,0 +1,120 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test14.cpp --
+
+ Original Author: Ucar Aziz, Synopsys, Inc., 2002-02-15
+ Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of wait(..) for dynamic sensitivity
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_event e1;
+ sc_event e2;
+ sc_event e3;
+ sc_event e4;
+ sc_event e5;
+ sc_event e6;
+
+ void write( const char* msg )
+ {
+ cout <<"simulation time" << ":" << sc_time_stamp()
+ << " " << msg << endl;
+
+ }
+
+ void sender1()
+ {
+ while(true){
+ write( "sender_1 -e1 -e2" );
+ e1.notify(10, SC_NS);
+ e2.notify(20, SC_NS);
+ wait(15, SC_NS, e4 | e6);
+ }
+ }
+
+ void sender2()
+ {
+ while(true){
+ write( "sender_2 -e3 -e4" );
+ e3.notify(10, SC_NS);
+ e4.notify(15, SC_NS);
+ wait(20, SC_NS, e2 & e5);
+ }
+ }
+
+ void receiver1()
+ {
+ while(true){
+ wait(e1 & e3);
+ write( "receiver_1 -e5" );
+ e5.notify(10,SC_NS );
+ }
+ }
+
+ void receiver2()
+ {
+ while(true){
+ wait(e2 | e4);
+ write( "receiver_2 -e6" );
+ e6.notify(10,SC_NS );
+ }
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_THREAD(sender1);
+ SC_THREAD(sender2);
+ SC_THREAD(receiver1);
+ SC_THREAD(receiver2);
+ }
+};
+
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+ cout<<endl;
+ cout<<"sender_1 notifies e1 after 10 ns, e2 after 20 ns\n";
+ cout<<"sender_2 notifies e3 after 10 ns, e4 after 15 ns\n";
+ cout<<"receiver_1 notifies e5 after 10 ns\n";
+ cout<<"receiver_2 notifies e6 after 10 ns\n";
+ cout << endl;
+ sc_start(100,SC_NS);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test15/event_triggered.cpp b/src/systemc/tests/systemc/kernel/sc_event/test15/event_triggered.cpp
new file mode 100644
index 000000000..fee0d2516
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test15/event_triggered.cpp
@@ -0,0 +1,203 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ event_triggered.cpp -- test sc_event::triggered
+
+ Original Author: Philipp A. Hartmann, Intel Corporation - 2017-08-06
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include <systemc>
+#include <iomanip>
+
+#ifdef BENCHMARK
+ static const sc_dt::uint64 num_events = 128;
+ static const sc_dt::uint64 num_triggers = 4;
+ static const sc_dt::uint64 num_iterations = 10000000;
+# define CHECK(expr) ((void)0)
+#else
+ static const sc_dt::uint64 num_events = 16;
+ static const sc_dt::uint64 num_triggers = 4;
+ static const sc_dt::uint64 num_iterations = 4;
+# define CHECK(expr) sc_assert(expr)
+#endif
+
+#ifndef UINT64_C
+#if defined(_WIN32) && !defined(__MINGW32__)
+# define UINT64_C(v) v ## ui64
+#else
+# define UINT64_C(v) v ## ULL
+#endif
+#endif // UINT64_C
+
+using namespace sc_core;
+
+SC_MODULE( module )
+{
+ sc_vector<sc_event> events;
+ sc_event event_return;
+
+ SC_CTOR( module )
+ : events("ev", num_events)
+ , m_rng_state()
+ {
+ SC_THREAD(driver);
+
+ SC_THREAD(consumer_dynamic);
+ SC_THREAD(consumer_static); // odd events only
+ for(unsigned i = 1; i<events.size(); i+=2)
+ sensitive << events[i];
+ }
+private:
+
+ void driver()
+ {
+ CHECK( !event_return.triggered() );
+ wait(1, SC_NS);
+ CHECK( !event_return.triggered() );
+
+ random_notify();
+ random_notify();
+ wait(event_return);
+
+ random_notify(SC_ZERO_TIME);
+ random_notify(SC_ZERO_TIME);
+ wait(event_return);
+
+ random_notify(sc_time(1, SC_NS));
+ random_notify(sc_time(1, SC_NS));
+ wait(event_return);
+ wait(2, SC_NS);
+ CHECK( !event_return.triggered() );
+
+ for(unsigned i = 0; i < num_triggers; ++i)
+ random_notify();
+ wait(event_return);
+ CHECK( event_return.triggered() );
+
+ for(unsigned i = 0; i < num_triggers; ++i)
+ random_notify(SC_ZERO_TIME);
+ wait(event_return);
+ CHECK( event_return.triggered() );
+
+ for(unsigned iter = 0; iter < num_iterations; ++iter) {
+ for(unsigned i = 0; i < num_triggers; ++i) {
+ random_notify(sc_time(1, SC_NS));
+ }
+ wait(event_return);
+ }
+ CHECK( event_return.triggered() );
+ }
+
+ void consumer_dynamic()
+ {
+ sc_event_or_list events_or; // even events only
+ for(unsigned i = 0; i < events.size(); i+=2)
+ events_or |= events[i];
+
+ while(true) {
+ wait(events_or);
+ print_triggered();
+ event_return.notify();
+ }
+ }
+
+ void consumer_static()
+ {
+ while(true) {
+ wait();
+ print_triggered();
+ event_return.notify();
+ }
+ }
+
+ void print_triggered()
+ {
+#ifndef BENCHMARK
+ using namespace std;
+ cout
+ << setw(6) << sc_time_stamp()
+ << " (" << sc_delta_count() << "): "
+ << sc_get_current_process_handle().name() << ": ";
+ for(unsigned i =0; i< events.size(); ++i)
+ if (events[i].triggered())
+ std::cout << events[i].basename() << " ";
+ cout << endl;
+#endif
+ }
+
+ void random_notify()
+ { random_notify(SC_ZERO_TIME, true); }
+
+ void random_notify(const sc_time& t, bool immediate = false)
+ {
+ sc_event& ev = events[ lcg_rng() % num_events ];
+#ifndef BENCHMARK
+ using namespace std;
+ cout
+ << setw(6) << sc_time_stamp()
+ << " (" << sc_delta_count() << "): "
+ << sc_get_current_process_handle().name() << ": "
+ << ev.basename();
+ if (immediate) {
+ cout << ".notify()";
+ } else {
+ cout << ".notify(" << t << ")";
+ }
+ cout << endl;
+#endif
+ if (immediate) {
+ ev.notify();
+ } else {
+ ev.notify(t);
+ }
+ }
+
+ unsigned lcg_rng()
+ {
+ m_rng_state = UINT64_C(2862933555777941757) * m_rng_state
+ + UINT64_C(3037000493);
+ return ( m_rng_state >> 48 );
+ }
+
+ sc_dt::uint64 m_rng_state;
+};
+
+
+int
+sc_main( int, char*[] )
+{
+ module m("m");
+ sc_start();
+ sc_stop();
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_event/test15/golden/event_triggered.log b/src/systemc/tests/systemc/kernel/sc_event/test15/golden/event_triggered.log
new file mode 100644
index 000000000..911cbc94f
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_event/test15/golden/event_triggered.log
@@ -0,0 +1,48 @@
+SystemC Simulation
+ 1 ns (1): m.driver: ev_0.notify()
+ 1 ns (1): m.driver: ev_6.notify()
+ 1 ns (1): m.consumer_dynamic: ev_0 ev_6
+ 1 ns (1): m.driver: ev_1.notify(0 s)
+ 1 ns (1): m.driver: ev_15.notify(0 s)
+ 1 ns (2): m.consumer_static: ev_1 ev_15
+ 1 ns (2): m.driver: ev_8.notify(1 ns)
+ 1 ns (2): m.driver: ev_7.notify(1 ns)
+ 2 ns (3): m.consumer_dynamic: ev_7 ev_8
+ 2 ns (3): m.consumer_static: ev_7 ev_8
+ 4 ns (4): m.driver: ev_5.notify()
+ 4 ns (4): m.driver: ev_9.notify()
+ 4 ns (4): m.driver: ev_13.notify()
+ 4 ns (4): m.driver: ev_2.notify()
+ 4 ns (4): m.consumer_static: ev_2 ev_5 ev_9 ev_13
+ 4 ns (4): m.consumer_dynamic: ev_2 ev_5 ev_9 ev_13
+ 4 ns (4): m.driver: ev_9.notify(0 s)
+ 4 ns (4): m.driver: ev_5.notify(0 s)
+ 4 ns (4): m.driver: ev_12.notify(0 s)
+ 4 ns (4): m.driver: ev_8.notify(0 s)
+ 4 ns (5): m.consumer_dynamic: ev_5 ev_8 ev_9 ev_12
+ 4 ns (5): m.consumer_static: ev_5 ev_8 ev_9 ev_12
+ 4 ns (5): m.driver: ev_14.notify(1 ns)
+ 4 ns (5): m.driver: ev_2.notify(1 ns)
+ 4 ns (5): m.driver: ev_5.notify(1 ns)
+ 4 ns (5): m.driver: ev_0.notify(1 ns)
+ 5 ns (6): m.consumer_dynamic: ev_0 ev_2 ev_5 ev_14
+ 5 ns (6): m.consumer_static: ev_0 ev_2 ev_5 ev_14
+ 5 ns (6): m.driver: ev_11.notify(1 ns)
+ 5 ns (6): m.driver: ev_14.notify(1 ns)
+ 5 ns (6): m.driver: ev_12.notify(1 ns)
+ 5 ns (6): m.driver: ev_5.notify(1 ns)
+ 6 ns (7): m.consumer_static: ev_5 ev_11 ev_12 ev_14
+ 6 ns (7): m.consumer_dynamic: ev_5 ev_11 ev_12 ev_14
+ 6 ns (7): m.driver: ev_0.notify(1 ns)
+ 6 ns (7): m.driver: ev_4.notify(1 ns)
+ 6 ns (7): m.driver: ev_8.notify(1 ns)
+ 6 ns (7): m.driver: ev_12.notify(1 ns)
+ 7 ns (8): m.consumer_dynamic: ev_0 ev_4 ev_8 ev_12
+ 7 ns (8): m.driver: ev_12.notify(1 ns)
+ 7 ns (8): m.driver: ev_6.notify(1 ns)
+ 7 ns (8): m.driver: ev_11.notify(1 ns)
+ 7 ns (8): m.driver: ev_13.notify(1 ns)
+ 8 ns (9): m.consumer_dynamic: ev_6 ev_11 ev_12 ev_13
+ 8 ns (9): m.consumer_static: ev_6 ev_11 ev_12 ev_13
+
+Info: /OSCI/SystemC: Simulation stopped by user.