summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/tests/systemc/kernel')
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_barrier/test01/golden/test01.log5
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_barrier/test01/sc_barrier.h88
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_barrier/test01/test01.cpp47
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/golden/sc_join.log0
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/golden/test01.log10
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/test01.cpp84
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test02/golden/test02.log10
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test02/test02.cpp85
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test03/golden/test03.log86
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test03/test03.cpp96
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test04/golden/test04.log11
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test04/test04.cpp92
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test05/golden/test05.log10
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test05/test05.cpp83
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_spawn_options/test01/golden/test01.log26
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/sc_spawn_options/test01/test01.cpp139
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test01/golden/test01.log47
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test01/test01.cpp169
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test02/golden/test02.log25
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test02/test02.cpp161
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test03/golden/test03.log8
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test03/test03.cpp89
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test04/golden/test04.log8
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test04/test04.cpp128
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test05/golden/test05.log5
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test05/test05.cpp65
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test06/golden/test06.log9
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test06/test06.cpp78
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test07/golden/test07.log100
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test07/test07.cpp102
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test08/golden/test08.log7
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test08/test08.cpp103
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test09/golden/test09.log102
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test09/test09.cpp205
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test10/golden/test10.log15
-rw-r--r--src/systemc/tests/systemc/kernel/dynamic_processes/test10/test10.cpp175
-rw-r--r--src/systemc/tests/systemc/kernel/kind_string/test01/foo.cpp51
-rw-r--r--src/systemc/tests/systemc/kernel/kind_string/test01/golden/test01.log26
-rw-r--r--src/systemc/tests/systemc/kernel/kind_string/test01/main.cpp110
-rw-r--r--src/systemc/tests/systemc/kernel/kind_string/test01/test01.f2
-rw-r--r--src/systemc/tests/systemc/kernel/module_method_after_sc_start/golden/module_method_after_sc_start.log5
-rw-r--r--src/systemc/tests/systemc/kernel/module_method_after_sc_start/module_method_after_sc_start.cpp40
-rw-r--r--src/systemc/tests/systemc/kernel/module_thread_after_sc_start/golden/module_thread_after_sc_start.log5
-rw-r--r--src/systemc/tests/systemc/kernel/module_thread_after_sc_start/module_thread_after_sc_start.cpp40
-rw-r--r--src/systemc/tests/systemc/kernel/phase_callbacks/test01/golden/test01.log7
-rw-r--r--src/systemc/tests/systemc/kernel/phase_callbacks/test01/test01.cpp57
-rw-r--r--src/systemc/tests/systemc/kernel/phase_callbacks/test02/golden/test02.log7
-rw-r--r--src/systemc/tests/systemc/kernel/phase_callbacks/test02/test02.cpp57
-rw-r--r--src/systemc/tests/systemc/kernel/phase_callbacks/test03/golden/test03.log22
-rw-r--r--src/systemc/tests/systemc/kernel/phase_callbacks/test03/test03.cpp148
-rw-r--r--src/systemc/tests/systemc/kernel/phase_callbacks/test04/golden/register_phase_callbacks.log80
-rw-r--r--src/systemc/tests/systemc/kernel/phase_callbacks/test04/register_phase_callbacks.cpp221
-rw-r--r--src/systemc/tests/systemc/kernel/phase_callbacks/test05/golden/simulation_callbacks.log109
-rw-r--r--src/systemc/tests/systemc/kernel/phase_callbacks/test05/simulation_callbacks.cpp242
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/disable_enable/test1/golden/test1.log29
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/disable_enable/test1/test1.cpp201
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/disable_enable/test2/golden/test2.log84
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/disable_enable/test2/test2.cpp222
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/reset/method_reset_throw/golden/sc_method_reset_throw.log7
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/reset/method_reset_throw/sc_method_reset_throw.cpp100
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/reset/method_self_reset/golden/method_self_reset.log14
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/reset/method_self_reset/method_self_reset.cpp82
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/suspend_resume/test1/golden/test1.log30
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/suspend_resume/test1/test1.cpp216
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/suspend_resume/test2/golden/test2.log90
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/suspend_resume/test2/test2.cpp237
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test01/golden/test01.log76
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test01/test01.cpp260
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test02/golden/test02.log24
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test02/test02.cpp237
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test03/golden/test03.log73
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test03/test03.cpp385
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test04/golden/test04.log20
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test04/test04.cpp137
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test05/golden/test05.log10
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test05/test05.cpp112
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test06/golden/test06.log21
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test06/test06.cpp130
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test07/golden/test07.log90
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test07/test07.cpp204
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test08/golden/test08.log16
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/test08/test08.cpp127
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/throw_it/test1/golden/test1.log5
-rw-r--r--src/systemc/tests/systemc/kernel/process_control/throw_it/test1/test1.cpp57
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test01/golden/test01.log8
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test01/test01.cpp106
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test02/golden/test02.log10
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test02/test02.cpp84
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test03/golden/test03.log9
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test03/test03.cpp80
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test04/golden/test04.log10
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test04/test04.cpp84
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test05/golden/test05.log63
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test05/test05.cpp220
-rw-r--r--src/systemc/tests/systemc/kernel/sc_attribute/test01/golden/test01.log5
-rw-r--r--src/systemc/tests/systemc/kernel/sc_attribute/test01/test01.cpp74
-rw-r--r--src/systemc/tests/systemc/kernel/sc_attribute/test02/golden/test02.log21
-rw-r--r--src/systemc/tests/systemc/kernel/sc_attribute/test02/test02.cpp114
-rw-r--r--src/systemc/tests/systemc/kernel/sc_elab_and_sim/golden/sc_elab_and_sim.log2
-rw-r--r--src/systemc/tests/systemc/kernel/sc_elab_and_sim/sc_elab_and_sim.cpp30
-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
-rw-r--r--src/systemc/tests/systemc/kernel/sc_lambda/test01/golden/test01.log12
-rw-r--r--src/systemc/tests/systemc/kernel/sc_lambda/test01/test01.cpp86
-rw-r--r--src/systemc/tests/systemc/kernel/sc_macros/test01/golden/test01.log59
-rw-r--r--src/systemc/tests/systemc/kernel/sc_macros/test01/test01.cpp239
-rw-r--r--src/systemc/tests/systemc/kernel/sc_main_main/golden/sc_main_main.log2
-rw-r--r--src/systemc/tests/systemc/kernel/sc_main_main/sc_main_main.cpp42
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test01/golden/test01.log1
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test01/test01.cpp179
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test02/golden/test02.log11
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test02/test02.cpp179
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test03/golden/test03.log1
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test03/test03.cpp179
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test04/golden/test04.log18
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test04/test04.cpp105
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test05/golden/test05.log34
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test05/test05.cpp143
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test06/golden/test06.log5
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test06/test06.cpp60
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test07/golden/test07.log7
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test07/test07.cpp55
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test08/golden/test08.log4
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test08/test08.cpp53
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test09/golden/test09.log124
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test09/test09.cpp106
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test10/golden/test10.log6
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test10/test10.cpp72
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module_name/test01/golden/test01.log3
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module_name/test01/test01.cpp72
-rw-r--r--src/systemc/tests/systemc/kernel/sc_name_gen/test1/golden/test1.log20
-rw-r--r--src/systemc/tests/systemc/kernel/sc_name_gen/test1/test1.cpp80
-rw-r--r--src/systemc/tests/systemc/kernel/sc_object/test01/golden/test01.log20
-rw-r--r--src/systemc/tests/systemc/kernel/sc_object/test01/test01.cpp90
-rw-r--r--src/systemc/tests/systemc/kernel/sc_object/test02/golden/test02.log5
-rw-r--r--src/systemc/tests/systemc/kernel/sc_object/test02/test02.cpp71
-rw-r--r--src/systemc/tests/systemc/kernel/sc_object_manager/test01/golden/test01.log18
-rw-r--r--src/systemc/tests/systemc/kernel/sc_object_manager/test01/test01.cpp104
-rw-r--r--src/systemc/tests/systemc/kernel/sc_object_manager/test02/golden/test02.log2
-rw-r--r--src/systemc/tests/systemc/kernel/sc_object_manager/test02/test02.cpp93
-rw-r--r--src/systemc/tests/systemc/kernel/sc_process_b/test01/golden/test01.log2
-rw-r--r--src/systemc/tests/systemc/kernel/sc_process_b/test01/test01.cpp65
-rw-r--r--src/systemc/tests/systemc/kernel/sc_process_b/test02/golden/test02.log11
-rw-r--r--src/systemc/tests/systemc/kernel/sc_process_b/test02/test02.cpp31
-rw-r--r--src/systemc/tests/systemc/kernel/sc_process_b/test03/golden/test03.log13
-rw-r--r--src/systemc/tests/systemc/kernel/sc_process_b/test03/test03.cpp80
-rw-r--r--src/systemc/tests/systemc/kernel/sc_process_handle/test01/golden/test01.log2
-rw-r--r--src/systemc/tests/systemc/kernel/sc_process_handle/test01/test01.cpp205
-rw-r--r--src/systemc/tests/systemc/kernel/sc_process_handle/test02/golden/test02.log2
-rw-r--r--src/systemc/tests/systemc/kernel/sc_process_handle/test02/test02.cpp92
-rw-r--r--src/systemc/tests/systemc/kernel/sc_sensitive/test01/golden/test01.log19
-rw-r--r--src/systemc/tests/systemc/kernel/sc_sensitive/test01/test01.cpp122
-rw-r--r--src/systemc/tests/systemc/kernel/sc_sensitive/test02/golden/test02.log31
-rw-r--r--src/systemc/tests/systemc/kernel/sc_sensitive/test02/test02.cpp128
-rw-r--r--src/systemc/tests/systemc/kernel/sc_sensitive/test03/golden/test03.log33
-rw-r--r--src/systemc/tests/systemc/kernel/sc_sensitive/test03/test03.cpp128
-rw-r--r--src/systemc/tests/systemc/kernel/sc_sensitive/test04/golden/test04.log5
-rw-r--r--src/systemc/tests/systemc/kernel/sc_sensitive/test04/test04.cpp31
-rw-r--r--src/systemc/tests/systemc/kernel/sc_sensitive/test05/golden/test05.log7
-rw-r--r--src/systemc/tests/systemc/kernel/sc_sensitive/test05/test05.cpp37
-rw-r--r--src/systemc/tests/systemc/kernel/sc_simcontext/sc_delta_count/golden/sc_delta_count.log6
-rw-r--r--src/systemc/tests/systemc/kernel/sc_simcontext/sc_delta_count/sc_delta_count.cpp33
-rw-r--r--src/systemc/tests/systemc/kernel/sc_simcontext/test01/golden/test01.log4
-rw-r--r--src/systemc/tests/systemc/kernel/sc_simcontext/test01/test01.cpp89
-rw-r--r--src/systemc/tests/systemc/kernel/sc_simcontext/test02/golden/test02.log24
-rw-r--r--src/systemc/tests/systemc/kernel/sc_simcontext/test02/test02.cpp139
-rw-r--r--src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test1/golden/test1.log50
-rw-r--r--src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test1/test1.cpp117
-rw-r--r--src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test2/golden/test2.log16
-rw-r--r--src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test2/test2.cpp112
-rw-r--r--src/systemc/tests/systemc/kernel/sc_start/time_overflow/golden/time_overflow.log11
-rw-r--r--src/systemc/tests/systemc/kernel/sc_start/time_overflow/time_overflow.cpp51
-rw-r--r--src/systemc/tests/systemc/kernel/sc_stop/test01/golden/test01.log7
-rw-r--r--src/systemc/tests/systemc/kernel/sc_stop/test01/test01.cpp94
-rw-r--r--src/systemc/tests/systemc/kernel/sc_stop/test02/golden/test02.log13
-rw-r--r--src/systemc/tests/systemc/kernel/sc_stop/test02/test02.cpp93
-rw-r--r--src/systemc/tests/systemc/kernel/sc_stop/test03/golden/test03.log7
-rw-r--r--src/systemc/tests/systemc/kernel/sc_stop/test03/test03.cpp75
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test01/golden/test01.log115
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test01/golden/test01.log.mingw115
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test01/golden/test01.log.mingw64115
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test01/test01.cpp315
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test02/golden/test02.log4
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test02/test02.cpp48
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test03/golden/test03.log4
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test03/test03.cpp48
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test04/golden/test04.log5
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test04/test04.cpp77
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test05/golden/test05.log5
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test05/test05.cpp76
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test06/golden/test06.log5
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test06/test06.cpp85
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test07/golden/test07.log4
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test07/test07.cpp49
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test08/golden/test08.log4
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test08/test08.cpp50
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test09/golden/test09.log4
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test09/test09.cpp48
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test10/golden/test10.log13
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test10/test10.cpp50
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test11/golden/test11.log16
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test11/test11.cpp50
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test12/golden/test12.log14
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test12/test12.cpp48
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test13/golden/test13.log14
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test13/test13.cpp48
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test14/golden/test14.log15
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test14/test14.cpp77
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test15/golden/test15.log14
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test15/test15.cpp49
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test16/golden/test16.log14
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test16/test16.cpp48
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test17/golden/test17.log14
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test17/test17.cpp49
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test18/golden/test18.log8
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test18/test18.cpp88
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test19/golden/test19.log83
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test19/test19.cpp93
-rw-r--r--src/systemc/tests/systemc/kernel/sc_ver/test01/golden/test01.log3
-rw-r--r--src/systemc/tests/systemc/kernel/sc_ver/test01/main.cpp38
-rw-r--r--src/systemc/tests/systemc/kernel/sc_ver/test01/test-unchecked.cpp33
-rw-r--r--src/systemc/tests/systemc/kernel/sc_ver/test01/test01.f2
250 files changed, 17719 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_barrier/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_barrier/test01/golden/test01.log
new file mode 100644
index 000000000..145f99c5e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_barrier/test01/golden/test01.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+11 ns - c
+11 ns - b
+11 ns - a
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_barrier/test01/sc_barrier.h b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_barrier/test01/sc_barrier.h
new file mode 100644
index 000000000..c2773e97e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_barrier/test01/sc_barrier.h
@@ -0,0 +1,88 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ sc_barrier.h -- Barrier Process Synchronization Definition
+
+ Original Author: Andy Goodrich, Forte Design Systems, 5 May 2003
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: sc_barrier.h,v $
+// Revision 1.1.1.1 2006/12/15 20:26:03 acg
+// systemc_tests-2.3
+//
+// Revision 1.2 2006/01/24 21:04:52 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+
+#ifndef SC_BARRIER_H
+#define SC_BARRIER_H
+
+namespace sc_dp {
+
+// -----------------------------------------------------------------------------
+// CLASS sc_barrier
+//
+// This class provides a way of synchronising a set of processes. Each process
+// calls the wait() method and one all processes have called that method they
+// will all be released for execution.
+// -----------------------------------------------------------------------------
+
+class sc_barrier {
+ public:
+ void initialize( int thread_n )
+ {
+ m_thread_n = thread_n;
+ }
+
+ void wait()
+ {
+ m_thread_n--;
+ if ( m_thread_n )
+ {
+ ::sc_core::wait(m_barrier_event);
+ }
+ else
+ {
+ m_barrier_event.notify(SC_ZERO_TIME);
+ ::sc_core::wait(m_barrier_event);
+ }
+ }
+
+ protected:
+ sc_event m_barrier_event; // Event to wait on.
+ int m_thread_n; // # of threads left to wait.
+};
+
+} // namespace sc_dp
+
+#endif // SC_BARRIER_H
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_barrier/test01/test01.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_barrier/test01/test01.cpp
new file mode 100644
index 000000000..5b8c8a8fe
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_barrier/test01/test01.cpp
@@ -0,0 +1,47 @@
+#include "systemc.h"
+#include "sc_barrier.h"
+using sc_dp::sc_barrier;
+
+SC_MODULE(X)
+{
+ SC_CTOR(X)
+ {
+ sc_thread_handle last_thread;
+
+ SC_THREAD(a);
+ SC_THREAD(b);
+ SC_THREAD(c);
+
+ m_barrier.initialize(3);
+ }
+ void a()
+ {
+ wait(5.0, SC_NS);
+ m_barrier.wait();
+ cout << sc_time_stamp() << " - a" << endl;
+ }
+ void b()
+ {
+ wait(11.0, SC_NS);
+ m_barrier.wait();
+ cout << sc_time_stamp() << " - b" << endl;
+ }
+ void c()
+ {
+ m_barrier.wait();
+ cout << sc_time_stamp() << " - c" << endl;
+ }
+ sc_barrier m_barrier;
+};
+
+int sc_main( int argc, char* argv[] )
+{
+ sc_clock clock;
+ X x("x");
+
+ sc_start(1000, SC_NS);
+
+ cerr << "Program completed" << endl;
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/golden/sc_join.log b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/golden/sc_join.log
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/golden/sc_join.log
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/golden/test01.log
new file mode 100644
index 000000000..a7237caa7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/golden/test01.log
@@ -0,0 +1,10 @@
+SystemC Simulation
+2 ns: sync(3) terminating
+3 ns: sync(4) terminating
+4 ns: sync(5) terminating
+4 ns: sync(5) terminating
+6 ns: sync(7) terminating
+10 ns: sync(11) terminating
+20 ns: sync(21) terminating
+20 ns: waiting waking
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/test01.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/test01.cpp
new file mode 100644
index 000000000..f82344bb4
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/test01.cpp
@@ -0,0 +1,84 @@
+/*****************************************************************************
+
+ 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 -- Test using sc_join as barrier mechanism.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 10 October 2004
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+#include "sysc/kernel/sc_dynamic_processes.h"
+
+SC_MODULE(X)
+{
+ SC_CTOR(X)
+ {
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 3 ) ) );
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 4 ) ) );
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 5 ) ) );
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 5 ) ) );
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 7 ) ) );
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 11 ) ) );
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 21 ) ) );
+
+ SC_THREAD(waiting);
+ }
+ void sync(int context)
+ {
+ for ( int i = 0; i < context; i++ )
+ {
+ wait(m_clk.posedge_event());
+ }
+ cout << sc_time_stamp() << ": sync(" << context << ") terminating" << endl;
+ }
+ void waiting()
+ {
+ m_join.wait();
+ cout << sc_time_stamp() << ": waiting waking" << endl;
+ }
+
+ sc_in_clk m_clk;
+ sc_join m_join;
+};
+
+int sc_main( int argc, char* argv[] )
+{
+ sc_clock clock;
+ X x("x");
+ x.m_clk(clock);
+
+ sc_start(1000, SC_NS);
+
+ cerr << "Program completed" << endl;
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test02/golden/test02.log
new file mode 100644
index 000000000..a7237caa7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test02/golden/test02.log
@@ -0,0 +1,10 @@
+SystemC Simulation
+2 ns: sync(3) terminating
+3 ns: sync(4) terminating
+4 ns: sync(5) terminating
+4 ns: sync(5) terminating
+6 ns: sync(7) terminating
+10 ns: sync(11) terminating
+20 ns: sync(21) terminating
+20 ns: waiting waking
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test02/test02.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test02/test02.cpp
new file mode 100644
index 000000000..8eba90a5e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test02/test02.cpp
@@ -0,0 +1,85 @@
+/*****************************************************************************
+
+ 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 -- Test SC_FORK and SC_JOIN macros.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 10 October 2004
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+#include "sysc/kernel/sc_dynamic_processes.h"
+
+SC_MODULE(X)
+{
+ SC_CTOR(X)
+ {
+
+ SC_THREAD(waiting);
+ }
+ void sync(int context)
+ {
+ for ( int i = 0; i < context; i++ )
+ {
+ wait(m_clk.posedge_event());
+ }
+ cout << sc_time_stamp() << ": sync(" << context << ") terminating"<< endl;
+ }
+ void waiting()
+ {
+ SC_FORK
+ sc_spawn( sc_bind( &X::sync, this, 3 ) ),
+ sc_spawn( sc_bind( &X::sync, this, 4 ) ),
+ sc_spawn( sc_bind( &X::sync, this, 5 ) ),
+ sc_spawn( sc_bind( &X::sync, this, 5 ) ),
+ sc_spawn( sc_bind( &X::sync, this, 7 ) ),
+ sc_spawn( sc_bind( &X::sync, this, 11) ),
+ sc_spawn( sc_bind( &X::sync, this, 21) )
+ SC_JOIN
+ cout << sc_time_stamp() << ": waiting waking" << endl;
+ }
+
+ sc_in_clk m_clk;
+ sc_join m_join;
+};
+
+int sc_main( int argc, char* argv[] )
+{
+ sc_clock clock;
+ X x("x");
+ x.m_clk(clock);
+
+ sc_start(1000, SC_NS);
+
+ cerr << "Program completed" << endl;
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test03/golden/test03.log b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test03/golden/test03.log
new file mode 100644
index 000000000..68285dfd4
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test03/golden/test03.log
@@ -0,0 +1,86 @@
+SystemC Simulation
+Time Spawn Start Stop
+----- ----- ----- ----
+0 s 0
+0 s 0
+1 ns 1
+1 ns 1
+3 ns 2
+3 ns 2
+5 ns 0
+5 ns 3
+5 ns 3
+7 ns 1
+7 ns 4
+7 ns 4
+9 ns 2
+9 ns 5
+9 ns 5
+11 ns 3
+11 ns 6
+11 ns 6
+13 ns 4
+13 ns 7
+13 ns 7
+15 ns 5
+15 ns waiting for termination of 2 processes
+17 ns 6
+19 ns 7
+19 ns back from termination wait
+Time Spawn Start Stop
+----- ----- ----- ----
+19 ns 8
+19 ns 8
+21 ns 9
+21 ns 9
+23 ns 10
+23 ns 10
+25 ns 8
+25 ns 11
+25 ns 11
+27 ns 9
+27 ns 12
+27 ns 12
+29 ns 10
+29 ns 13
+29 ns 13
+31 ns 11
+31 ns 14
+31 ns 14
+33 ns 12
+33 ns 15
+33 ns 15
+35 ns 13
+35 ns waiting for termination of 2 processes
+37 ns 14
+39 ns 15
+39 ns back from termination wait
+Time Spawn Start Stop
+----- ----- ----- ----
+39 ns 16
+39 ns 16
+41 ns 17
+41 ns 17
+43 ns 18
+43 ns 18
+45 ns 16
+45 ns 19
+45 ns 19
+47 ns 17
+47 ns 20
+47 ns 20
+49 ns 18
+49 ns 21
+49 ns 21
+51 ns 19
+51 ns 22
+51 ns 22
+53 ns 20
+53 ns 23
+53 ns 23
+55 ns 21
+55 ns waiting for termination of 2 processes
+57 ns 22
+59 ns 23
+59 ns back from termination wait
+Program completed.
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test03/test03.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test03/test03.cpp
new file mode 100644
index 000000000..d783150e3
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test03/test03.cpp
@@ -0,0 +1,96 @@
+/*****************************************************************************
+
+ 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 -- Test sc_join as gating mechanism for a process awaiting the
+ demise of its child processes.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 18 April 2005
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ 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.h"
+
+SC_MODULE(TB)
+{
+ SC_CTOR(TB)
+ {
+ SC_THREAD(abc);
+ sensitive << m_clk.pos();
+ }
+ void abc()
+ {
+ for ( int i = 0; i < 3; i++ )
+ {
+ cout << "Time Spawn Start Stop " << endl;
+ cout << "----- ----- ----- ----" << endl;
+ int ii = 2;
+ int spawn_i;
+ int spawn_n = 8;
+ sc_spawn_options options;
+ sc_join join;
+ options.set_sensitivity(&m_clk.pos());
+ for ( spawn_i = 0; spawn_i < spawn_n; spawn_i++ )
+ {
+ int process_i = spawn_i + i * spawn_n;
+ cout << sc_time_stamp() << " " << process_i << endl;
+ join.add_process(sc_spawn(
+ sc_bind(&TB::process, this, sc_ref(process_i)),
+ sc_gen_unique_name("pipe"), &options ) );
+ sc_core::wait(ii);
+ }
+ cout << sc_time_stamp() << " waiting for termination of "
+ << join.process_count() << " processes" << endl;
+ join.wait();
+ cout << sc_time_stamp() << " back from termination wait " << endl;
+ }
+ }
+ void process( int& instance )
+ {
+ int i = instance;
+ cout << sc_time_stamp() << " " << i << endl;
+ wait(6);
+ cout << sc_time_stamp() << " " << i << endl;
+ }
+ sc_in<bool> m_clk;
+};
+
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ TB tb("tb");
+
+ tb.m_clk(clock);
+ sc_start(100, SC_NS);
+ cout << "Program completed." << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test04/golden/test04.log b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test04/golden/test04.log
new file mode 100644
index 000000000..0d1660025
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test04/golden/test04.log
@@ -0,0 +1,11 @@
+SystemC Simulation
+2 ns: sync(3) terminating
+3 ns: sync(4) terminating
+4 ns: sync(5) terminating
+4 ns: sync(5) terminating
+6 ns: sync(7) terminating
+10 ns: sync(11) terminating
+20 ns: sync(21) terminating
+20 ns: asynchronous wait waking
+21 ns: clocked wait waking
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test04/test04.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test04/test04.cpp
new file mode 100644
index 000000000..e9aa9efd0
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test04/test04.cpp
@@ -0,0 +1,92 @@
+/*****************************************************************************
+
+ 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 -- Test using sc_join as barrier mechanism with clocked and
+ asynchronous thread waits.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 10 October 2004
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+#include "sysc/kernel/sc_dynamic_processes.h"
+
+SC_MODULE(X)
+{
+ SC_CTOR(X)
+ {
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 3 ) ) );
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 4 ) ) );
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 5 ) ) );
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 5 ) ) );
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 7 ) ) );
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 11 ) ) );
+ m_join.add_process( sc_spawn( sc_bind(&X::sync, this, 21 ) ) );
+
+ SC_CTHREAD(cwaiting,m_clk.pos());
+ SC_THREAD(waiting);
+ }
+ void cwaiting()
+ {
+ m_join.wait_clocked();
+ cout << sc_time_stamp() << ": clocked wait waking" << endl;
+ }
+
+ void sync(int context)
+ {
+ for ( int i = 0; i < context; i++ )
+ {
+ wait(m_clk.posedge_event());
+ }
+ cout << sc_time_stamp() << ": sync(" << context << ") terminating" << endl;
+ }
+ void waiting()
+ {
+ m_join.wait();
+ cout << sc_time_stamp() << ": asynchronous wait waking" << endl;
+ }
+
+ sc_in_clk m_clk;
+ sc_join m_join;
+};
+
+int sc_main( int argc, char* argv[] )
+{
+ sc_clock clock;
+ X x("x");
+ x.m_clk(clock);
+
+ sc_start(1000, SC_NS);
+
+ cerr << "Program completed" << endl;
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test05/golden/test05.log b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test05/golden/test05.log
new file mode 100644
index 000000000..13684b960
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test05/golden/test05.log
@@ -0,0 +1,10 @@
+SystemC Simulation
+3 ns: sync(3) terminating
+4 ns: sync(4) terminating
+5 ns: sync(5) terminating
+5 ns: sync(5) terminating
+7 ns: sync(7) terminating
+11 ns: sync(11) terminating
+21 ns: sync(21) terminating
+22 ns: clocked wait waking
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test05/test05.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test05/test05.cpp
new file mode 100644
index 000000000..9a7f0242d
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test05/test05.cpp
@@ -0,0 +1,83 @@
+/*****************************************************************************
+
+ 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 -- Test using SC_FORK and SC_CJOIN macros.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 29 April 2004
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+#include "sysc/kernel/sc_dynamic_processes.h"
+
+SC_MODULE(X)
+{
+ SC_CTOR(X)
+ {
+ SC_CTHREAD(cwaiting,m_clk.pos());
+ }
+ void cwaiting()
+ {
+ SC_FORK
+ sc_spawn( sc_bind(&X::sync, this, 3 ) ) ,
+ sc_spawn( sc_bind(&X::sync, this, 4 ) ) ,
+ sc_spawn( sc_bind(&X::sync, this, 5 ) ) ,
+ sc_spawn( sc_bind(&X::sync, this, 5 ) ) ,
+ sc_spawn( sc_bind(&X::sync, this, 7 ) ) ,
+ sc_spawn( sc_bind(&X::sync, this, 11 ) ) ,
+ sc_spawn( sc_bind(&X::sync, this, 21 ) )
+ SC_CJOIN
+ cout << sc_time_stamp() << ": clocked wait waking" << endl;
+ }
+
+ void sync(int context)
+ {
+ for ( int i = 0; i < context; i++ )
+ {
+ wait(m_clk.posedge_event());
+ }
+ cout << sc_time_stamp() << ": sync(" << context << ") terminating" << endl;
+ }
+ sc_in_clk m_clk;
+};
+
+int sc_main( int argc, char* argv[] )
+{
+ sc_clock clock;
+ X x("x");
+ x.m_clk(clock);
+
+ sc_start(1000, SC_NS);
+
+ cerr << "Program completed" << endl;
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_spawn_options/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_spawn_options/test01/golden/test01.log
new file mode 100644
index 000000000..1df950f86
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_spawn_options/test01/golden/test01.log
@@ -0,0 +1,26 @@
+SystemC Simulation
+
+Round robin method 1 at time 100 ns
+Round robin method 2 at time 110 ns
+Round robin method 3 at time 120 ns
+Round robin method 4 at time 130 ns
+Round robin method 1 at time 140 ns
+Round robin method 2 at time 150 ns
+Round robin method 3 at time 160 ns
+Round robin method 4 at time 170 ns
+Round robin method 1 at time 180 ns
+Round robin method 2 at time 190 ns
+Round robin method 3 at time 200 ns
+Round robin method 4 at time 210 ns
+Round robin method 1 at time 220 ns
+Round robin method 2 at time 230 ns
+Round robin method 3 at time 240 ns
+Round robin method 4 at time 250 ns
+Round robin method 1 at time 260 ns
+Round robin method 2 at time 270 ns
+Round robin method 3 at time 280 ns
+Round robin method 4 at time 290 ns
+
+Done.
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_spawn_options/test01/test01.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_spawn_options/test01/test01.cpp
new file mode 100644
index 000000000..67d18e210
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_spawn_options/test01/test01.cpp
@@ -0,0 +1,139 @@
+/*****************************************************************************
+
+ 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 -- Demo "new" dynamic method support.
+
+
+ See the README file for a description of these capabilities. This demo
+ excercises all of the major capabilities.
+
+ Original Author: Stuart Swan, Cadence Design Systems, Inc., 2002-10-22
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date: Andy Goodrich, Forte Design Systems, 30 July 03
+ Description of Modification: Converted thread demo to method demo.
+
+ *****************************************************************************/
+
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include <systemc.h>
+
+
+int test_function(double d)
+{
+ cout << endl << "Test_function sees " << d << endl;
+ return int(d);
+}
+
+void void_function(double d)
+{
+ cout << endl << "void_function sees " << d << endl;
+}
+
+int ref_function(const double& d)
+{
+ cout << endl << "ref_function sees " << d << endl;
+ return int(d);
+}
+
+
+class top : public sc_module
+{
+public:
+ SC_HAS_PROCESS(top);
+
+ top(sc_module_name name) : sc_module(name)
+ {
+ SC_THREAD(main);
+ }
+
+ void main()
+ {
+ sc_event e1, e2, e3, e4;
+ sc_spawn_options options1, options2, options3, options4;
+ int r;
+
+ cout << endl;
+
+ e1.notify(100, SC_NS);
+
+ // Spawn several methods that co-operatively execute in round robin order
+
+ options1.spawn_method();
+ options1.dont_initialize();
+ options1.set_sensitivity(&e1);
+ sc_spawn(&r,
+ sc_bind(&top::round_robin, this, "1", sc_ref(e1), sc_ref(e2), 3),
+ "1", &options1
+ );
+
+ options2.spawn_method();
+ options2.dont_initialize();
+ options2.set_sensitivity(&e2);
+ sc_spawn(&r,
+ sc_bind(&top::round_robin, this, "2", sc_ref(e2), sc_ref(e3), 3),
+ "2", &options2
+ );
+
+ options3.spawn_method();
+ options3.dont_initialize();
+ options3.set_sensitivity(&e3);
+ sc_spawn(&r,
+ sc_bind(&top::round_robin, this, "3", sc_ref(e3), sc_ref(e4), 3),
+ "3", &options3
+ );
+
+ options4.spawn_method();
+ options4.dont_initialize();
+ options4.set_sensitivity(&e4);
+ sc_spawn(&r,
+ sc_bind(&top::round_robin, this, "4", sc_ref(e4), sc_ref(e1), 3),
+ "4", &options4
+ );
+ wait(295, SC_NS);
+ cout << endl << "Done." << endl;
+ sc_stop();
+ }
+
+ int round_robin(const char *str, sc_event& receive, sc_event& send, int cnt)
+ {
+ cout << "Round robin method " << str <<
+ " at time " << sc_time_stamp() << endl;
+ next_trigger(receive);
+ send.notify(10, SC_NS);
+ return 0;
+ }
+};
+
+int sc_main (int argc , char *argv[])
+{
+ top top1("Top1");
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/dynamic_processes/test01/golden/test01.log
new file mode 100644
index 000000000..c585cabd3
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test01/golden/test01.log
@@ -0,0 +1,47 @@
+SystemC Simulation
+
+100 ns: Top1.main.t1: Round robin thread 1
+110 ns: Top1.main.t2: Round robin thread 2
+120 ns: Top1.main.t3: Round robin thread 3
+130 ns: Top1.main.t4: Round robin thread 4
+140 ns: Top1.main.t1: Round robin thread 1
+150 ns: Top1.main.t2: Round robin thread 2
+160 ns: Top1.main.t3: Round robin thread 3
+170 ns: Top1.main.t4: Round robin thread 4
+180 ns: Top1.main.t1: Round robin thread 1
+190 ns: Top1.main.t2: Round robin thread 2
+200 ns: Top1.main.t3: Round robin thread 3
+210 ns: Top1.main.t4: Round robin thread 4
+Returned int is 0
+
+
+221 ns: Top1.main.thread_p_0: Thread 0 ending.
+222 ns: Top1.main.thread_p_1: Thread 1 ending.
+223 ns: Top1.main.thread_p_2: Thread 2 ending.
+224 ns: Top1.main.thread_p_3: Thread 3 ending.
+225 ns: Top1.main.thread_p_4: Thread 4 ending.
+226 ns: Top1.main.thread_p_5: Thread 5 ending.
+227 ns: Top1.main.thread_p_6: Thread 6 ending.
+228 ns: Top1.main.thread_p_7: Thread 7 ending.
+229 ns: Top1.main.thread_p_8: Thread 8 ending.
+230 ns: Top1.main.thread_p_9: Thread 9 ending.
+241 ns: Top1.main.thread_p_10: Thread 0 ending.
+242 ns: Top1.main.thread_p_11: Thread 1 ending.
+243 ns: Top1.main.thread_p_12: Thread 2 ending.
+244 ns: Top1.main.thread_p_13: Thread 3 ending.
+245 ns: Top1.main.thread_p_14: Thread 4 ending.
+246 ns: Top1.main.thread_p_15: Thread 5 ending.
+247 ns: Top1.main.thread_p_16: Thread 6 ending.
+248 ns: Top1.main.thread_p_17: Thread 7 ending.
+249 ns: Top1.main.thread_p_18: Thread 8 ending.
+250 ns: Top1.main.thread_p_19: Thread 9 ending.
+
+260 ns: Top1.main.thread_p_20: Test_function sees 3.14159
+Returned int is 3
+
+260 ns: Top1.main.void_function: void_function sees 1.2345
+
+260 ns: Top1.main.thread_p_21: ref_function sees 9.8765
+Returned int is 9
+
+Done.
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test01/test01.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/test01/test01.cpp
new file mode 100644
index 000000000..098057691
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test01/test01.cpp
@@ -0,0 +1,169 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ Original Author: Stuart Swan, Cadence Design Systems, Inc., 2002-10-22
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+// $Log: test01.cpp,v $
+// Revision 1.3 2011/02/08 06:49:37 acg
+// Andy Goodrich: removed carriage returns.
+//
+// Revision 1.2 2011/02/01 17:17:37 acg
+// Andy Goodrich: update of copyright notice, added visible CVS logging.
+//
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include <systemc.h>
+
+
+int test_function(double d)
+{
+ cout << endl << sc_time_stamp() << ": " << sc_get_current_process_handle().name()
+ << ": Test_function sees " << d << endl;
+ return int(d);
+}
+
+void void_function(double d)
+{
+ cout << endl << sc_time_stamp() << ": " << sc_get_current_process_handle().name()
+ << ": void_function sees " << d << endl;
+}
+
+int ref_function(const double& d)
+{
+ cout << endl << sc_time_stamp() << ": " << sc_get_current_process_handle().name()
+ << ": ref_function sees " << d << endl;
+ return int(d);
+}
+
+
+class top : public sc_module
+{
+public:
+ SC_HAS_PROCESS(top);
+
+ top(sc_module_name name) : sc_module(name)
+ {
+ SC_THREAD(main);
+ }
+
+ void main()
+ {
+ int r;
+ sc_event e1, e2, e3, e4;
+
+ cout << endl;
+
+ e1.notify(100, SC_NS);
+
+ // Spawn several threads that co-operatively execute in round robin order
+
+ SC_FORK
+ sc_spawn(&r,
+ sc_bind(&top::round_robin, this, "1", sc_ref(e1), sc_ref(e2), 3), "t1") ,
+ sc_spawn(&r,
+ sc_bind(&top::round_robin, this, "2", sc_ref(e2), sc_ref(e3), 3), "t2") ,
+ sc_spawn(&r,
+ sc_bind(&top::round_robin, this, "3", sc_ref(e3), sc_ref(e4), 3), "t3") ,
+ sc_spawn(&r,
+ sc_bind(&top::round_robin, this, "4", sc_ref(e4), sc_ref(e1), 3), "t4") ,
+ SC_JOIN
+
+ cout << "Returned int is " << r << endl;
+ cout << endl << endl;
+
+ // Test that threads in thread pool are successfully reused ...
+
+ for (int i = 0 ; i < 10; i++)
+ sc_spawn(&r, sc_bind(&top::wait_and_end, this, i));
+
+ wait(20, SC_NS);
+
+ // Test thread reuse
+
+ for (int i = 0 ; i < 10; i++)
+ sc_spawn(&r, sc_bind(&top::wait_and_end, this, i));
+
+ wait(20, SC_NS);
+
+ // Demo of a function rather than method call, & use return value ...
+
+ wait( sc_spawn(&r, sc_bind(&test_function, 3.14159)).terminated_event() );
+
+ cout << "Returned int is " << r << endl;
+
+ // demo sc_spawn_options usage
+
+ sc_spawn_options ops;
+ ops.set_stack_size(0);
+ sc_process_handle handle1 = sc_spawn(
+ sc_bind(&void_function, 1.2345), "void_function", &ops
+ );
+ wait(handle1.terminated_event());
+
+ double d = 9.8765;
+ wait( sc_spawn(&r, sc_bind(&ref_function, sc_cref(d))).terminated_event() );
+
+ cout << "Returned int is " << r << endl;
+
+ cout << endl << "Done." << endl;
+ }
+
+ int round_robin(const char *str, sc_event& receive, sc_event& send, int cnt)
+ {
+ while (--cnt >= 0)
+ {
+ wait(receive);
+ cout << sc_time_stamp() << ": " << sc_get_current_process_handle().name()
+ << ": Round robin thread " << str << endl;
+ wait(10, SC_NS);
+ send.notify();
+ }
+
+ return 0;
+ }
+
+ int wait_and_end(int i)
+ {
+ wait( i + 1, SC_NS);
+ cout << sc_time_stamp() << ": " << sc_get_current_process_handle().name()
+ << ": Thread " << i << " ending." << endl;
+ return 0;
+ }
+};
+
+int sc_main (int argc , char *argv[])
+{
+ top top1("Top1");
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/dynamic_processes/test02/golden/test02.log
new file mode 100644
index 000000000..8264ba823
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test02/golden/test02.log
@@ -0,0 +1,25 @@
+SystemC Simulation
+
+0 s: CTOR, Before spawning function_method
+
+0 s, mod1.main: main thread, Before spawning round robin methods
+
+
+0 s, mod1.main: main thread, Issuing wait(60, SC_NS)
+0 s, mod1.main.method1: In Round robin method 1. Issued next_trigger.
+0 s, mod1.main.method2: In Round robin method 2. Issued next_trigger.
+0 s, mod1.main.method3: In Round robin method 3. Issued next_trigger.
+0 s, mod1.main.method4: In Round robin method 4. Issued next_trigger.
+15 ns, mod1.main.method1: In Round robin method 1. Notified. Ending Round robin method 1
+25 ns, mod1.main.method2: In Round robin method 2. Notified. Ending Round robin method 2
+35 ns, mod1.main.method3: In Round robin method 3. Notified. Ending Round robin method 3
+45 ns, mod1.main.method4: In Round robin method 4. Notified. Ending Round robin method 4
+
+55 ns, mod1.event_sensitive_method: function_method sees 1.2345
+
+60 ns, mod1.main: Done main thread.
+
+100 ns: sc_main, Before spawning function_thread
+
+100 ns, thread_p_0: function_thread sees 6.789
+110 ns, thread_p_0: ending thread
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test02/test02.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/test02/test02.cpp
new file mode 100644
index 000000000..44af1bbf2
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test02/test02.cpp
@@ -0,0 +1,161 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ Original Author: Bishnupriya Bhattacharya, Cadence Design Systems,
+ September 5, 2003
+
+ *****************************************************************************/
+
+// test dynamic method processes and hierarchical dynamic process naming
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+// $Log: test02.cpp,v $
+// Revision 1.3 2011/03/06 06:55:19 acg
+// Andy Goodrich: removed carriage returns.
+//
+// Revision 1.2 2011/02/01 17:17:40 acg
+// Andy Goodrich: update of copyright notice, added visible CVS logging.
+//
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include <systemc.h>
+
+int function_method(double d)
+{
+ cout << endl << sc_time_stamp() << ", "
+ << sc_get_current_process_handle().name()
+ << ": function_method sees " << d << endl;
+ return int(d);
+}
+
+void function_thread(double d)
+{
+ cout << endl << sc_time_stamp() << ", "
+ << sc_get_current_process_handle().name()
+ << ": function_thread sees " << d << endl;
+ sc_core::wait(10, SC_NS);
+ cout << sc_time_stamp() << ", "
+ << sc_get_current_process_handle().name()
+ << ": ending thread" << endl;
+}
+
+class module1 : public sc_module
+{
+private:
+ sc_event& ev;
+ int method_count;
+ int r;
+public:
+
+ SC_HAS_PROCESS(module1);
+
+ module1(sc_module_name name, sc_event& event) : sc_module(name),
+ ev(event), method_count(0), r(0)
+ {
+ SC_THREAD(main);
+ cout << endl << sc_time_stamp() << ": CTOR, Before spawning function_method " << endl;
+ sc_spawn_options o1;
+ o1.spawn_method();
+ o1.dont_initialize();
+ o1.set_sensitivity(&ev);
+ sc_process_handle h4 = sc_spawn(&r, sc_bind(&function_method, 1.2345), "event_sensitive_method", &o1);
+
+ }
+
+ void main()
+ {
+ int r;
+ sc_event e1, e2, e3, e4;
+ sc_spawn_options o1, o2, o3, o4;
+
+ cout << endl << sc_time_stamp() << ", "
+ << sc_get_current_process_handle().name()
+ << ": main thread, Before spawning round robin methods "
+ << endl << endl;
+
+ e1.notify(15, SC_NS);
+ o1.spawn_method();
+ o2.spawn_method();
+ o3.spawn_method();
+ o4.spawn_method();
+
+ // Spawn several methods that co-operatively execute in round robin order
+
+ sc_spawn(
+ sc_bind(&module1::round_robin, this, "1", sc_ref(e1), sc_ref(e2), 1), "method1", &o1);
+ sc_spawn(
+ sc_bind(&module1::round_robin, this, "2", sc_ref(e2), sc_ref(e3), 1), "method2", &o2);
+ sc_spawn(
+ sc_bind(&module1::round_robin, this, "3", sc_ref(e3), sc_ref(e4), 1), "method3", &o3);
+ sc_spawn(
+ sc_bind(&module1::round_robin, this, "4", sc_ref(e4), sc_ref(e1), 1), "method4", &o4);
+
+
+ cout << endl << sc_time_stamp() << ", "
+ << sc_get_current_process_handle().name()
+ << ": main thread, Issuing wait(60, SC_NS)" << endl;
+
+ sc_core::wait(60, SC_NS);
+
+ cout << endl << sc_time_stamp() << ", "
+ << sc_get_current_process_handle().name()
+ << ": Done main thread." << endl;
+ }
+
+ void round_robin(const char *str, sc_event& receive, sc_event& send, int cnt)
+ {
+ cout << sc_time_stamp() << ", "
+ << sc_get_current_process_handle().name()
+ << ": In Round robin method " << str;
+
+ if (method_count < 4) {
+ method_count++;
+ next_trigger(receive);
+ cout << ". Issued next_trigger. " << endl;
+ } else {
+ send.notify(10, SC_NS);
+ cout << ". Notified. Ending Round robin method " << str << endl;
+ }
+
+ }
+
+};
+
+int sc_main (int argc , char *argv[])
+{
+ sc_event event1;
+ event1.notify(55, SC_NS);
+
+ module1 mod1("mod1", event1);
+ sc_start(100, SC_NS);
+ cout << endl << sc_time_stamp() << ": sc_main, Before spawning function_thread " << endl;
+ sc_process_handle h4 = sc_spawn(sc_bind(&function_thread, 6.789));
+ sc_start(100, SC_NS);
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test03/golden/test03.log b/src/systemc/tests/systemc/kernel/dynamic_processes/test03/golden/test03.log
new file mode 100644
index 000000000..1131d3324
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test03/golden/test03.log
@@ -0,0 +1,8 @@
+SystemC Simulation
+
+0 s: static_method, Before spawning function_method
+
+Error: (E519) wait() is only allowed in SC_THREADs and SC_CTHREADs:
+ in SC_METHODs use next_trigger() instead
+In file: <removed by verify.pl>
+In process: mod1.static_method @ 0 s
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test03/test03.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/test03/test03.cpp
new file mode 100644
index 000000000..08040d299
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test03/test03.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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ Original Author: Bishnupriya Bhattacharya, Cadence Design Systems,
+ September 5, 2003
+
+ *****************************************************************************/
+
+// test error message for wait() on dynamic method process handle's event.
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date: Andy Goodrich, Forte Design Systems, 26 Jul 2005
+ Description of Modification: Changed waits to use the new terminated_event
+ support.
+
+ *****************************************************************************/
+// $Log: test03.cpp,v $
+// Revision 1.2 2011/02/01 17:17:40 acg
+// Andy Goodrich: update of copyright notice, added visible CVS logging.
+//
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include <systemc.h>
+
+int function_method(double d)
+{
+ cout << endl << sc_time_stamp() << ", "
+ << sc_get_current_process_handle().name()
+ << ": function_method sees " << d << endl;
+ return int(d);
+}
+
+class module1 : public sc_module
+{
+private:
+ sc_event& ev;
+public:
+
+ SC_HAS_PROCESS(module1);
+
+ module1(sc_module_name name, sc_event& event) : sc_module(name),
+ ev(event)
+ {
+ SC_METHOD(static_method);
+ }
+
+ void static_method() {
+ int r;
+ cout << endl << sc_time_stamp() << ": static_method, Before spawning function_method " << endl;
+ sc_spawn_options o1;
+ o1.spawn_method();
+ o1.dont_initialize();
+ o1.set_sensitivity(&ev);
+ sc_process_handle h4 = sc_spawn(&r, sc_bind(&function_method, 1.2345), "event_sensitive_method", &o1);
+ wait(h4.terminated_event());
+ }
+};
+
+int sc_main (int argc , char *argv[])
+{
+ sc_event event1;
+ event1.notify(55, SC_NS);
+
+ module1 mod1("mod1", event1);
+ sc_start(100, SC_NS);
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test04/golden/test04.log b/src/systemc/tests/systemc/kernel/dynamic_processes/test04/golden/test04.log
new file mode 100644
index 000000000..3535d567f
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test04/golden/test04.log
@@ -0,0 +1,8 @@
+SystemC Simulation
+
+0 s, mod1.main: main thread, Before spawning round robin methods
+
+
+Error: (E561) Attempt to register method process with sc_join object
+In file: <removed by verify.pl>
+In process: mod1.main @ 0 s
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test04/test04.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/test04/test04.cpp
new file mode 100644
index 000000000..f1a55e653
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test04/test04.cpp
@@ -0,0 +1,128 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ Original Author: Bishnupriya Bhattacharya, Cadence Design Systems,
+ September 5, 2003
+
+ *****************************************************************************/
+
+// test error message for SC_FORK-SC_JOIN on dynamic method process handles
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+// $Log: test04.cpp,v $
+// Revision 1.2 2011/02/01 17:17:40 acg
+// Andy Goodrich: update of copyright notice, added visible CVS logging.
+//
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include <systemc.h>
+
+
+class module1 : public sc_module
+{
+private:
+ int method_count;
+public:
+
+ SC_HAS_PROCESS(module1);
+
+ module1(sc_module_name name) : sc_module(name),
+ method_count(0)
+ {
+ SC_THREAD(main);
+ }
+
+ void main()
+ {
+ int r;
+ sc_event e1, e2, e3, e4;
+ sc_spawn_options o1, o2, o3, o4;
+
+ cout << endl << sc_time_stamp() << ", "
+ << sc_get_current_process_handle().name()
+ << ": main thread, Before spawning round robin methods "
+ << endl << endl;
+
+ e1.notify(15, SC_NS);
+ o1.spawn_method();
+ o2.spawn_method();
+ o3.spawn_method();
+ o4.spawn_method();
+
+ // Spawn several threads that co-operatively execute in round robin order
+
+ SC_FORK
+ sc_spawn(&r,
+ sc_bind(&module1::round_robin, this, "1", sc_ref(e1), sc_ref(e2), 1), "mth1", &o1),
+ sc_spawn(&r,
+ sc_bind(&module1::round_robin, this, "2", sc_ref(e2), sc_ref(e3), 1), "mth2", &o2),
+ sc_spawn(&r,
+ sc_bind(&module1::round_robin, this, "3", sc_ref(e3), sc_ref(e4), 1), "mth3", &o3),
+ sc_spawn(&r,
+ sc_bind(&module1::round_robin, this, "4", sc_ref(e4), sc_ref(e1), 1), "mth4", &o4),
+ SC_JOIN
+
+ cout << endl << sc_time_stamp() << ", "
+ << sc_get_current_process_handle().name()
+ << ": main thread, Issuing wait(60, SC_NS)" << endl;
+
+ wait(60, SC_NS);
+
+ cout << endl << sc_time_stamp() << ", "
+ << sc_get_current_process_handle().name()
+ << ": Done main thread." << endl;
+ }
+
+ int round_robin(const char *str, sc_event& receive, sc_event& send, int cnt)
+ {
+ cout << sc_time_stamp() << ", "
+ << sc_get_current_process_handle().name()
+ << ": In Round robin method " << str;
+
+ if (method_count < 4) {
+ method_count++;
+ next_trigger(receive);
+ cout << ". Issued next_trigger. " << endl;
+ } else {
+ send.notify(10, SC_NS);
+ cout << ". Notified. Ending Round robin method " << str << endl;
+ }
+
+ return 0;
+ }
+
+};
+int sc_main (int argc , char *argv[])
+{
+ module1 mod1("mod1");
+
+ sc_start(100, SC_NS);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test05/golden/test05.log b/src/systemc/tests/systemc/kernel/dynamic_processes/test05/golden/test05.log
new file mode 100644
index 000000000..f38eaee80
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test05/golden/test05.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+spawn thetest
+in thetest()
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test05/test05.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/test05/test05.cpp
new file mode 100644
index 000000000..c22a81385
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test05/test05.cpp
@@ -0,0 +1,65 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ Original Author: John Rose, Cadence Design Systems, Inc., 2004-02-15
+
+ *****************************************************************************/
+
+// tests sc_spawn() in start_of_simulation()
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+// $Log: test05.cpp,v $
+// Revision 1.2 2011/02/01 17:17:40 acg
+// Andy Goodrich: update of copyright notice, added visible CVS logging.
+//
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include "systemc.h"
+SC_MODULE(mod)
+{
+ void start_of_simulation()
+ {
+ cout << "spawn thetest" << endl;
+ sc_spawn(sc_bind(&mod::thetest, this));
+ }
+ void thetest()
+ {
+ cout << "in thetest()" << endl;
+ wait(10,SC_NS);
+ sc_stop();
+ }
+ SC_CTOR(mod) {
+ }
+};
+
+int sc_main(int, char**) {
+ mod m1("m1");
+ sc_start();
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test06/golden/test06.log b/src/systemc/tests/systemc/kernel/dynamic_processes/test06/golden/test06.log
new file mode 100644
index 000000000..ab7d58f54
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test06/golden/test06.log
@@ -0,0 +1,9 @@
+SystemC Simulation
+10 ns:entering p0, spawning p1
+10 ns:exiting p0
+10 ns:entering p1, spawning p2
+10 ns:entering p2, spawning p3
+10 ns:entering p3
+20 ns:exiting p1
+30 ns:exiting p2
+40 ns:exiting p3
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test06/test06.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/test06/test06.cpp
new file mode 100644
index 000000000..4f581df61
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test06/test06.cpp
@@ -0,0 +1,78 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ Original Author: Bishnupriya Bhattacharya, Cadence Design Systems, Inc., 2004-03-10
+
+ *****************************************************************************/
+
+// tests parent spawning process dying before child spawned process.
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+// $Log: test06.cpp,v $
+// Revision 1.2 2011/02/01 17:17:40 acg
+// Andy Goodrich: update of copyright notice, added visible CVS logging.
+//
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include <systemc.h>
+
+void p3() {
+ cerr << sc_time_stamp() << ":entering p3" << endl;
+ wait(30, SC_NS);
+ cerr << sc_time_stamp() << ":exiting p3" << endl;
+}
+
+void p2() {
+ cerr << sc_time_stamp() << ":entering p2, spawning p3" << endl;
+ sc_spawn(sc_bind(&p3));
+ wait(20, SC_NS);
+ cerr << sc_time_stamp() << ":exiting p2" << endl;
+}
+
+void p1() {
+ cerr << sc_time_stamp() << ":entering p1, spawning p2" << endl;
+ sc_spawn(sc_bind(&p2));
+ wait(10, SC_NS);
+ cerr << sc_time_stamp() << ":exiting p1" << endl;
+}
+
+void p0() {
+ cerr << sc_time_stamp() << ":entering p0, spawning p1" << endl;
+ sc_spawn(sc_bind(&p1));
+ cerr << sc_time_stamp() << ":exiting p0" << endl;
+}
+
+int sc_main(int, char**) {
+
+ sc_start(10, SC_NS);
+ p0();
+ sc_start(50, SC_NS);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test07/golden/test07.log b/src/systemc/tests/systemc/kernel/dynamic_processes/test07/golden/test07.log
new file mode 100644
index 000000000..06e667695
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test07/golden/test07.log
@@ -0,0 +1,100 @@
+SystemC Simulation
+1 ns setting m_a
+1 ns callback
+2 ns setting m_b
+2 ns callback
+3 ns setting m_c
+3 ns callback
+4 ns setting m_a
+4 ns callback
+5 ns setting m_b
+5 ns callback
+6 ns setting m_c
+6 ns callback
+7 ns setting m_a
+7 ns callback
+8 ns setting m_b
+8 ns callback
+9 ns setting m_c
+9 ns callback
+10 ns setting m_a
+10 ns callback
+11 ns setting m_b
+11 ns callback
+12 ns setting m_c
+12 ns callback
+13 ns setting m_a
+13 ns callback
+14 ns setting m_b
+14 ns callback
+15 ns setting m_c
+15 ns callback
+16 ns setting m_a
+16 ns callback
+17 ns setting m_b
+17 ns callback
+18 ns setting m_c
+18 ns callback
+19 ns setting m_a
+19 ns callback
+20 ns setting m_b
+20 ns callback
+21 ns setting m_c
+21 ns callback
+22 ns setting m_a
+22 ns callback
+23 ns setting m_b
+23 ns callback
+24 ns setting m_c
+24 ns callback
+25 ns setting m_a
+25 ns callback
+26 ns setting m_b
+26 ns callback
+27 ns setting m_c
+27 ns callback
+28 ns setting m_a
+28 ns callback
+29 ns setting m_b
+29 ns callback
+30 ns setting m_c
+30 ns callback
+31 ns setting m_a
+31 ns callback
+32 ns setting m_b
+32 ns callback
+33 ns setting m_c
+33 ns callback
+34 ns setting m_a
+34 ns callback
+35 ns setting m_b
+35 ns callback
+36 ns setting m_c
+36 ns callback
+37 ns setting m_a
+37 ns callback
+38 ns setting m_b
+38 ns callback
+39 ns setting m_c
+39 ns callback
+40 ns setting m_a
+40 ns callback
+41 ns setting m_b
+41 ns callback
+42 ns setting m_c
+42 ns callback
+43 ns setting m_a
+43 ns callback
+44 ns setting m_b
+44 ns callback
+45 ns setting m_c
+45 ns callback
+46 ns setting m_a
+46 ns callback
+47 ns setting m_b
+47 ns callback
+48 ns setting m_c
+48 ns callback
+49 ns setting m_a
+49 ns callback
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test07/test07.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/test07/test07.cpp
new file mode 100644
index 000000000..5b4975045
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test07/test07.cpp
@@ -0,0 +1,102 @@
+/*****************************************************************************
+
+ 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 -- Test that for all the interfaces of a port a callback occurs
+ for a dynamic process created after the beginning of simulation.
+
+ Original Author: Andy Goodrich, Forte Design Systems
+
+ *****************************************************************************/
+
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+// $Log: test07.cpp,v $
+// Revision 1.2 2011/02/01 17:17:40 acg
+// Andy Goodrich: update of copyright notice, added visible CVS logging.
+//
+
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include "systemc.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(thread,m_clk.pos());
+
+ // Set up interfaces for m_port.
+
+ m_port(m_a);
+ m_port(m_b);
+ m_port(m_c);
+ }
+ void method()
+ {
+ cout << sc_time_stamp() << " callback" << endl;
+ }
+ void thread()
+ {
+ sc_spawn_options options;
+ options.spawn_method();
+ options.set_sensitivity( &m_port );
+ options.dont_initialize();
+ sc_spawn( sc_bind(&DUT::method,this), "method", &options );
+ for ( bool value=true;; value = !value)
+ {
+ wait();
+ cout << sc_time_stamp() << " setting m_a " << endl;
+ m_a = value;
+ wait();
+ cout << sc_time_stamp() << " setting m_b " << endl;
+ m_b = value;
+ wait();
+ cout << sc_time_stamp() << " setting m_c " << endl;
+ m_c = value;
+ }
+ }
+ sc_signal<bool> m_a;
+ sc_signal<bool> m_b;
+ sc_signal<bool> m_c;
+ sc_in<bool> m_clk;
+ sc_port<sc_signal_inout_if<bool>,3> m_port;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+
+ dut.m_clk(clock);
+
+ sc_start(50, SC_NS);
+
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test08/golden/test08.log b/src/systemc/tests/systemc/kernel/dynamic_processes/test08/golden/test08.log
new file mode 100644
index 000000000..818ef6e87
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test08/golden/test08.log
@@ -0,0 +1,7 @@
+SystemC Simulation
+update called...
+thread here...
+update called...
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test08/test08.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/test08/test08.cpp
new file mode 100644
index 000000000..5374ff859
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test08/test08.cpp
@@ -0,0 +1,103 @@
+/*****************************************************************************
+
+ 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 -- Test for sc_spawn during update phase, including after stop.
+
+ Original Author: Andy Goodrich
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+// $Log: test08.cpp,v $
+// Revision 1.4 2011/02/20 13:43:44 acg
+// Andy Goodrich: updates for IEEE 1666 2011.
+//
+// Revision 1.3 2011/02/18 21:11:07 acg
+// Philipp A. Hartmann: rename ABC class to eliminate class with wingdi.h.
+//
+// Revision 1.2 2011/02/01 17:17:40 acg
+// Andy Goodrich: update of copyright notice, added visible CVS logging.
+//
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include "systemc.h"
+
+class prim_channel : public sc_prim_channel {
+ public:
+ prim_channel(const char* name = sc_gen_unique_name("prim_channel") )
+ : sc_prim_channel(name)
+ {}
+ void thread()
+ {
+ cout << "thread here..." << endl;
+ }
+ void update()
+ {
+ cout << "update called..." << endl;
+ sc_spawn( sc_bind(&prim_channel::thread,this),
+ sc_gen_unique_name("thread"));
+ }
+ void write( int i )
+ {
+ request_update();
+ }
+};
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(thread,m_clk.pos());
+ }
+ void thread()
+ {
+ for (;;)
+ {
+ wait();
+ m_chan.write(0);
+ wait();
+ m_chan.write(0);
+ sc_stop();
+ }
+ }
+ sc_in<bool> m_clk;
+ prim_channel m_chan;
+};
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+
+ dut.m_clk(clock);
+
+ sc_start(10, SC_NS);
+
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test09/golden/test09.log b/src/systemc/tests/systemc/kernel/dynamic_processes/test09/golden/test09.log
new file mode 100644
index 000000000..fe9a4a428
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test09/golden/test09.log
@@ -0,0 +1,102 @@
+SystemC Simulation
+0 s dut.grand_parent initialization
+
+0 s dut.grand_parent.parent1 initialization
+0 s dut.grand_parent.parent2 initialization
+0 s dut.grand_parent.parent1.child1 initialization
+0 s dut.grand_parent.parent1.child2 initialization
+0 s dut.grand_parent.parent1.child3 initialization
+0 s dut.grand_parent.parent2.child1 initialization
+0 s dut.grand_parent.parent2.child2 initialization
+0 s dut.grand_parent.parent2.child3 initialization
+4 ns stimulus issuing reset
+4 ns dut.grand_parent.parent1.child1 initialization
+4 ns dut.grand_parent.parent1.child2 initialization
+4 ns dut.grand_parent.parent1.child3 initialization
+4 ns dut.grand_parent.parent1 initialization
+4 ns dut.grand_parent.parent2.child1 initialization
+4 ns dut.grand_parent.parent2.child2 initialization
+4 ns dut.grand_parent.parent2.child3 initialization
+4 ns dut.grand_parent.parent2 removing children
+4 ns dut.grand_parent.parent2.child1 got kill
+4 ns dut.grand_parent.parent2.child2 got kill
+4 ns dut.grand_parent.parent2.child3 got kill
+4 ns dut.grand_parent.parent2 initialization
+4 ns dut.grand_parent initialization
+
+4 ns dut.grand_parent.parent2.child1 initialization
+4 ns dut.grand_parent.parent2.child2 initialization
+4 ns dut.grand_parent.parent2.child3 initialization
+8 ns stimulus issuing reset
+8 ns dut.grand_parent.parent1.child1 initialization
+8 ns dut.grand_parent.parent1.child2 initialization
+8 ns dut.grand_parent.parent1.child3 initialization
+8 ns dut.grand_parent.parent1 initialization
+8 ns dut.grand_parent.parent2.child1 initialization
+8 ns dut.grand_parent.parent2.child2 initialization
+8 ns dut.grand_parent.parent2.child3 initialization
+8 ns dut.grand_parent.parent2 removing children
+8 ns dut.grand_parent.parent2.child1 got kill
+8 ns dut.grand_parent.parent2.child2 got kill
+8 ns dut.grand_parent.parent2.child3 got kill
+8 ns dut.grand_parent.parent2 initialization
+8 ns dut.grand_parent initialization
+
+8 ns dut.grand_parent.parent2.child1 initialization
+8 ns dut.grand_parent.parent2.child2 initialization
+8 ns dut.grand_parent.parent2.child3 initialization
+12 ns stimulus issuing reset
+12 ns dut.grand_parent.parent1.child1 initialization
+12 ns dut.grand_parent.parent1.child2 initialization
+12 ns dut.grand_parent.parent1.child3 initialization
+12 ns dut.grand_parent.parent1 initialization
+12 ns dut.grand_parent.parent2.child1 initialization
+12 ns dut.grand_parent.parent2.child2 initialization
+12 ns dut.grand_parent.parent2.child3 initialization
+12 ns dut.grand_parent.parent2 removing children
+12 ns dut.grand_parent.parent2.child1 got kill
+12 ns dut.grand_parent.parent2.child2 got kill
+12 ns dut.grand_parent.parent2.child3 got kill
+12 ns dut.grand_parent.parent2 initialization
+12 ns dut.grand_parent initialization
+
+12 ns dut.grand_parent.parent2.child1 initialization
+12 ns dut.grand_parent.parent2.child2 initialization
+12 ns dut.grand_parent.parent2.child3 initialization
+16 ns stimulus issuing reset
+16 ns dut.grand_parent.parent1.child1 initialization
+16 ns dut.grand_parent.parent1.child2 initialization
+16 ns dut.grand_parent.parent1.child3 initialization
+16 ns dut.grand_parent.parent1 initialization
+16 ns dut.grand_parent.parent2.child1 initialization
+16 ns dut.grand_parent.parent2.child2 initialization
+16 ns dut.grand_parent.parent2.child3 initialization
+16 ns dut.grand_parent.parent2 removing children
+16 ns dut.grand_parent.parent2.child1 got kill
+16 ns dut.grand_parent.parent2.child2 got kill
+16 ns dut.grand_parent.parent2.child3 got kill
+16 ns dut.grand_parent.parent2 initialization
+16 ns dut.grand_parent initialization
+
+16 ns dut.grand_parent.parent2.child1 initialization
+16 ns dut.grand_parent.parent2.child2 initialization
+16 ns dut.grand_parent.parent2.child3 initialization
+20 ns stimulus issuing reset
+20 ns dut.grand_parent.parent1.child1 initialization
+20 ns dut.grand_parent.parent1.child2 initialization
+20 ns dut.grand_parent.parent1.child3 initialization
+20 ns dut.grand_parent.parent1 initialization
+20 ns dut.grand_parent.parent2.child1 initialization
+20 ns dut.grand_parent.parent2.child2 initialization
+20 ns dut.grand_parent.parent2.child3 initialization
+20 ns dut.grand_parent.parent2 removing children
+20 ns dut.grand_parent.parent2.child1 got kill
+20 ns dut.grand_parent.parent2.child2 got kill
+20 ns dut.grand_parent.parent2.child3 got kill
+20 ns dut.grand_parent.parent2 initialization
+20 ns dut.grand_parent initialization
+
+20 ns dut.grand_parent.parent2.child1 initialization
+20 ns dut.grand_parent.parent2.child2 initialization
+20 ns dut.grand_parent.parent2.child3 initialization
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test09/test09.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/test09/test09.cpp
new file mode 100644
index 000000000..437628142
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test09/test09.cpp
@@ -0,0 +1,205 @@
+/*****************************************************************************
+
+ 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 -- Test for hierarchical reset, try/catch and individual kill
+ processes
+
+ Original Author: Andy Goodrich
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+// $Log: test09.cpp,v $
+// Revision 1.4 2011/02/01 17:17:40 acg
+// Andy Goodrich: update of copyright notice, added visible CVS logging.
+//
+// Revision 1.3 2011/01/14 14:23:46 acg
+// Andy Goodrich: Fixes for 1666_2011
+//
+// Revision 1.2 2009/10/14 19:13:27 acg
+// Andy Goodrich: changes for SystemC 2.3
+//
+// Revision 1.1.1.1 2006/12/15 20:26:03 acg
+// systemc_tests-2.3
+//
+// Revision 1.1 2006/04/17 20:10:04 acg
+// Andy Goodrich: first inclusion of test for expanded process support.
+//
+
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include "systemc.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(stimulus,m_clk.pos());
+ reset_signal_is(m_reset, true);
+ SC_THREAD(grand_parent);
+ sensitive << m_clk.pos();
+ }
+
+ void child()
+ {
+ sc_process_handle my_handle = sc_get_current_process_handle();
+ cout << sc_time_stamp() << " " << my_handle.name()
+ << " initialization" << endl;
+ try {
+ for (;;)
+ {
+ wait();
+ }
+ }
+ catch(sc_core::sc_unwind_exception& ex)
+ {
+ if ( !ex.is_reset() )
+ {
+ cout << sc_time_stamp() << " " << my_handle.name()
+ << " got kill" << endl;
+ }
+ throw ex;
+ }
+ }
+
+ void grand_parent()
+ {
+ static bool initialize = true;
+ cout << sc_time_stamp() << " " << "dut.grand_parent initialization"
+ << endl;
+ cout << endl;
+ if ( initialize )
+ {
+ m_grand_parent_handle = sc_get_current_process_handle();
+ sc_spawn( sc_bind(&DUT::parent1, this), "parent1" );
+ sc_spawn( sc_bind(&DUT::parent2, this), "parent2" );
+ initialize = false;
+ }
+
+ for (;;)
+ {
+ wait();
+ }
+ }
+
+ void parent1()
+ {
+ static bool initialize = true;
+ sc_process_handle m_child1;
+ sc_process_handle m_child2;
+ sc_process_handle m_child3;
+ sc_process_handle my_handle = sc_get_current_process_handle();
+ cout << sc_time_stamp() << " " << my_handle.name()
+ << " initialization" << endl;
+ if ( initialize )
+ {
+ m_child1 = sc_spawn( sc_bind(&DUT::child, this), "child1" );
+ m_child2 = sc_spawn( sc_bind(&DUT::child, this), "child2" );
+ m_child3 = sc_spawn( sc_bind(&DUT::child, this), "child3" );
+ initialize = false;
+ }
+
+ for (;;)
+ {
+ wait();
+ }
+ }
+
+ void parent2()
+ {
+ sc_process_handle m_child1;
+ sc_process_handle m_child2;
+ sc_process_handle m_child3;
+ sc_process_handle my_handle;
+ for (;;)
+ {
+ try
+ {
+ my_handle = sc_get_current_process_handle();
+ cout << sc_time_stamp() << " " << my_handle.name()
+ << " initialization" << endl;
+ m_child1 = sc_spawn( sc_bind(&DUT::child, this), "child1" );
+ m_child2 = sc_spawn( sc_bind(&DUT::child, this), "child2" );
+ m_child3 = sc_spawn( sc_bind(&DUT::child, this), "child3" );
+
+ for (;;)
+ {
+ wait();
+ }
+ }
+ catch ( sc_core::sc_unwind_exception& ex )
+ {
+ if ( ex.is_reset() )
+ {
+ cout << sc_time_stamp() << " " << my_handle.name()
+ << " removing children" << endl;
+ m_child1.kill();
+ m_child2.kill();
+ m_child3.kill();
+ }
+ throw ex;
+ }
+ }
+ }
+
+ void stimulus()
+ {
+ for (;;)
+ {
+ wait();
+ wait();
+ wait();
+ wait();
+ cout << sc_time_stamp() << " stimulus issuing reset" << endl;
+ m_grand_parent_handle.reset(SC_INCLUDE_DESCENDANTS);
+ }
+ }
+
+ sc_in<bool> m_clk;
+ sc_process_handle m_grand_parent_handle;
+ sc_in<bool> m_reset;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+ sc_signal<bool> reset;
+
+ dut.m_clk(clock);
+ dut.m_reset(reset);
+
+ reset = true;
+ sc_start(1, SC_NS);
+ reset = false;
+ sc_start(20, SC_NS);
+
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test10/golden/test10.log b/src/systemc/tests/systemc/kernel/dynamic_processes/test10/golden/test10.log
new file mode 100644
index 000000000..d7d8a9de4
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test10/golden/test10.log
@@ -0,0 +1,15 @@
+SystemC Simulation
+0 s thread 0: initialization
+0 s thread 1: initialization
+0 s thread 2: initialization
+4 ns stimulus setting kill
+5 ns killer: killing thread0
+5 ns thread0: received kill
+5 ns thread1: received kill
+5 ns thread0: after killing thread1
+5 ns killer: after killing thread0
+5 ns thread2: received kill
+5 ns killer: after killing thread2
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test10/test10.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/test10/test10.cpp
new file mode 100644
index 000000000..2c2dd74eb
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/dynamic_processes/test10/test10.cpp
@@ -0,0 +1,175 @@
+/*****************************************************************************
+
+ 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 -- Testing proper process execution order for SC_METHOD murderer.
+
+ Original Author: Andy Goodrich
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+// $Log: test10.cpp,v $
+// Revision 1.2 2011/02/01 20:00:37 acg
+// Andy Goodrich: better messaging for output.
+//
+// Revision 1.1 2011/02/01 17:16:48 acg
+// Andy Goodrich: first check-in.
+//
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include "systemc.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_METHOD(killer);
+ sensitive << m_clk.pos();
+ SC_CTHREAD(stimulus,m_clk.pos());
+ SC_THREAD(thread0);
+ sensitive << m_clk.pos();
+ m_thread0 = sc_get_current_process_handle();
+ SC_THREAD(thread1);
+ sensitive << m_clk.pos();
+ m_thread1 = sc_get_current_process_handle();
+ SC_THREAD(thread2);
+ sensitive << m_clk.pos();
+ m_thread2 = sc_get_current_process_handle();
+ m_kill = false;
+ }
+
+ void killer()
+ {
+ if ( m_kill )
+ {
+ cout << sc_time_stamp() << " killer: killing thread0 " << endl;
+ m_thread0.kill();
+ cout << sc_time_stamp() << " killer: after killing thread0" << endl;
+ m_thread2.kill();
+ cout << sc_time_stamp() << " killer: after killing thread2" << endl;
+ }
+ }
+
+ void thread0()
+ {
+ cout << sc_time_stamp() << " thread 0: initialization" << endl;
+ try {
+ for (;;)
+ {
+ wait();
+ }
+ }
+ catch(sc_core::sc_unwind_exception& ex)
+ {
+ if ( !ex.is_reset() )
+ {
+ cout << sc_time_stamp() << " thread0: received kill" << endl;
+ m_thread1.kill();
+ cout << sc_time_stamp() << " thread0: after killing thread1"
+ << endl;
+ }
+ throw ex;
+ }
+ }
+
+ void thread1()
+ {
+ cout << sc_time_stamp() << " thread 1: initialization" << endl;
+ try {
+ for (;;)
+ {
+ wait();
+ }
+ }
+ catch(sc_core::sc_unwind_exception& ex)
+ {
+ if ( !ex.is_reset() )
+ {
+ cout << sc_time_stamp() << " thread1: received kill" << endl;
+ }
+ throw ex;
+ }
+ }
+
+ void thread2()
+ {
+ cout << sc_time_stamp() << " thread 2: initialization" << endl;
+ try {
+ for (;;)
+ {
+ wait();
+ }
+ }
+ catch(sc_core::sc_unwind_exception& ex)
+ {
+ if ( !ex.is_reset() )
+ {
+ cout << sc_time_stamp() << " thread2: received kill" << endl;
+ }
+ throw ex;
+ }
+ }
+
+ void stimulus()
+ {
+ for (;;)
+ {
+ wait();
+ wait();
+ wait();
+ wait();
+ cout << sc_time_stamp() << " stimulus setting kill" << endl;
+ m_kill = true;
+ wait();
+ m_kill = false;
+ wait();
+ wait();
+ sc_stop();
+ }
+ }
+
+ sc_in<bool> m_clk;
+ bool m_kill;
+ sc_process_handle m_thread0;
+ sc_process_handle m_thread1;
+ sc_process_handle m_thread2;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+
+ dut.m_clk(clock);
+
+ sc_start();
+
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/kind_string/test01/foo.cpp b/src/systemc/tests/systemc/kernel/kind_string/test01/foo.cpp
new file mode 100644
index 000000000..579eb47c8
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/kind_string/test01/foo.cpp
@@ -0,0 +1,51 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ foo.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:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+
+void
+foo( const sc_signal<int>& sig_ )
+{
+ sc_signal<int> sig;
+
+ if( std::string(sig_.kind()) == std::string(sig.kind()) ) {
+ cout << "kind() the same\n";
+ } else {
+ cout << "kind() different: '" << sig_.kind() << "' ~= ' "
+ << sig.kind() << "'\n";
+ }
+}
diff --git a/src/systemc/tests/systemc/kernel/kind_string/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/kind_string/test01/golden/test01.log
new file mode 100644
index 000000000..96dd0c997
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/kind_string/test01/golden/test01.log
@@ -0,0 +1,26 @@
+SystemC Simulation
+sc_method_process
+sc_method_process
+sc_thread_process
+sc_thread_process
+sc_cthread_process
+sc_cthread_process
+sc_module
+sc_module
+sc_clock
+sc_clock
+sc_fifo
+sc_fifo
+sc_mutex
+sc_mutex
+sc_signal
+sc_signal
+sc_signal
+sc_signal
+sc_signal
+sc_signal
+sc_signal_resolved
+sc_signal_resolved
+sc_signal_rv
+sc_signal_rv
+kind() the same
diff --git a/src/systemc/tests/systemc/kernel/kind_string/test01/main.cpp b/src/systemc/tests/systemc/kernel/kind_string/test01/main.cpp
new file mode 100644
index 000000000..ab74f1059
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/kind_string/test01/main.cpp
@@ -0,0 +1,110 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.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: change sc_get_curr_proc_handle() to
+ sc_get_last_created_process_handle()
+
+ *****************************************************************************/
+
+// test the kind string of objects
+
+#include "systemc.h"
+
+#define WRITE(a) \
+{ \
+ cout << (a).kind() << endl; \
+ const sc_object* obj = &(a); \
+ cout << obj->kind() << endl; \
+}
+
+SC_MODULE( mod_a )
+{
+ sc_in_clk clk;
+
+ void method_action()
+ {}
+
+ void thread_action()
+ {}
+
+ void cthread_action()
+ {}
+
+ SC_CTOR( mod_a )
+ {
+ SC_METHOD( method_action );
+ WRITE( *sc_get_current_process_handle().get_process_object() );
+ SC_THREAD( thread_action );
+ WRITE( *sc_get_current_process_handle().get_process_object() );
+ SC_CTHREAD( cthread_action, clk.pos() );
+ WRITE( *sc_get_current_process_handle().get_process_object() );
+ }
+};
+
+extern void foo( const sc_signal<int>& );
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+ WRITE( a );
+
+ sc_clock clk;
+ WRITE( clk );
+
+ sc_fifo<int> fifo;
+ WRITE( fifo );
+
+ sc_mutex mutex;
+ WRITE( mutex );
+
+ sc_signal<int> signal;
+ WRITE( signal );
+
+ sc_signal<bool> signal_bool;
+ WRITE( signal_bool );
+
+ sc_signal<sc_logic> signal_logic;
+ WRITE( signal_logic );
+
+ sc_signal_resolved signal_resolved;
+ WRITE( signal_resolved );
+
+ sc_signal_rv<8> signal_rv;
+ WRITE( signal_rv );
+
+ foo( signal );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/kind_string/test01/test01.f b/src/systemc/tests/systemc/kernel/kind_string/test01/test01.f
new file mode 100644
index 000000000..86ce61a67
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/kind_string/test01/test01.f
@@ -0,0 +1,2 @@
+test01/foo.cpp
+test01/main.cpp
diff --git a/src/systemc/tests/systemc/kernel/module_method_after_sc_start/golden/module_method_after_sc_start.log b/src/systemc/tests/systemc/kernel/module_method_after_sc_start/golden/module_method_after_sc_start.log
new file mode 100644
index 000000000..88037e592
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/module_method_after_sc_start/golden/module_method_after_sc_start.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+
+Error: (E541) call to SC_METHOD in sc_module while simulation running: y.comb.dork
+In file: <removed by verify.pl>
+In process: y.comb @ 0 s
diff --git a/src/systemc/tests/systemc/kernel/module_method_after_sc_start/module_method_after_sc_start.cpp b/src/systemc/tests/systemc/kernel/module_method_after_sc_start/module_method_after_sc_start.cpp
new file mode 100644
index 000000000..d39696b46
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/module_method_after_sc_start/module_method_after_sc_start.cpp
@@ -0,0 +1,40 @@
+#include "systemc.h"
+
+SC_MODULE(Y)
+{
+public:
+ sc_in<bool> in;
+ SC_CTOR(Y) : in("in")
+ {
+ SC_METHOD(comb);
+ sensitive << in;
+ init = 1;
+ }
+ int init;
+ void comb()
+ {
+ if ( init )
+ {
+ init = 0;
+ SC_METHOD(dork);
+ }
+ }
+ void dork()
+ {
+ cout << "dork" << endl;
+ }
+};
+
+int sc_main(int argc, char* arg[])
+{
+ sc_clock clock;
+ Y y("y");
+ y.in(clock);
+
+
+ sc_start(10, SC_NS);
+ cerr << "Program completed" << endl;
+
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/module_thread_after_sc_start/golden/module_thread_after_sc_start.log b/src/systemc/tests/systemc/kernel/module_thread_after_sc_start/golden/module_thread_after_sc_start.log
new file mode 100644
index 000000000..3c3227a91
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/module_thread_after_sc_start/golden/module_thread_after_sc_start.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+
+Error: (E542) call to SC_THREAD in sc_module while simulation running: y.comb.dork
+In file: <removed by verify.pl>
+In process: y.comb @ 0 s
diff --git a/src/systemc/tests/systemc/kernel/module_thread_after_sc_start/module_thread_after_sc_start.cpp b/src/systemc/tests/systemc/kernel/module_thread_after_sc_start/module_thread_after_sc_start.cpp
new file mode 100644
index 000000000..4891b991d
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/module_thread_after_sc_start/module_thread_after_sc_start.cpp
@@ -0,0 +1,40 @@
+#include "systemc.h"
+
+SC_MODULE(Y)
+{
+public:
+ sc_in<bool> in;
+ SC_CTOR(Y) : in("in")
+ {
+ SC_METHOD(comb);
+ sensitive << in;
+ init = 1;
+ }
+ int init;
+ void comb()
+ {
+ if ( init )
+ {
+ init = 0;
+ SC_THREAD(dork);
+ }
+ }
+ void dork()
+ {
+ cout << "dork" << endl;
+ }
+};
+
+int sc_main(int argc, char* arg[])
+{
+ sc_clock clock;
+ Y y("y");
+ y.in(clock);
+
+
+ sc_start(10, SC_NS);
+ cerr << "Program completed" << endl;
+
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/phase_callbacks/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/phase_callbacks/test01/golden/test01.log
new file mode 100644
index 000000000..9e42301d0
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/phase_callbacks/test01/golden/test01.log
@@ -0,0 +1,7 @@
+SystemC Simulation
+prim_channel: before end of elaboration
+prim_channel: start of simulation
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+prim_channel: end of simulation
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/phase_callbacks/test01/test01.cpp b/src/systemc/tests/systemc/kernel/phase_callbacks/test01/test01.cpp
new file mode 100644
index 000000000..c4095aae3
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/phase_callbacks/test01/test01.cpp
@@ -0,0 +1,57 @@
+#include "systemc.h"
+
+class Sig : public sc_prim_channel {
+ public:
+ virtual void before_end_of_elaboration()
+ {
+ cout << "prim_channel: before end of elaboration" << endl;
+ }
+ virtual void end_of_simulation()
+ {
+ cout << "prim_channel: end of simulation" << endl;
+ }
+ virtual void start_of_simulation()
+ {
+ cout << "prim_channel: start of simulation" << endl;
+ }
+};
+
+SC_MODULE(X)
+{
+ SC_CTOR(X)
+ {
+ SC_CTHREAD(y, clk.pos());
+ }
+ void y()
+ {
+ wait();
+ sc_stop();
+ }
+ sc_in_clk clk;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ Sig signal;
+ X x("x");
+
+ x.clk(clock);
+
+ if ( sc_start_of_simulation_invoked() )
+ cout << __FILE__ << "(" << __LINE__ << "): bad start flag should be false" << endl;
+ if ( sc_end_of_simulation_invoked() )
+ cout << __FILE__ << "(" << __LINE__ << "): bad end flag should be false" << endl;
+
+ sc_start(2, SC_NS);
+ if ( !sc_start_of_simulation_invoked() )
+ cout << __FILE__ << "(" << __LINE__ << "): bad start flag should be true" << endl;
+
+ if ( !sc_end_of_simulation_invoked() )
+ cout << __FILE__ << "(" << __LINE__ << "): bad end flag should be true" << endl;
+
+ cerr << "Program completed" << endl;
+
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/phase_callbacks/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/phase_callbacks/test02/golden/test02.log
new file mode 100644
index 000000000..9e42301d0
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/phase_callbacks/test02/golden/test02.log
@@ -0,0 +1,7 @@
+SystemC Simulation
+prim_channel: before end of elaboration
+prim_channel: start of simulation
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+prim_channel: end of simulation
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/phase_callbacks/test02/test02.cpp b/src/systemc/tests/systemc/kernel/phase_callbacks/test02/test02.cpp
new file mode 100644
index 000000000..2f4f3c285
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/phase_callbacks/test02/test02.cpp
@@ -0,0 +1,57 @@
+#include "systemc.h"
+
+class Sig : public sc_prim_channel {
+ public:
+ virtual void before_end_of_elaboration()
+ {
+ cout << "prim_channel: before end of elaboration" << endl;
+ }
+ virtual void end_of_simulation()
+ {
+ cout << "prim_channel: end of simulation" << endl;
+ }
+ virtual void start_of_simulation()
+ {
+ cout << "prim_channel: start of simulation" << endl;
+ }
+};
+
+SC_MODULE(X)
+{
+ SC_CTOR(X)
+ {
+ SC_CTHREAD(y, clk.pos());
+ }
+ void y()
+ {
+ wait();
+ }
+ sc_in_clk clk;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ Sig signal;
+ X x("x");
+
+ x.clk(clock);
+
+ if ( sc_start_of_simulation_invoked() )
+ cout << __FILE__ << "(" << __LINE__ << "): bad start flag should be false" << endl;
+ if ( sc_end_of_simulation_invoked() )
+ cout << __FILE__ << "(" << __LINE__ << "): bad end flag should be false" << endl;
+
+ sc_start(2, SC_NS);
+ if ( !sc_start_of_simulation_invoked() )
+ cout << __FILE__ << "(" << __LINE__ << "): bad start flag should be true" << endl;
+
+ sc_stop();
+ if ( !sc_end_of_simulation_invoked() )
+ cout << __FILE__ << "(" << __LINE__ << "): bad end flag should be true" << endl;
+
+ cerr << "Program completed" << endl;
+
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/phase_callbacks/test03/golden/test03.log b/src/systemc/tests/systemc/kernel/phase_callbacks/test03/golden/test03.log
new file mode 100644
index 000000000..29f67481e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/phase_callbacks/test03/golden/test03.log
@@ -0,0 +1,22 @@
+SystemC Simulation
+top.delayed_mod.delayed_port->before_end_of_elaboration() called
+top.direct_mod.delayed_port->before_end_of_elaboration() called
+top.delayed_mod.direct_port->before_end_of_elaboration() called
+top.delayed_port->before_end_of_elaboration() called
+top.direct_port->before_end_of_elaboration() called
+top.direct_mod.direct_port->before_end_of_elaboration() called
+top->before_end_of_elaboration() called
+top.direct_mod->before_end_of_elaboration() called
+top.direct_mod.direct_port_direct_mod->before_end_of_elaboration() called
+top.direct_port_direct_mod->before_end_of_elaboration() called
+top.direct_port_delayed_mod->before_end_of_elaboration() called
+top.direct_mod.direct_port_delayed_mod->before_end_of_elaboration() called
+top.delayed_port_direct_mod->before_end_of_elaboration() called
+top.delayed_mod->before_end_of_elaboration() called
+top.delayed_mod.direct_port_direct_mod->before_end_of_elaboration() called
+top.direct_mod.delayed_port_direct_mod->before_end_of_elaboration() called
+top.delayed_mod.delayed_port_direct_mod->before_end_of_elaboration() called
+top.delayed_mod.delayed_port_delayed_mod->before_end_of_elaboration() called
+top.direct_mod.delayed_port_delayed_mod->before_end_of_elaboration() called
+top.delayed_mod.direct_port_delayed_mod->before_end_of_elaboration() called
+top.delayed_port_delayed_mod->before_end_of_elaboration() called
diff --git a/src/systemc/tests/systemc/kernel/phase_callbacks/test03/test03.cpp b/src/systemc/tests/systemc/kernel/phase_callbacks/test03/test03.cpp
new file mode 100644
index 000000000..d34109cb7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/phase_callbacks/test03/test03.cpp
@@ -0,0 +1,148 @@
+/*****************************************************************************
+
+ 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 -- test for delayed before end of elaboration.
+//
+// Original Author: Philipp A. Hartmann, OFFIS Institute for Information
+// Technology
+//
+// MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+//
+// $Log: test03.cpp,v $
+// Revision 1.2 2011/07/24 13:05:30 acg
+// Alan Fitch: added return 0 to sc_main that was missing.
+//
+// Revision 1.1 2011/05/08 17:55:36 acg
+// Philipp A. Hartmann: first check in of test.
+//
+
+#include <systemc>
+
+using namespace sc_core;
+
+#define PRINT_CALL( CallBack, Condition ) \
+ std::cout << this->name() \
+ << "->" #CallBack "()" \
+ << ( ( Condition ) ? " " : " NOT " ) \
+ << "called" \
+ << std::endl
+
+SC_MODULE(in_port_module)
+{
+ SC_CTOR(in_port_module) : beoe_called(false) {}
+
+ void before_end_of_elaboration()
+ { beoe_called = true; }
+
+ void end_of_elaboration()
+ { PRINT_CALL(before_end_of_elaboration,beoe_called); }
+
+ bool beoe_called;
+};
+
+struct my_port : sc_in<bool>
+{
+ typedef sc_in<bool> base_type;
+
+ explicit my_port( const char* nm )
+ : base_type(nm)
+ , direct_mod( (std::string(nm)+"_direct_mod").c_str() )
+ , beoe_called(false) {}
+
+ void before_end_of_elaboration()
+ {
+ beoe_called = true;
+ std::string nm = std::string(basename()) + "_delayed_mod";
+ delayed_mod = new in_port_module( nm.c_str() );
+ }
+
+ void end_of_elaboration()
+ { PRINT_CALL(before_end_of_elaboration,beoe_called); }
+
+ in_port_module direct_mod;
+ in_port_module* delayed_mod;
+ bool beoe_called;
+};
+
+SC_MODULE(sub_module)
+{
+ my_port direct_port;
+ my_port* delayed_port;
+
+ SC_CTOR(sub_module)
+ : direct_port("direct_port")
+ , delayed_port(0)
+ , beoe_called(false)
+ {}
+
+ void before_end_of_elaboration()
+ {
+ delayed_port = new my_port( "delayed_port" );
+ (*delayed_port)( direct_port );
+ beoe_called = true;
+ }
+
+ void end_of_elaboration()
+ { PRINT_CALL(before_end_of_elaboration,beoe_called); }
+
+ bool beoe_called;
+};
+
+SC_MODULE(module)
+{
+ sub_module direct_mod;
+ my_port direct_port;
+ sub_module* delayed_mod;
+ my_port* delayed_port;
+
+ SC_CTOR(module)
+ : direct_mod("direct_mod")
+ , direct_port("direct_port")
+ , delayed_mod(0)
+ , delayed_port(0)
+ , beoe_called(false)
+ {
+ direct_mod.direct_port( direct_port );
+ }
+
+ void before_end_of_elaboration()
+ {
+ delayed_port = new my_port( "delayed_port" );
+ (*delayed_port)( direct_port );
+
+ delayed_mod = new sub_module( "delayed_mod" );
+ delayed_mod->direct_port( *delayed_port );
+ beoe_called = true;
+ }
+
+ void end_of_elaboration()
+ { PRINT_CALL(before_end_of_elaboration,beoe_called); }
+
+ bool beoe_called;
+};
+
+int sc_main( int, char*[] )
+{
+ module mod("top");
+ sc_signal<bool> sig("sig");
+ mod.direct_port( sig );
+
+ sc_start();
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/phase_callbacks/test04/golden/register_phase_callbacks.log b/src/systemc/tests/systemc/kernel/phase_callbacks/test04/golden/register_phase_callbacks.log
new file mode 100644
index 000000000..5915a8821
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/phase_callbacks/test04/golden/register_phase_callbacks.log
@@ -0,0 +1,80 @@
+SystemC Simulation
+
+Warning: (W552) register simulation phase callback: phase_tracer_0: SC_ELABORATION:
+ substituted by (SC_BEFORE_END_OF_ELABORATION|SC_END_OF_ELABORATION)
+In file: <removed by verify.pl>
+
+Warning: (W552) register simulation phase callback: phase_tracer_0: SC_RUNNING:
+ substituted by (SC_END_OF_INITIALIZATION|SC_END_OF_UPDATE|SC_BEFORE_TIMESTEP)
+In file: <removed by verify.pl>
+
+Warning: (W552) register simulation phase callback: phase_tracer_0: SC_RUNNING:
+ substituted by (SC_END_OF_INITIALIZATION|SC_END_OF_UPDATE|SC_BEFORE_TIMESTEP)
+In file: <removed by verify.pl>
+
+Warning: (W552) register simulation phase callback: phase_tracer_0: SC_ELABORATION:
+ substituted by (SC_BEFORE_END_OF_ELABORATION|SC_END_OF_ELABORATION)
+In file: <removed by verify.pl>
+
+Warning: (W552) register simulation phase callback: phase_tracer_0: SC_RUNNING:
+ substituted by (SC_END_OF_INITIALIZATION|SC_END_OF_UPDATE|SC_BEFORE_TIMESTEP)
+In file: <removed by verify.pl>
+phase_tracer_0: before_end_of_elaboration: 0 callbacks called.
+phase_tracer_0: phase callback SC_BEFORE_END_OF_ELABORATION: 0 s -> pending activity: MAX
+phase_tracer_0: end_of_elaboration: 1 callbacks called.
+phase_tracer_0: phase callback SC_END_OF_ELABORATION: 0 s -> pending activity: MAX
+phase_tracer_0: start_of_simulation: 2 callbacks called.
+
+Warning: (W552) register simulation phase callback: phase_tracer_0: elaboration done
+ SC_ELABORATION callback(s) ignored
+In file: <removed by verify.pl>
+phase_tracer_0: phase callback SC_START_OF_SIMULATION: 0 s -> pending activity: MAX
+phase_tracer_0: phase callback SC_END_OF_INITIALIZATION: 0 s -> pending activity: 0 s
+phase_tracer_0.timed: 0 s: 0
+phase_tracer_0.delta: 0 s: 0
+phase_tracer_0: phase callback SC_END_OF_UPDATE: 0 s -> pending activity: 0 s
+phase_tracer_0.delta: 0 s: 1
+phase_tracer_0: phase callback SC_END_OF_UPDATE: 0 s -> pending activity: 100 ns
+
+Warning: (W553) forbidden action in simulation phase callback: SC_END_OF_UPDATE:
+ delta notification of `phase_tracer_0.event_0' ignored
+In file: <removed by verify.pl>
+phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 0 s -> pending activity: 100 ns
+
+Warning: (W553) forbidden action in simulation phase callback: SC_BEFORE_TIMESTEP:
+ delta notification of `phase_tracer_0.event_0' ignored
+In file: <removed by verify.pl>
+phase_tracer_0.timed: 100 ns: 1
+phase_tracer_0: phase callback SC_END_OF_UPDATE: 100 ns -> pending activity: 0 s
+phase_tracer_0.delta: 100 ns: 2
+phase_tracer_0: phase callback SC_END_OF_UPDATE: 100 ns -> pending activity: 100 ns
+
+Warning: (W553) forbidden action in simulation phase callback: SC_END_OF_UPDATE:
+ timed notification of `phase_tracer_0.event_0' ignored
+In file: <removed by verify.pl>
+phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 100 ns -> pending activity: 100 ns
+
+Warning: (W553) forbidden action in simulation phase callback: SC_BEFORE_TIMESTEP:
+ timed notification of `phase_tracer_0.event_0' ignored
+In file: <removed by verify.pl>
+phase_tracer_0.timed: 200 ns: 2
+phase_tracer_0: phase callback SC_END_OF_UPDATE: 200 ns -> pending activity: 0 s
+phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 200 ns -> pending activity: 100 ns
+phase_tracer_0.timed: 300 ns: 3
+phase_tracer_0: phase callback SC_END_OF_UPDATE: 300 ns -> pending activity: 0 s
+phase_tracer_0.delta: 300 ns: 3
+phase_tracer_0: phase callback SC_END_OF_UPDATE: 300 ns -> pending activity: 100 ns
+phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 300 ns -> pending activity: 100 ns
+phase_tracer_0.timed: 400 ns: 4
+phase_tracer_0: phase callback SC_END_OF_UPDATE: 400 ns -> pending activity: 0 s
+phase_tracer_0.delta: 400 ns: 4
+phase_tracer_0: phase callback SC_END_OF_UPDATE: 400 ns -> pending activity: 100 ns
+phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 400 ns -> pending activity: 100 ns
+phase_tracer_0.timed: 500 ns: 5
+phase_tracer_0: phase callback SC_END_OF_UPDATE: 500 ns -> pending activity: MAX
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+phase_tracer_0: end_of_simulation: 19 callbacks called.
+phase_tracer_0: phase callback SC_END_OF_SIMULATION: 500 ns -> pending activity: MAX
+phase_tracer_0: phase callback SC_STOPPED: 500 ns -> pending activity: MAX
+phase_tracer_0: [destructor]: 21 callbacks called.
diff --git a/src/systemc/tests/systemc/kernel/phase_callbacks/test04/register_phase_callbacks.cpp b/src/systemc/tests/systemc/kernel/phase_callbacks/test04/register_phase_callbacks.cpp
new file mode 100644
index 000000000..5ed6dd4f9
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/phase_callbacks/test04/register_phase_callbacks.cpp
@@ -0,0 +1,221 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ register_phase_callbacks.cpp -- Test for (un)registering dynamic callbacks
+
+ Note: requires simulation phase callback support enabled in the kernel
+ SC_ENABLE_SIMULATION_PHASE_CALLBACKS / --enable-phase-callbacks
+
+ Original Author: Philipp A. Hartmann, OFFIS, 2013-05-17
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include <systemc.h>
+
+#define VERBOSE 1
+
+SC_MODULE(phase_tracer)
+{
+ SC_HAS_PROCESS(phase_tracer);
+ phase_tracer( sc_module_name nm
+ = sc_core::sc_gen_unique_name("phase_tracer") )
+ : cb_count(0), timed_count(), delta_count()
+ {
+ SC_METHOD(timed);
+ SC_METHOD(delta);
+ sensitive << ev;
+
+ old_mask = SC_STATUS_ANY;
+ cb_mask = register_simulation_phase_callback( SC_STATUS_ANY );
+ sc_assert( cb_mask == (old_mask & ~SC_ELABORATION & ~SC_RUNNING) );
+ old_mask = cb_mask;
+
+ cb_mask = unregister_simulation_phase_callback(SC_STOPPED);
+ sc_assert( cb_mask == (old_mask & ~SC_STOPPED) );
+ old_mask = cb_mask;
+
+ cb_mask = register_simulation_phase_callback( SC_UNITIALIZED );
+ sc_assert( cb_mask == old_mask );
+
+ cb_mask = unregister_simulation_phase_callback(SC_UNITIALIZED);
+ sc_assert( cb_mask == old_mask );
+
+ cb_mask = unregister_simulation_phase_callback(SC_RUNNING);
+ sc_assert( cb_mask == (old_mask & ~SC_END_OF_INITIALIZATION
+// & ~SC_END_OF_EVALUATION
+ & ~SC_END_OF_UPDATE
+ & ~SC_BEFORE_TIMESTEP) );
+ old_mask = cb_mask;
+
+ cb_mask = unregister_simulation_phase_callback(SC_ELABORATION);
+ sc_assert( cb_mask == (old_mask & ~SC_BEFORE_END_OF_ELABORATION
+ & ~SC_END_OF_ELABORATION ) );
+ old_mask = cb_mask;
+
+ cb_mask = unregister_simulation_phase_callback( SC_STATUS_ANY );
+ sc_assert( cb_mask == SC_UNITIALIZED );
+ old_mask = cb_mask;
+
+ cb_mask = register_simulation_phase_callback( SC_RUNNING );
+ sc_assert( cb_mask == ( SC_END_OF_INITIALIZATION
+// | SC_END_OF_EVALUATION
+ | SC_END_OF_UPDATE | SC_BEFORE_TIMESTEP ) );
+
+ cb_mask = register_simulation_phase_callback( SC_STATUS_ANY );
+ sc_assert( cb_mask == (SC_STATUS_ANY & ~SC_ELABORATION & ~SC_RUNNING) );
+ }
+
+ void timed()
+ {
+ std::cout
+ << sc_get_current_process_handle().name()
+ << ": " << sc_time_stamp()
+ << ": " << timed_count
+ << std::endl;
+ if( timed_count++ < 5 ) {
+ next_trigger( 100, SC_NS );
+ }
+ if( delta_count < 5 )
+ ev.notify( SC_ZERO_TIME );
+
+ if( timed_count>=6 )
+ sc_stop();
+ }
+ void delta()
+ {
+ std::cout
+ << sc_get_current_process_handle().name()
+ << ": " << sc_time_stamp()
+ << ": " << delta_count
+ << std::endl;
+ delta_count++;
+ }
+
+ virtual void simulation_phase_callback()
+ {
+ cb_count++;
+
+# if VERBOSE
+ {
+ std::string ttp;
+ if( !sc_pending_activity() ) {
+ ttp = "MAX";
+ } else {
+ ttp = sc_time_to_pending_activity().to_string();
+ }
+ std::cout << name()
+ << ": phase callback "
+ << sc_get_status()
+ << ": " << sc_time_stamp()
+ << " -> pending activity: " << ttp
+ << std::endl;
+ }
+# endif
+ sc_assert( cb_mask & sc_get_status() );
+
+ switch( sc_get_status() )
+ {
+ case SC_END_OF_UPDATE:
+ case SC_BEFORE_TIMESTEP:
+ if( timed_count == 3 )
+ ev.cancel();
+ if( delta_count == 2 )
+ ev.notify(SC_ZERO_TIME);
+ if( timed_count == 2 )
+ ev.notify( 1, SC_NS );
+ break;
+ default:
+ // do nothing
+ break;
+ }
+ }
+
+ ~phase_tracer()
+ { print_static_phase_stats( "[destructor]" ); }
+
+ void print_static_phase_stats( const char* phase )
+ {
+#if VERBOSE
+ std::cout << name()
+ << ": " << phase << ": "
+ << cb_count << " callbacks called."
+ << std::endl;
+#endif
+ }
+
+private:
+
+ virtual void before_end_of_elaboration()
+ {
+ sc_assert( sc_get_status() == SC_BEFORE_END_OF_ELABORATION );
+ print_static_phase_stats( "before_end_of_elaboration" );
+ }
+
+ virtual void end_of_elaboration()
+ {
+ sc_assert( sc_get_status() == SC_END_OF_ELABORATION );
+ print_static_phase_stats( "end_of_elaboration" );
+ }
+
+ virtual void start_of_simulation()
+ {
+ sc_assert( sc_get_status() == SC_START_OF_SIMULATION );
+ print_static_phase_stats( "start_of_simulation" );
+
+ // ignored - issues warning
+ register_simulation_phase_callback( SC_ELABORATION );
+ }
+
+ virtual void end_of_simulation()
+ {
+ sc_assert( sc_get_status() == SC_END_OF_SIMULATION );
+ print_static_phase_stats( "end_of_simulation" );
+ }
+
+
+
+private:
+ phase_cb_mask cb_mask, old_mask;
+ sc_dt::uint64 cb_count, timed_count, delta_count;
+ sc_event ev;
+};
+
+
+int sc_main(int, char*[])
+{
+ // don't run without callbacks enabled
+ sc_report_handler::set_actions( SC_ID_PHASE_CALLBACKS_UNSUPPORTED_
+ , SC_DEFAULT_ERROR_ACTIONS );
+
+ phase_tracer pt;
+ sc_start();
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/phase_callbacks/test05/golden/simulation_callbacks.log b/src/systemc/tests/systemc/kernel/phase_callbacks/test05/golden/simulation_callbacks.log
new file mode 100644
index 000000000..85fefc217
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/phase_callbacks/test05/golden/simulation_callbacks.log
@@ -0,0 +1,109 @@
+SystemC Simulation
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 0 s -> pending activity: MAX
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 0 s -> pending activity: 0 s
+top.timed: 0 s: 0/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 0 s -> pending activity: 0 s
+top.delta: 0 s: 1/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 0 s -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 0 s -> pending activity: 1 ns
+top.timed: 1 ns: 1/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 1 ns -> pending activity: 0 s
+top.delta: 1 ns: 2/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 1 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 1 ns -> pending activity: 1 ns
+top.timed: 2 ns: 2/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 2 ns -> pending activity: 0 s
+top.delta: 2 ns: 3/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 2 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 2 ns -> pending activity: 1 ns
+top.timed: 3 ns: 3/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 3 ns -> pending activity: 0 s
+top.delta: 3 ns: 4/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 3 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 3 ns -> pending activity: 1 ns
+top.timed: 4 ns: 4/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 4 ns -> pending activity: 0 s
+top.delta: 4 ns: 5/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 4 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 4 ns -> pending activity: 1 ns
+top.timed: 5 ns: 5/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 5 ns -> pending activity: 0 s
+top.delta: 5 ns: 6/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 5 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 5 ns -> pending activity: 1 ns
+top.timed: 6 ns: 6/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 6 ns -> pending activity: 0 s
+top.delta: 6 ns: 7/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 6 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 6 ns -> pending activity: 1 ns
+top.timed: 7 ns: 7/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 7 ns -> pending activity: 0 s
+top.delta: 7 ns: 8/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 7 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 7 ns -> pending activity: 1 ns
+top.timed: 8 ns: 8/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 8 ns -> pending activity: 0 s
+top.delta: 8 ns: 9/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 8 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 8 ns -> pending activity: 1 ns
+top.timed: 9 ns: 9/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 9 ns -> pending activity: 0 s
+top.delta: 9 ns: 10/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 9 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 9 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 10 ns -> pending activity: MAX
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 10 ns -> pending activity: 0 s
+top.timed: 10 ns: 0/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 10 ns -> pending activity: 0 s
+top.delta: 10 ns: 1/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 10 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 10 ns -> pending activity: 1 ns
+top.timed: 11 ns: 1/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 11 ns -> pending activity: 0 s
+top.delta: 11 ns: 2/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 11 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 11 ns -> pending activity: 1 ns
+top.timed: 12 ns: 2/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 12 ns -> pending activity: 0 s
+top.delta: 12 ns: 3/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 12 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 12 ns -> pending activity: 1 ns
+top.timed: 13 ns: 3/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 13 ns -> pending activity: 0 s
+top.delta: 13 ns: 4/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 13 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 13 ns -> pending activity: 1 ns
+top.timed: 14 ns: 4/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 14 ns -> pending activity: 0 s
+top.delta: 14 ns: 5/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 14 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 14 ns -> pending activity: 1 ns
+top.timed: 15 ns: 5/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 15 ns -> pending activity: 0 s
+top.delta: 15 ns: 6/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 15 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 15 ns -> pending activity: 1 ns
+top.timed: 16 ns: 6/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 16 ns -> pending activity: 0 s
+top.delta: 16 ns: 7/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 16 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 16 ns -> pending activity: 1 ns
+top.timed: 17 ns: 7/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 17 ns -> pending activity: 0 s
+top.delta: 17 ns: 8/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 17 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 17 ns -> pending activity: 1 ns
+top.timed: 18 ns: 8/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 18 ns -> pending activity: 0 s
+top.delta: 18 ns: 9/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 18 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 18 ns -> pending activity: 1 ns
+top.timed: 19 ns: 9/0
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 19 ns -> pending activity: 0 s
+top.delta: 19 ns: 10/1
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 19 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_BEFORE_TIMESTEP: 19 ns -> pending activity: 1 ns
+top.phase_tracer_0: phase callback SC_END_OF_UPDATE: 20 ns -> pending activity: MAX
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+top.phase_tracer_0: [destructor]: 65 callbacks called.
diff --git a/src/systemc/tests/systemc/kernel/phase_callbacks/test05/simulation_callbacks.cpp b/src/systemc/tests/systemc/kernel/phase_callbacks/test05/simulation_callbacks.cpp
new file mode 100644
index 000000000..03dde6ccc
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/phase_callbacks/test05/simulation_callbacks.cpp
@@ -0,0 +1,242 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ simulation_callbacks.cpp -- Test of simulation phase callbacks
+
+ Note: requires simulation phase callback support enabled in the kernel
+ SC_ENABLE_SIMULATION_PHASE_CALLBACKS / --enable-phase-callbacks
+
+ Original Author: Philipp A. Hartmann, OFFIS, 2013-05-17
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include <systemc.h>
+
+#ifdef BENCHMARK
+# include "rusage_timer.h"
+# define ROUNDS 20
+# define NUM_TIMED_TRIGGERS 2000000
+# define NUM_DELTA_TRIGGERS 50
+# define VERBOSE 0
+#else
+# define ROUNDS 2
+# define NUM_TIMED_TRIGGERS 10
+# define NUM_DELTA_TRIGGERS 1
+# define VERBOSE 1
+#endif
+
+#ifndef REGISTER_CALLBACKS
+# define REGISTER_CALLBACKS 1
+#endif
+#ifndef EXTRA_METHOD
+# define EXTRA_METHOD 0
+#endif
+
+#define TIMED_THREAD 1
+
+#if TIMED_THREAD
+# define TIMED_WAIT wait
+# define TIMED_PROCESS SC_THREAD
+#else
+# define TIMED_WAIT next_trigger
+# define TIMED_PROCESS SC_METHOD
+#endif
+
+#if REGISTER_CALLBACKS
+//# define CALLBACK_MASK ( SC_END_OF_EVALUATION )
+//# define CALLBACK_MASK ( SC_END_OF_UPDATE )
+//# define CALLBACK_MASK ( SC_BEFORE_TIMESTEP )
+# define CALLBACK_MASK ( SC_END_OF_UPDATE | SC_BEFORE_TIMESTEP )
+#else
+// SC_RUNNING (for EXTRA_METHOD)
+# define CALLBACK_MASK ( SC_RUNNING )
+#endif
+
+static const sc_dt::uint64 max_rounds = ROUNDS;
+static const sc_dt::uint64 max_timed_triggers = NUM_TIMED_TRIGGERS;
+static const sc_dt::uint64 max_delta_triggers = NUM_DELTA_TRIGGERS;
+static const sc_time delay(1, SC_NS);
+
+SC_MODULE(phase_tracer)
+{
+ SC_HAS_PROCESS(phase_tracer);
+ phase_tracer( sc_module_name = sc_core::sc_gen_unique_name("phase_tracer") )
+ : cb_mask(CALLBACK_MASK), cb_count(0)
+ {
+#if REGISTER_CALLBACKS
+ cb_mask = register_simulation_phase_callback( CALLBACK_MASK );
+#endif
+ }
+
+ virtual void simulation_phase_callback()
+ {
+ cb_count++;
+
+# if VERBOSE
+ {
+ std::string ttp;
+ if( !sc_pending_activity() ) {
+ ttp = "MAX";
+ } else {
+ ttp = sc_time_to_pending_activity().to_string();
+ }
+ std::cout << name()
+ << ": phase callback "
+ << sc_get_status()
+ << ": " << sc_time_stamp()
+ << " -> pending activity: " << ttp
+ << std::endl;
+ }
+# endif
+ sc_assert( cb_mask & sc_get_status() );
+ }
+
+ ~phase_tracer()
+ { print_static_phase_stats( "[destructor]" ); }
+
+ void print_static_phase_stats( const char* phase )
+ {
+#if VERBOSE
+ std::cout << name()
+ << ": " << phase << ": "
+ << cb_count << " callbacks called."
+ << std::endl;
+#endif
+ }
+
+private:
+ unsigned cb_mask;
+ sc_dt::uint64 cb_count;
+};
+
+SC_MODULE(activities)
+{
+ SC_CTOR(activities)
+ : timed_count(), delta_count()
+ {
+ TIMED_PROCESS(timed);
+ sensitive << timed_ev;
+ dont_initialize();
+ SC_METHOD(delta);
+ sensitive << delta_ev;
+ dont_initialize();
+#if EXTRA_METHOD
+ SC_METHOD(extra);
+ sensitive << timed_ev;
+ dont_initialize();
+#endif
+ }
+
+ void notify_round()
+ { timed_ev.notify(SC_ZERO_TIME); }
+
+private:
+ void timed()
+ {
+# if TIMED_THREAD
+ while(1)
+# endif
+ {
+ if( timed_count >= max_timed_triggers ) {
+ timed_count = 0;
+ TIMED_WAIT();
+ } else {
+ verbose();
+ ++timed_count;
+ if( max_delta_triggers )
+ delta_ev.notify(SC_ZERO_TIME);
+ timed_ev.notify(delay);
+ TIMED_WAIT();
+ }
+ }
+ }
+
+ void delta()
+ {
+ ++delta_count;
+ verbose();
+ if( delta_count >= max_delta_triggers ) {
+ delta_count = 0;
+ } else {
+ delta_ev.notify(SC_ZERO_TIME);
+ }
+ }
+
+ void extra()
+ {
+ if( sc_pending_activity_at_current_time() ) {
+ pt.simulation_phase_callback();
+ next_trigger(SC_ZERO_TIME);
+ } else if (sc_time_to_pending_activity()== sc_max_time()-sc_time_stamp() ) {
+ next_trigger();
+ } else {
+ pt.simulation_phase_callback();
+ next_trigger(sc_time_to_pending_activity());
+ }
+ }
+
+ void verbose()
+ {
+#if VERBOSE
+ std::cout
+ << sc_get_current_process_handle().name()
+ << ": " << sc_time_stamp()
+ << ": " << timed_count << "/" << delta_count
+ << std::endl;
+#endif
+ }
+
+private:
+ phase_tracer pt;
+ sc_dt::uint64 timed_count, delta_count;
+ sc_event timed_ev, delta_ev;
+};
+
+
+int sc_main(int, char*[])
+{
+ activities top("top");
+
+ sc_start(SC_ZERO_TIME);
+ for(unsigned i=0; i<max_rounds; ++i)
+ {
+#ifdef BENCHMARK
+ rusage_timer timer;
+#endif
+ top.notify_round();
+ sc_start();
+#ifdef BENCHMARK
+ std::cout << timer.to_seconds() << std::endl;
+#endif
+ }
+ sc_stop();
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/process_control/disable_enable/test1/golden/test1.log b/src/systemc/tests/systemc/kernel/process_control/disable_enable/test1/golden/test1.log
new file mode 100644
index 000000000..a5d597234
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/disable_enable/test1/golden/test1.log
@@ -0,0 +1,29 @@
+SystemC Simulation
+0 s[0]: target_method0: starting
+0 s[0]: target_method0: issuing self disable
+0 s[0]: target_method0: after issuing self disable
+
+0 s[0]: target_thread0: starting
+0 s[0]: target_thread0: issuing self disable
+0 s[0]: target_thread0: after issuing self disable
+
+0 s[1]: target_cthread0: starting
+0 s[1]: target_cthread0: issuing self disable
+0 s[1]: target_cthread0: after issuing self disable
+
+
+10 ns[21]: stimulator: enabling target_cthread0
+
+
+20 ns[51]: stimulator: enabling target_method0
+
+
+30 ns[81]: stimulator: enabling target_thread0
+
+80 ns[231]: target_thread0: terminating
+109 ns[319]: target_cthread0: terminating
+118 ns[346]: target_method0: terminating
+
+1030 ns[3081]: stimulator: terminating
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/process_control/disable_enable/test1/test1.cpp b/src/systemc/tests/systemc/kernel/process_control/disable_enable/test1/test1.cpp
new file mode 100644
index 000000000..62a88b763
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/disable_enable/test1/test1.cpp
@@ -0,0 +1,201 @@
+/*****************************************************************************
+
+ 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 -- test self disables on processes
+//
+// Original Author: Andy Goodrich, Forte Design Systems, Inc.
+//
+// CVS MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+// changes you are making here.
+//
+// $Log: test1.cpp,v $
+// Revision 1.2 2009/07/28 01:09:48 acg
+// Andy Goodrich: replacement test using standardized environment.
+//
+//*****************************************************************************
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include "systemc.h"
+
+enum my_process_states {
+ ST_DISABLED,
+ ST_NORMAL,
+ ST_SUSPENDED
+};
+
+inline ostream& time_stamp( ostream& os )
+{
+ os << dec << sc_time_stamp() << "[" << sc_delta_count() << "]: ";
+ return os;
+}
+
+SC_MODULE(top) {
+ // constructor:
+
+ SC_CTOR(top) :
+ m_state_cthread0(ST_NORMAL),
+ m_state_method0(ST_NORMAL),
+ m_state_thread0(ST_NORMAL)
+ {
+ SC_THREAD(stimulator0);
+
+ SC_CTHREAD( target_cthread0, m_clk.pos() );
+ m_target_cthread0 = sc_get_current_process_handle();
+
+ SC_METHOD(target_method0);
+ sensitive << m_clk.pos();
+ m_target_method0 = sc_get_current_process_handle();
+
+ SC_THREAD(target_thread0);
+ m_target_thread0 = sc_get_current_process_handle();
+ }
+
+ // processes:
+
+ void stimulator0();
+ void target_cthread0();
+ void target_method0();
+ void target_thread0();
+
+ // Storage:
+
+ sc_in<bool> m_clk;
+ int m_state_cthread0;
+ int m_state_method0;
+ int m_state_thread0;
+ sc_process_handle m_target_cthread0;
+ sc_process_handle m_target_method0;
+ sc_process_handle m_target_thread0;
+};
+
+void top::stimulator0()
+{
+ const char* name = "stimulator";
+ wait(10, SC_NS);
+ cout << endl;
+ time_stamp(cout) << name << ": enabling target_cthread0" << endl;
+ cout << endl;
+ m_state_cthread0 = ST_NORMAL;
+ m_target_cthread0.enable();
+ wait(10, SC_NS);
+
+ cout << endl;
+ time_stamp(cout) << name << ": enabling target_method0" << endl;
+ cout << endl;
+ m_state_method0 = ST_NORMAL;
+ m_target_method0.enable();
+ wait(10, SC_NS);
+
+ cout << endl;
+ time_stamp(cout) << name << ": enabling target_thread0" << endl;
+ cout << endl;
+ m_state_thread0 = ST_NORMAL;
+ m_target_thread0.enable();
+ ::sc_core::wait(1000, SC_NS);
+
+ cout << endl;
+ time_stamp(cout) << name << ": terminating" << endl;
+ sc_stop();
+}
+
+void top::target_cthread0()
+{
+ int i;
+ const char* name = "target_cthread0";
+
+ time_stamp(cout) << name << ": starting" << endl;
+ time_stamp(cout) << name << ": issuing self disable" << endl;
+ m_state_cthread0 = ST_DISABLED;
+ m_target_cthread0.disable();
+ time_stamp(cout) << name << ": after issuing self disable" << endl;
+ cout << endl;
+ for ( i = 0; i < 100; i++ )
+ {
+ wait();
+ if ( m_state_cthread0 == ST_DISABLED )
+ {
+ time_stamp(cout) << name << ": ERROR should not see this" << endl;
+ }
+ }
+ time_stamp(cout) << name << ": terminating" << endl;
+}
+
+void top::target_method0()
+{
+ const char* name = "target_method0";
+ static int state = 0;
+ switch( state )
+ {
+ case 0:
+ time_stamp(cout) << name << ": starting" << endl;
+ time_stamp(cout) << name << ": issuing self disable" << endl;
+ m_state_method0 = ST_DISABLED;
+ m_target_method0.disable();
+ time_stamp(cout) << name << ": after issuing self disable" << endl;
+ cout << endl;
+ break;
+ default:
+ if ( m_state_method0 == ST_DISABLED )
+ {
+ time_stamp(cout) << name << ": ERROR should not see this" << endl;
+ }
+ break;
+ case 99:
+ time_stamp(cout) << name << ": terminating" << endl;
+ break;
+ }
+ state++;
+}
+
+void top::target_thread0()
+{
+ const char* name = "target_thread0";
+
+ time_stamp(cout) << name << ": starting" << endl;
+ time_stamp(cout) << name << ": issuing self disable" << endl;
+ m_state_thread0 = ST_DISABLED;
+ m_target_thread0.disable();
+ time_stamp(cout) << name << ": after issuing self disable" << endl;
+ cout << endl;
+
+ // We wait a long enough time that our event will not occur until
+ // after we are re-enabled. Otherwise this thread will just go away
+ // quietly when the disable cancels the event.
+
+ ::sc_core::wait(80, SC_NS);
+ if ( m_state_thread0 == ST_DISABLED )
+ {
+ time_stamp(cout) << name << ": ERROR should not see this" << endl;
+ }
+ time_stamp(cout) << name << ": terminating" << endl;
+}
+
+int sc_main (int argc, char *argv[])
+{
+ sc_clock clock( "clock", 1.0, SC_NS );
+
+ top* top_p = new top("top");
+ top_p->m_clk(clock);
+
+ sc_start();
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/process_control/disable_enable/test2/golden/test2.log b/src/systemc/tests/systemc/kernel/process_control/disable_enable/test2/golden/test2.log
new file mode 100644
index 000000000..6a5b9bd77
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/disable_enable/test2/golden/test2.log
@@ -0,0 +1,84 @@
+SystemC Simulation
+0 s[0]: target_method0: starting
+0 s[0]: target_thread0: starting
+0 s[1]: target_method0: active
+0 s[1]: target_cthread0: starting
+1 ns[3]: target_thread0: active
+
+2 ns[4]: stimulator: disabling target_cthread0
+
+2 ns[5]: target_method0: active
+3 ns[7]: target_thread0: active
+4 ns[9]: target_method0: active
+
+5 ns[10]: stimulator: disabling target_method0
+
+5 ns[11]: target_thread0: active
+7 ns[14]: target_thread0: active
+
+8 ns[15]: stimulator: disabling target_thread0
+
+
+11 ns[18]: stimulator: enabling target_cthread0
+
+12 ns[20]: target_cthread0: active
+
+14 ns[22]: stimulator: enabling target_method0
+
+14 ns[23]: target_method0: active
+14 ns[23]: target_cthread0: active
+16 ns[26]: target_method0: active
+16 ns[26]: target_cthread0: active
+
+17 ns[27]: stimulator: enabling target_thread0
+
+17 ns[28]: target_thread0: active
+18 ns[30]: target_method0: active
+18 ns[30]: target_cthread0: active
+19 ns[32]: target_thread0: active
+
+20 ns[33]: stimulator: disabling target_cthread0
+
+20 ns[34]: target_method0: active
+21 ns[36]: target_thread0: active
+22 ns[38]: target_method0: active
+
+23 ns[39]: stimulator: disabling target_method0
+
+23 ns[40]: target_thread0: active
+25 ns[43]: target_thread0: active
+
+26 ns[44]: stimulator: disabling target_thread0
+
+
+29 ns[47]: stimulator: enabling target_cthread0
+
+30 ns[49]: target_cthread0: active
+
+32 ns[51]: stimulator: enabling target_method0
+
+32 ns[52]: target_method0: active
+32 ns[52]: target_cthread0: active
+34 ns[55]: target_method0: active
+34 ns[55]: target_cthread0: active
+
+35 ns[56]: stimulator: enabling target_thread0
+
+35 ns[57]: target_thread0: active
+35 ns[57]: target_thread0: terminating
+36 ns[59]: target_method0: active
+36 ns[59]: target_cthread0: active
+38 ns[62]: target_method0: active
+38 ns[62]: target_cthread0: active
+40 ns[65]: target_method0: active
+40 ns[65]: target_cthread0: active
+40 ns[65]: target_cthread0: terminating
+42 ns[68]: target_method0: active
+44 ns[71]: target_method0: active
+46 ns[74]: target_method0: active
+48 ns[77]: target_method0: active
+52 ns[83]: target_method0: terminating
+
+1038 ns[1561]: stimulator: terminating
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/process_control/disable_enable/test2/test2.cpp b/src/systemc/tests/systemc/kernel/process_control/disable_enable/test2/test2.cpp
new file mode 100644
index 000000000..f42d9bc98
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/disable_enable/test2/test2.cpp
@@ -0,0 +1,222 @@
+/*****************************************************************************
+
+ 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 -- test that disabled processes with static sensitivity
+// wake up when enabled.
+//
+// Original Author: Andy Goodrich, Forte Design Systems, Inc.
+//
+// CVS MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+// changes you are making here.
+//
+// $Log: test2.cpp,v $
+// Revision 1.2 2009/07/28 01:10:19 acg
+// Andy Goodrich: replacement test using standardized test bench.
+//
+//*****************************************************************************
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include "systemc.h"
+
+enum my_process_states {
+ ST_DISABLED,
+ ST_NORMAL,
+ ST_SUSPENDED
+};
+
+inline ostream& time_stamp( ostream& os )
+{
+ os << dec << sc_time_stamp() << "[" << sc_delta_count() << "]: ";
+ return os;
+}
+
+SC_MODULE(top) {
+ // constructor:
+
+ SC_CTOR(top)
+ {
+ m_state_cthread0 = ST_NORMAL;
+ m_state_method0 = ST_NORMAL;
+ m_state_thread0 = ST_NORMAL;
+
+ SC_THREAD(stimulator0);
+
+ SC_CTHREAD( target_cthread0, m_clk.pos() );
+ m_target_cthread0 = sc_get_current_process_handle();
+
+ SC_METHOD(target_method0);
+ sensitive << m_clk.pos();
+ m_target_method0 = sc_get_current_process_handle();
+
+ SC_THREAD(target_thread0);
+ sensitive << m_clk.neg();
+ m_target_thread0 = sc_get_current_process_handle();
+ }
+
+ // processes:
+
+ void stimulator0();
+ void target_cthread0();
+ void target_method0();
+ void target_thread0();
+
+ // Storage:
+
+ sc_in<bool> m_clk;
+ sc_signal<int> m_state_cthread0;
+ sc_signal<int> m_state_method0;
+ sc_signal<int> m_state_thread0;
+ sc_process_handle m_target_cthread0;
+ sc_process_handle m_target_method0;
+ sc_process_handle m_target_thread0;
+};
+
+#define DISABLE(TARGET) \
+ cout << endl; \
+ time_stamp(cout) << name << ": disabling target_" << #TARGET << endl; \
+ m_state_##TARGET = ST_DISABLED; \
+ m_target_##TARGET.disable(); \
+ cout << endl;
+
+#define ENABLE(TARGET) \
+ cout << endl; \
+ time_stamp(cout) << name << ": enabling target_" << #TARGET << endl; \
+ m_state_##TARGET = ST_NORMAL; \
+ m_target_##TARGET.enable(); \
+ cout << endl;
+
+void top::stimulator0()
+{
+ const char* name = "stimulator";
+
+ wait(2, SC_NS);
+
+ DISABLE(cthread0)
+ wait(3, SC_NS);
+ DISABLE(method0)
+ wait(3, SC_NS);
+ DISABLE(thread0)
+ wait(3, SC_NS);
+
+ ENABLE(cthread0)
+ wait(3, SC_NS);
+ ENABLE(method0)
+ wait(3, SC_NS);
+ ENABLE(thread0)
+ wait(3, SC_NS);
+
+ DISABLE(cthread0)
+ wait(3, SC_NS);
+ DISABLE(method0)
+ wait(3, SC_NS);
+ DISABLE(thread0)
+ wait(3, SC_NS);
+
+ ENABLE(cthread0)
+ wait(3, SC_NS);
+ ENABLE(method0)
+ wait(3, SC_NS);
+ ENABLE(thread0)
+ wait(3, SC_NS);
+
+ ::sc_core::wait(1000, SC_NS);
+ cout << endl;
+ time_stamp(cout) << name << ": terminating" << endl;
+ sc_stop();
+}
+
+void top::target_cthread0()
+{
+ const char* name = "target_cthread0";
+
+ time_stamp(cout) << name << ": starting" << endl;
+ for (int i = 0; i < 10; i++)
+ {
+ wait();
+ if ( m_state_cthread0 == ST_DISABLED )
+ {
+ time_stamp(cout) << name << ": ERROR should not see this" << endl;
+ }
+ else
+ {
+ time_stamp(cout) << name << ": active" << endl;
+ }
+ }
+ time_stamp(cout) << name << ": terminating" << endl;
+}
+
+void top::target_method0()
+{
+ const char* name = "target_method0";
+ static int state = 0;
+ switch( state )
+ {
+ case 0:
+ time_stamp(cout) << name << ": starting" << endl;
+ break;
+ default:
+ if ( m_state_method0 == ST_DISABLED )
+ {
+ time_stamp(cout) << name << ": ERROR should not see this" << endl;
+ }
+ else if ( state < 18 )
+ {
+ time_stamp(cout) << name << ": active" << endl;
+ }
+ break;
+ case 19:
+ time_stamp(cout) << name << ": terminating" << endl;
+ break;
+ }
+ state++;
+}
+
+void top::target_thread0()
+{
+ const char* name = "target_thread0";
+
+ time_stamp(cout) << name << ": starting" << endl;
+ for (int i = 0; i < 10; i++)
+ {
+ wait();
+ if ( m_state_thread0 == ST_DISABLED )
+ {
+ time_stamp(cout) << name << ": ERROR should not see this" << endl;
+ }
+ else
+ {
+ time_stamp(cout) << name << ": active" << endl;
+ }
+ }
+ time_stamp(cout) << name << ": terminating" << endl;
+}
+
+int sc_main (int argc, char *argv[])
+{
+ sc_clock clock( "clock", 2.0, SC_NS );
+
+ top* top_p = new top("top");
+ top_p->m_clk(clock);
+
+ sc_start();
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/process_control/reset/method_reset_throw/golden/sc_method_reset_throw.log b/src/systemc/tests/systemc/kernel/process_control/reset/method_reset_throw/golden/sc_method_reset_throw.log
new file mode 100644
index 000000000..31efd2c64
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/reset/method_reset_throw/golden/sc_method_reset_throw.log
@@ -0,0 +1,7 @@
+SystemC Simulation
+5 ns: reset method m1
+5 ns: in m1
+5 ns: in m1() throwing exception in throwee1
+5 ns: in throwee1, caught exception
+5 ns: in m1() after throwing exception in throwee1
+5 ns: after reset of method m1
diff --git a/src/systemc/tests/systemc/kernel/process_control/reset/method_reset_throw/sc_method_reset_throw.cpp b/src/systemc/tests/systemc/kernel/process_control/reset/method_reset_throw/sc_method_reset_throw.cpp
new file mode 100644
index 000000000..c6596f0c7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/reset/method_reset_throw/sc_method_reset_throw.cpp
@@ -0,0 +1,100 @@
+
+/*****************************************************************************
+
+ The following code is derived, directly or indirectly, from the SystemC
+ source code Copyright (c) 1996-2014 by all Contributors.
+ All Rights reserved.
+
+ The contents of this file are subject to the restrictions and limitations
+ set forth in the SystemC Open Source License (the "License");
+ You may not use this file except in compliance with such restrictions and
+ limitations. You may obtain instructions on how to receive a copy of the
+ License at http://www.accellera.org/. Software distributed by Contributors
+ under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
+ ANY KIND, either express or implied. See the License for the specific
+ language governing rights and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ sc_method_reset_throw.cpp --
+
+ Original Author: Bishnupriya Bhattacharya, Cadence Design Systems, 2012-08-07
+
+ *****************************************************************************/
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include <systemc.h>
+
+class my_exception
+{
+public:
+ explicit my_exception(const char* s) : s_(s) { }
+ const char* message() const { return s_.c_str(); }
+protected:
+ std::string s_;
+};
+
+SC_MODULE(sctop)
+{
+public:
+ SC_CTOR(sctop)
+ {
+ SC_THREAD(run);
+ SC_METHOD(m1); dont_initialize();
+ method_handle = sc_get_current_process_handle();
+ SC_THREAD(throwee1);
+ throwee1_h = sc_get_current_process_handle();
+ }
+
+ void run() {
+ wait (5, SC_NS);
+ cout << sc_time_stamp() << ": reset method m1" << endl;
+ method_handle.reset();
+ cout << sc_time_stamp() << ": after reset of method m1" << endl;
+ }
+
+ void m1()
+ {
+ cout << sc_time_stamp() << ": in m1" << endl;
+ cout << sc_time_stamp() << ": in m1() "
+ << "throwing exception in throwee1" << endl;
+
+ throwee1_h.throw_it(
+ my_exception("thrown in throwee1 from m1()")
+ );
+
+ cout << sc_time_stamp() << ": in m1() "
+ << "after throwing exception in throwee1" << endl;
+ }
+
+ void throwee1()
+ {
+ // catch exception and exit
+ while (1) {
+ try {
+ wait(50, SC_NS);
+ cerr << sc_time_stamp() << ": in throwee1, normal flow" << endl;
+ }
+ catch (my_exception const & x) {
+ cerr << sc_time_stamp() << ": in throwee1, caught exception "
+ << endl;
+ return;
+ }
+ }
+ }
+
+protected:
+ sc_process_handle method_handle;
+ sc_process_handle throwee1_h;
+};
+
+
+int sc_main (int, char*[])
+{
+ sc_report_handler::set_actions( SC_ID_DISABLE_WILL_ORPHAN_PROCESS_, SC_DO_NOTHING );
+ sctop top1("Top1");
+ sc_start(10, SC_NS);
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/process_control/reset/method_self_reset/golden/method_self_reset.log b/src/systemc/tests/systemc/kernel/process_control/reset/method_self_reset/golden/method_self_reset.log
new file mode 100644
index 000000000..f5f0d3ebe
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/reset/method_self_reset/golden/method_self_reset.log
@@ -0,0 +1,14 @@
+SystemC Simulation
+Entry
+Issuing self reset
+Entry
+Exit
+Entry
+Exit
+Entry
+Issuing self reset
+Entry
+Exit
+Entry
+Exit
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/process_control/reset/method_self_reset/method_self_reset.cpp b/src/systemc/tests/systemc/kernel/process_control/reset/method_self_reset/method_self_reset.cpp
new file mode 100644
index 000000000..8b5da09b4
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/reset/method_self_reset/method_self_reset.cpp
@@ -0,0 +1,82 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ method_self_reset.cpp -- Test of method self reset.
+
+ Original Author: Andy Goodrich
+
+ *****************************************************************************/
+// $Log: method_self_reset.cpp,v $
+// Revision 1.4 2011/07/24 15:59:53 acg
+// Andy Goodrich: add statement I missed installing Philipp's patch.
+//
+// Revision 1.3 2011/07/24 15:58:39 acg
+// Philipp A. Hartmann: convert first time toggle to counter since need 3
+// states.
+//
+// Revision 1.2 2011/02/04 15:26:33 acg
+// Andy Goodrich: regolden for proper process control semantics.
+//
+// Revision 1.1 2011/01/28 19:48:36 acg
+// Andy Goodrich: first check in.
+//
+
+#include "systemc.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_METHOD(method);
+ sensitive << m_clk.pos();
+ }
+ void method()
+ {
+ static int trigger = 0;
+ cout << "Entry " << endl;
+ switch( trigger++ )
+ {
+ case 0:
+ cout << "Issuing self reset " << endl;
+ sc_get_current_process_handle().reset();
+ sc_assert( false );
+ case 1:
+ break;
+ default:
+ trigger = 0;
+ }
+ cout << "Exit " << endl;
+ }
+ sc_in<bool> m_clk;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+
+ dut.m_clk(clock);
+
+ sc_start(3, SC_NS);
+
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/process_control/suspend_resume/test1/golden/test1.log b/src/systemc/tests/systemc/kernel/process_control/suspend_resume/test1/golden/test1.log
new file mode 100644
index 000000000..f32038842
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/suspend_resume/test1/golden/test1.log
@@ -0,0 +1,30 @@
+SystemC Simulation
+0 s[0]: target_method0: starting
+0 s[0]: target_method0: issuing self suspend
+0 s[0]: target_method0: after issuing self suspend
+
+0 s[0]: target_thread0: starting
+0 s[0]: target_thread0: issuing self suspend
+
+0 s[1]: target_cthread0: starting
+0 s[1]: target_cthread0: issuing self suspend
+
+
+10 ns[21]: stimulator: resuming target_cthread0
+
+10 ns[21]: target_cthread0: back from self suspend
+
+20 ns[51]: stimulator: resuming target_method0
+
+20 ns[51]: target_method0: back from self suspend
+
+30 ns[81]: stimulator: resuming target_thread0
+
+30 ns[81]: target_thread0: back from self suspend
+109 ns[319]: target_cthread0: terminating
+110 ns[321]: target_thread0: terminating
+117 ns[343]: target_method0: terminating
+
+1030 ns[3081]: stimulator: terminating
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/process_control/suspend_resume/test1/test1.cpp b/src/systemc/tests/systemc/kernel/process_control/suspend_resume/test1/test1.cpp
new file mode 100644
index 000000000..af361436b
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/suspend_resume/test1/test1.cpp
@@ -0,0 +1,216 @@
+/*****************************************************************************
+
+ 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 -- test self suspends on processes
+//
+// Original Author: Andy Goodrich, Forte Design Systems, Inc.
+//
+// CVS MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+// changes you are making here.
+//
+// $Log: test1.cpp,v $
+// Revision 1.4 2011/04/02 00:07:44 acg
+// Andy Goodrich: new message format.
+//
+// Revision 1.3 2011/03/07 19:32:07 acg
+// Andy Goodrich: addition to set sc_core::sc_allow_process_control_corners
+// to true so that this test avoids corner case error messages.
+//
+// Revision 1.2 2009/07/28 18:43:50 acg
+// Andy Goodrich: new standard test bench version of this test.
+//
+// Revision 1.2 2009/07/28 01:09:48 acg
+// Andy Goodrich: replacement test using standardized environment.
+//
+//*****************************************************************************
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include "systemc.h"
+
+enum my_process_states {
+ ST_DISABLED,
+ ST_NORMAL,
+ ST_SUSPENDED
+};
+
+inline ostream& time_stamp( ostream& os )
+{
+ os << dec << sc_time_stamp() << "[" << sc_delta_count() << "]: ";
+ return os;
+}
+
+SC_MODULE(top) {
+ // constructor:
+
+ SC_CTOR(top) :
+ m_state_cthread0(ST_NORMAL),
+ m_state_method0(ST_NORMAL),
+ m_state_thread0(ST_NORMAL)
+ {
+ SC_THREAD(stimulator0);
+
+ SC_CTHREAD( target_cthread0, m_clk.pos() );
+ m_target_cthread0 = sc_get_current_process_handle();
+
+ SC_METHOD(target_method0);
+ sensitive << m_clk.pos();
+ m_target_method0 = sc_get_current_process_handle();
+
+ SC_THREAD(target_thread0);
+ m_target_thread0 = sc_get_current_process_handle();
+ }
+
+ // processes:
+
+ void stimulator0();
+ void target_cthread0();
+ void target_method0();
+ void target_thread0();
+
+ // Storage:
+
+ sc_in<bool> m_clk;
+ int m_state_cthread0;
+ int m_state_method0;
+ int m_state_thread0;
+ sc_process_handle m_target_cthread0;
+ sc_process_handle m_target_method0;
+ sc_process_handle m_target_thread0;
+};
+
+void top::stimulator0()
+{
+ const char* name = "stimulator";
+ wait(10, SC_NS);
+ cout << endl;
+ time_stamp(cout) << name << ": resuming target_cthread0" << endl;
+ cout << endl;
+ m_state_cthread0 = ST_NORMAL;
+ m_target_cthread0.resume();
+ wait(10, SC_NS);
+
+ cout << endl;
+ time_stamp(cout) << name << ": resuming target_method0" << endl;
+ cout << endl;
+ m_state_method0 = ST_NORMAL;
+ m_target_method0.resume();
+ wait(10, SC_NS);
+
+ cout << endl;
+ time_stamp(cout) << name << ": resuming target_thread0" << endl;
+ cout << endl;
+ m_state_thread0 = ST_NORMAL;
+ m_target_thread0.resume();
+ ::sc_core::wait(1000, SC_NS);
+
+ cout << endl;
+ time_stamp(cout) << name << ": terminating" << endl;
+ sc_stop();
+}
+
+void top::target_cthread0()
+{
+ int i;
+ const char* name = "target_cthread0";
+
+ time_stamp(cout) << name << ": starting" << endl;
+ time_stamp(cout) << name << ": issuing self suspend" << endl;
+ cout << endl;
+ m_state_cthread0 = ST_SUSPENDED;
+ m_target_cthread0.suspend();
+ time_stamp(cout) << name << ": back from self suspend" << endl;
+ for ( i = 0; i < 100; i++ )
+ {
+ if ( m_state_cthread0 == ST_SUSPENDED )
+ {
+ time_stamp(cout) << name << ": ERROR should not see this" << endl;
+ }
+ wait();
+ }
+ time_stamp(cout) << name << ": terminating" << endl;
+}
+
+void top::target_method0()
+{
+ const char* name = "target_method0";
+ static int state = 0;
+ switch( state )
+ {
+ case 0:
+ time_stamp(cout) << name << ": starting" << endl;
+ time_stamp(cout) << name << ": issuing self suspend" << endl;
+ m_state_method0 = ST_SUSPENDED;
+ m_target_method0.suspend();
+ time_stamp(cout) << name << ": after issuing self suspend" << endl;
+ cout << endl;
+ break;
+ case 1:
+ time_stamp(cout) << name << ": back from self suspend" << endl;
+ // fall through
+ default:
+ if ( m_state_method0 == ST_SUSPENDED )
+ {
+ time_stamp(cout) << name << ": ERROR should not see this" << endl;
+ }
+ break;
+ case 99:
+ time_stamp(cout) << name << ": terminating" << endl;
+ break;
+ }
+ state++;
+}
+
+void top::target_thread0()
+{
+ const char* name = "target_thread0";
+
+ time_stamp(cout) << name << ": starting" << endl;
+ time_stamp(cout) << name << ": issuing self suspend" << endl;
+ cout << endl;
+ m_state_thread0 = ST_SUSPENDED;
+ m_target_thread0.suspend();
+ time_stamp(cout) << name << ": back from self suspend" << endl;
+
+ // We wait a long enough time that our event will not occur until
+ // after we are resumed. Otherwise this thread will just go away
+ // quietly when the suspend cancels the event.
+
+ ::sc_core::wait(80, SC_NS);
+ if ( m_state_thread0 == ST_SUSPENDED )
+ {
+ time_stamp(cout) << name << ": ERROR should not see this" << endl;
+ }
+ time_stamp(cout) << name << ": terminating" << endl;
+}
+
+int sc_main (int argc, char *argv[])
+{
+ sc_core::sc_allow_process_control_corners = true;
+ sc_clock clock( "clock", 1.0, SC_NS );
+
+ top* top_p = new top("top");
+ top_p->m_clk(clock);
+
+ sc_core::sc_allow_process_control_corners = true;
+ sc_start();
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/process_control/suspend_resume/test2/golden/test2.log b/src/systemc/tests/systemc/kernel/process_control/suspend_resume/test2/golden/test2.log
new file mode 100644
index 000000000..64627e16a
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/suspend_resume/test2/golden/test2.log
@@ -0,0 +1,90 @@
+SystemC Simulation
+0 s[0]: target_method0: starting
+0 s[0]: target_thread0: starting
+0 s[1]: target_method0: active
+0 s[1]: target_cthread0: starting
+1 ns[3]: target_thread0: active
+
+2 ns[4]: stimulator: suspending target_cthread0
+
+2 ns[5]: target_method0: active
+3 ns[7]: target_thread0: active
+4 ns[9]: target_method0: active
+
+5 ns[10]: stimulator: suspending target_method0
+
+5 ns[11]: target_thread0: active
+7 ns[14]: target_thread0: active
+
+8 ns[15]: stimulator: suspending target_thread0
+
+
+11 ns[18]: stimulator: resuming target_cthread0
+
+11 ns[18]: target_cthread0: active
+12 ns[20]: target_cthread0: active
+
+14 ns[22]: stimulator: resuming target_method0
+
+14 ns[22]: target_method0: active
+14 ns[23]: target_method0: active
+14 ns[23]: target_cthread0: active
+16 ns[26]: target_method0: active
+16 ns[26]: target_cthread0: active
+
+17 ns[27]: stimulator: resuming target_thread0
+
+17 ns[27]: target_thread0: active
+17 ns[28]: target_thread0: active
+18 ns[30]: target_method0: active
+18 ns[30]: target_cthread0: active
+19 ns[32]: target_thread0: active
+
+20 ns[33]: stimulator: suspending target_cthread0
+
+20 ns[34]: target_method0: active
+21 ns[36]: target_thread0: active
+22 ns[38]: target_method0: active
+
+23 ns[39]: stimulator: suspending target_method0
+
+23 ns[40]: target_thread0: active
+25 ns[43]: target_thread0: active
+
+26 ns[44]: stimulator: suspending target_thread0
+
+
+29 ns[47]: stimulator: resuming target_cthread0
+
+29 ns[47]: target_cthread0: active
+30 ns[49]: target_cthread0: active
+
+32 ns[51]: stimulator: resuming target_method0
+
+32 ns[51]: target_method0: active
+32 ns[52]: target_method0: active
+32 ns[52]: target_cthread0: active
+34 ns[55]: target_method0: active
+34 ns[55]: target_cthread0: active
+
+35 ns[56]: stimulator: resuming target_thread0
+
+35 ns[56]: target_thread0: active
+35 ns[57]: target_thread0: active
+35 ns[57]: target_thread0: terminating
+36 ns[59]: target_method0: active
+36 ns[59]: target_cthread0: active
+38 ns[62]: target_method0: active
+38 ns[62]: target_cthread0: active
+40 ns[65]: target_method0: active
+40 ns[65]: target_cthread0: active
+40 ns[65]: target_cthread0: terminating
+42 ns[68]: target_method0: active
+44 ns[71]: target_method0: active
+46 ns[74]: target_method0: active
+48 ns[77]: target_method0: active
+52 ns[83]: target_method0: terminating
+
+1038 ns[1561]: stimulator: terminating
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/process_control/suspend_resume/test2/test2.cpp b/src/systemc/tests/systemc/kernel/process_control/suspend_resume/test2/test2.cpp
new file mode 100644
index 000000000..2e4f8997b
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/suspend_resume/test2/test2.cpp
@@ -0,0 +1,237 @@
+/*****************************************************************************
+
+ 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 -- test that suspended processes with static sensitivity
+// wake up when resumed.
+//
+// Original Author: Andy Goodrich, Forte Design Systems, Inc.
+//
+// CVS MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+// changes you are making here.
+//
+// $Log: test2.cpp,v $
+// Revision 1.5 2011/04/02 00:08:19 acg
+// Andy Goodrich: turn off corner case error checking.
+//
+// Revision 1.4 2011/03/07 19:32:09 acg
+// Andy Goodrich: addition to set sc_core::sc_allow_process_control_corners
+// to true so that this test avoids corner case error messages.
+//
+// Revision 1.3 2011/02/20 13:43:49 acg
+// Andy Goodrich: updates for IEEE 1666 2011.
+//
+// Revision 1.2 2011/02/04 15:26:52 acg
+// Andy Goodrich: changes for process control semantics.
+//
+// Revision 1.1 2009/07/28 18:43:55 acg
+// Andy Goodrich: new standard test bench version of this test.
+//
+//*****************************************************************************
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include "systemc.h"
+
+enum my_process_states {
+ ST_SUSPENDD,
+ ST_NORMAL,
+ ST_SUSPENDED
+};
+
+inline ostream& time_stamp( ostream& os )
+{
+ os << dec << sc_time_stamp() << "[" << sc_delta_count() << "]: ";
+ return os;
+}
+
+SC_MODULE(top) {
+ // constructor:
+
+ SC_CTOR(top)
+ {
+ m_state_cthread0 = ST_NORMAL;
+ m_state_method0 = ST_NORMAL;
+ m_state_thread0 = ST_NORMAL;
+
+ SC_THREAD(stimulator0);
+
+ SC_CTHREAD( target_cthread0, m_clk.pos() );
+ m_target_cthread0 = sc_get_current_process_handle();
+
+ SC_METHOD(target_method0);
+ sensitive << m_clk.pos();
+ m_target_method0 = sc_get_current_process_handle();
+
+ SC_THREAD(target_thread0);
+ sensitive << m_clk.neg();
+ m_target_thread0 = sc_get_current_process_handle();
+ }
+
+ // processes:
+
+ void stimulator0();
+ void target_cthread0();
+ void target_method0();
+ void target_thread0();
+
+ // Storage:
+
+ sc_in<bool> m_clk;
+ int m_state_cthread0;
+ int m_state_method0;
+ int m_state_thread0;
+ sc_process_handle m_target_cthread0;
+ sc_process_handle m_target_method0;
+ sc_process_handle m_target_thread0;
+};
+
+#define SUSPEND(TARGET) \
+ cout << endl; \
+ time_stamp(cout) << name << ": suspending target_" << #TARGET << endl; \
+ m_state_##TARGET = ST_SUSPENDD; \
+ m_target_##TARGET.suspend(); \
+ cout << endl;
+
+#define RESUME(TARGET) \
+ cout << endl; \
+ time_stamp(cout) << name << ": resuming target_" << #TARGET << endl; \
+ m_state_##TARGET = ST_NORMAL; \
+ m_target_##TARGET.resume(); \
+ cout << endl;
+
+void top::stimulator0()
+{
+ const char* name = "stimulator";
+
+ wait(2, SC_NS);
+
+ SUSPEND(cthread0)
+ wait(3, SC_NS);
+ SUSPEND(method0)
+ wait(3, SC_NS);
+ SUSPEND(thread0)
+ wait(3, SC_NS);
+
+ RESUME(cthread0)
+ wait(3, SC_NS);
+ RESUME(method0)
+ wait(3, SC_NS);
+ RESUME(thread0)
+ wait(3, SC_NS);
+
+ SUSPEND(cthread0)
+ wait(3, SC_NS);
+ SUSPEND(method0)
+ wait(3, SC_NS);
+ SUSPEND(thread0)
+ wait(3, SC_NS);
+
+ RESUME(cthread0)
+ wait(3, SC_NS);
+ RESUME(method0)
+ wait(3, SC_NS);
+ RESUME(thread0)
+ wait(3, SC_NS);
+
+ ::sc_core::wait(1000, SC_NS);
+ cout << endl;
+ time_stamp(cout) << name << ": terminating" << endl;
+ sc_stop();
+}
+
+void top::target_cthread0()
+{
+ const char* name = "target_cthread0";
+
+ time_stamp(cout) << name << ": starting" << endl;
+ for (int i = 0; i < 12; i++)
+ {
+ wait();
+ if ( m_state_cthread0 == ST_SUSPENDD )
+ {
+ time_stamp(cout) << name << ": ERROR should not see this" << endl;
+ }
+ else
+ {
+ time_stamp(cout) << name << ": active" << endl;
+ }
+ }
+ time_stamp(cout) << name << ": terminating" << endl;
+}
+
+void top::target_method0()
+{
+ const char* name = "target_method0";
+ static int state = 0;
+ switch( state )
+ {
+ case 0:
+ time_stamp(cout) << name << ": starting" << endl;
+ break;
+ default:
+ if ( m_state_method0 == ST_SUSPENDD )
+ {
+ time_stamp(cout) << name << ": ERROR should not see this" << endl;
+ }
+ else if ( state < 20 )
+ {
+ time_stamp(cout) << name << ": active" << endl;
+ }
+ break;
+ case 21:
+ time_stamp(cout) << name << ": terminating" << endl;
+ break;
+ }
+ state++;
+}
+
+void top::target_thread0()
+{
+ const char* name = "target_thread0";
+
+ time_stamp(cout) << name << ": starting" << endl;
+ for (int i = 0; i < 12; i++)
+ {
+ wait();
+ if ( m_state_thread0 == ST_SUSPENDD )
+ {
+ time_stamp(cout) << name << ": ERROR should not see this" << endl;
+ }
+ else
+ {
+ time_stamp(cout) << name << ": active" << endl;
+ }
+ }
+ time_stamp(cout) << name << ": terminating" << endl;
+}
+
+int sc_main (int argc, char *argv[])
+{
+ sc_core::sc_allow_process_control_corners = true;
+ sc_clock clock( "clock", 2.0, SC_NS );
+
+ top* top_p = new top("top");
+ top_p->m_clk(clock);
+
+ sc_core::sc_allow_process_control_corners = true;
+ sc_start();
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/process_control/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/process_control/test01/golden/test01.log
new file mode 100644
index 000000000..824523a11
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test01/golden/test01.log
@@ -0,0 +1,76 @@
+SystemC Simulation
+0 s: dynamic method (75,0) initialization call
+0 s: static method (136)
+0 s: dynamic thread (114) initialization call
+0 s: static method (136)
+0 s: dynamic method (80,1) after wait on m_clk.posedge_event()
+0 s: static thread (145)
+0 s: dynamic thread (119) after wait on m_clk.posedge_event()
+1 ns: static method (136)
+1 ns: dynamic method (86,2) after wait on m_clk.posedge_event()
+1 ns: static thread (145)
+1 ns: cthread (63)
+1 ns: dynamic thread (122) after wait on m_clk.posedge_event()
+1500 ps: dynamic method (92,3) after wait on m_clk.negedge()
+1500 ps: dynamic thread (125) after wait on m_clk.negedge_event()
+2 ns: static method (136)
+2 ns: stimulus (156) - suspending all processes
+
+5 ns: stimulus (171) - resuming all processes
+5 ns: static method (136)
+5 ns: cthread (63)
+5 ns: static thread (145)
+6 ns: static method (136)
+6 ns: stimulus (174) - suspending all processes
+7 ns: stimulus (183) - firing event1
+
+8 ns: stimulus (191) - resuming all processes
+8 ns: static method (136)
+8 ns: cthread (63)
+8 ns: static thread (145)
+9 ns: static method (136)
+9 ns: stimulus (195) - firing event2
+9 ns: static thread (145)
+9 ns: cthread (63)
+9 ns: dynamic method (97,4) after wait on m_event1 & m_event2
+9 ns: dynamic thread (128) after wait on m_event1 & m_event2
+10 ns: static method (136)
+10 ns: dynamic method (80,1) after wait on m_clk.posedge_event()
+10 ns: static thread (145)
+10 ns: cthread (63)
+10 ns: dynamic thread (119) after wait on m_clk.posedge_event()
+11 ns: static method (136)
+11 ns: dynamic method (86,2) after wait on m_clk.posedge_event()
+11 ns: static thread (145)
+11 ns: cthread (63)
+11 ns: dynamic thread (122) after wait on m_clk.posedge_event()
+11500 ps: dynamic method (92,3) after wait on m_clk.negedge()
+11500 ps: dynamic thread (125) after wait on m_clk.negedge_event()
+12 ns: static method (136)
+12 ns: static thread (145)
+12 ns: cthread (63)
+13 ns: static method (136)
+13 ns: static thread (145)
+13 ns: cthread (63)
+14 ns: static method (136)
+14 ns: stimulus (156) - suspending all processes
+
+17 ns: stimulus (171) - resuming all processes
+17 ns: static method (136)
+17 ns: cthread (63)
+17 ns: static thread (145)
+18 ns: static method (136)
+18 ns: stimulus (174) - suspending all processes
+19 ns: stimulus (183) - firing event1
+
+20 ns: stimulus (191) - resuming all processes
+20 ns: static method (136)
+20 ns: cthread (63)
+20 ns: static thread (145)
+21 ns: static method (136)
+21 ns: stimulus (195) - firing event2
+21 ns: static thread (145)
+21 ns: cthread (63)
+21 ns: dynamic method (97,4) after wait on m_event1 & m_event2
+21 ns: dynamic thread (128) after wait on m_event1 & m_event2
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/process_control/test01/test01.cpp b/src/systemc/tests/systemc/kernel/process_control/test01/test01.cpp
new file mode 100644
index 000000000..f391bb75e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test01/test01.cpp
@@ -0,0 +1,260 @@
+/*****************************************************************************
+
+ 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 -- Test of suspend resume on processes
+
+ Original Author: Andy Goodrich
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ Revision log at end of the file to let __LINE__ give the same results
+ after a check-in.
+ *****************************************************************************/
+
+
+#include "systemc.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(cthread,m_clk.pos());
+ SC_METHOD(dynamic_method);
+ SC_THREAD(dynamic_thread);
+ SC_METHOD(static_method);
+ sensitive << m_clk.pos();
+ SC_THREAD(static_thread);
+ sensitive << m_clk.pos();
+ SC_CTHREAD(stimulus,m_clk.pos());
+ reset_signal_is(m_reset, true);
+ }
+ void cthread()
+ {
+ m_cthread = sc_get_current_process_handle();
+ for (;;)
+ {
+ wait();
+ cout << sc_time_stamp() << ": cthread (" << __LINE__ << ")"
+ << endl;
+ }
+ }
+ void dynamic_method()
+ {
+ static int state = 0;
+ switch ( state )
+ {
+ case 0:
+ m_dynamic_method = sc_get_current_process_handle();
+ next_trigger( m_clk.posedge_event() );
+ cout << sc_time_stamp() << ": dynamic method (" << __LINE__
+ << "," << state << ") initialization call " << endl;
+ break;
+ case 1:
+ next_trigger( m_clk.posedge_event() );
+ cout << sc_time_stamp() << ": dynamic method (" << __LINE__
+ << "," << state << ") after wait on m_clk.posedge_event() "
+ << endl;
+ break;
+ case 2:
+ next_trigger( m_clk.negedge_event() );
+ cout << sc_time_stamp() << ": dynamic method (" << __LINE__
+ << "," << state << ") after wait on m_clk.posedge_event() "
+ << endl;
+ break;
+ case 3:
+ next_trigger( m_event1 & m_event2 );
+ cout << sc_time_stamp() << ": dynamic method (" << __LINE__
+ << "," << state << ") after wait on m_clk.negedge() " << endl;
+ break;
+ case 4:
+ next_trigger( m_clk.posedge_event() );
+ cout << sc_time_stamp() << ": dynamic method (" << __LINE__
+ << "," << state << ") after wait on m_event1 & m_event2 "
+ << endl;
+ break;
+ default:
+ next_trigger( m_clk.posedge_event() );
+ cout << sc_time_stamp() << ": dynamic method (" << __LINE__
+ << "," << state << ") after wait on m_clk.posedge_event() "
+ << endl;
+ break;
+ }
+ state = state + 1;
+ if ( state == 5 ) state = 1;
+ }
+ void dynamic_thread()
+ {
+ m_dynamic_thread = sc_get_current_process_handle();
+ cout << sc_time_stamp() << ": dynamic thread (" << __LINE__ << ")"
+ << " initialization call " << endl;
+ wait(m_clk.posedge_event());
+ for (;;)
+ {
+ cout << sc_time_stamp() << ": dynamic thread (" << __LINE__
+ << ") after wait on m_clk.posedge_event() " << endl;
+ wait(m_clk.posedge_event());
+ cout << sc_time_stamp() << ": dynamic thread (" << __LINE__
+ << ") after wait on m_clk.posedge_event() " << endl;
+ wait(m_clk.negedge_event());
+ cout << sc_time_stamp() << ": dynamic thread (" << __LINE__
+ << ") after wait on m_clk.negedge_event() " << endl;
+ wait(m_event1 & m_event2 );
+ cout << sc_time_stamp() << ": dynamic thread (" << __LINE__
+ << ") after wait on m_event1 & m_event2 " << endl;
+ wait(m_clk.posedge_event());
+ }
+ }
+ void static_method()
+ {
+ m_static_method = sc_get_current_process_handle();
+ cout << sc_time_stamp() << ": static method (" << __LINE__ << ")"
+ << endl;
+ }
+ void static_thread()
+ {
+ m_static_thread = sc_get_current_process_handle();
+ for (;;)
+ {
+ wait();
+ cout << sc_time_stamp() << ": static thread (" << __LINE__
+ << ")" << endl;
+ }
+ }
+ void stimulus()
+ {
+ for (;;)
+ {
+ wait();
+ wait();
+ cout << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - suspending all processes" << endl;
+ m_cthread.suspend();
+ m_dynamic_method.suspend();
+ m_dynamic_thread.suspend();
+ m_static_method.suspend();
+ m_static_thread.suspend();
+ wait();
+ wait();
+ wait();
+ m_cthread.resume();
+ m_dynamic_method.resume();
+ m_dynamic_thread.resume();
+ m_static_method.resume();
+ m_static_thread.resume();
+ cout << endl << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - resuming all processes" << endl;
+ wait();
+ cout << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - suspending all processes" << endl;
+ m_cthread.suspend();
+ m_dynamic_method.suspend();
+ m_dynamic_thread.suspend();
+ m_static_method.suspend();
+ m_static_thread.suspend();
+ wait();
+ m_event1.notify(SC_ZERO_TIME);
+ cout << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - firing event1 " << endl;
+ wait();
+ m_cthread.resume();
+ m_dynamic_method.resume();
+ m_dynamic_thread.resume();
+ m_static_method.resume();
+ m_static_thread.resume();
+ cout << endl << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - resuming all processes" << endl;
+ wait();
+ m_event2.notify(SC_ZERO_TIME);
+ cout << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - firing event2 " << endl;
+ wait();
+ wait();
+ wait();
+ }
+ }
+ sc_in<bool> m_clk;
+ sc_process_handle m_cthread;
+ sc_process_handle m_dynamic_method;
+ sc_process_handle m_dynamic_thread;
+ sc_event m_event1;
+ sc_event m_event2;
+ sc_event m_event3;
+ sc_event m_event4;
+ sc_in<bool> m_reset;
+ sc_process_handle m_static_method;
+ sc_process_handle m_static_thread;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_core::sc_allow_process_control_corners = true;
+ sc_clock clock;
+ DUT dut("dut");
+ sc_signal<bool> reset;
+
+ dut.m_clk(clock);
+ dut.m_reset(reset);
+
+ sc_core::sc_allow_process_control_corners = true;
+ reset = true;
+ sc_start(1, SC_NS);
+ reset = false;
+ sc_start(21, SC_NS);
+
+ cout << "Program completed" << endl;
+ return 0;
+}
+
+// $Log: test01.cpp,v $
+// Revision 1.5 2011/04/02 00:08:23 acg
+// Andy Goodrich: turn off corner case error checking.
+//
+// Revision 1.4 2011/03/07 19:32:10 acg
+// Andy Goodrich: addition to set sc_core::sc_allow_process_control_corners
+// to true so that this test avoids corner case error messages.
+//
+// Revision 1.3 2011/02/20 13:43:54 acg
+// Andy Goodrich: updates for IEEE 1666 2011.
+//
+// Revision 1.2 2011/02/14 16:59:58 acg
+// Andy Goodrich: updated copyright and added cvs logging information inline.
+//
+// Revision 1.1.1.1 2006/12/15 20:26:03 acg
+// systemc_tests-2.3
+//
+// Revision 1.1 2006/12/14 21:39:59 acg
+// Andy Goodrich: moving test to new directory.
+//
+// Revision 1.2 2006/04/20 19:43:31 acg
+// Andy Goodrich: moved CVS log to end of file so that __LINE__ does not
+// change when a checkin is done.
+//
+// Revision 1.1 2006/04/17 20:10:55 acg
+// Andy Goodrich: First inclusion of test for suspend and resume support.
+//
diff --git a/src/systemc/tests/systemc/kernel/process_control/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/process_control/test02/golden/test02.log
new file mode 100644
index 000000000..c24196a29
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test02/golden/test02.log
@@ -0,0 +1,24 @@
+SystemC Simulation
+0 s: dynamic method (83,0) initialization call
+0 s: static method (115) initialization call
+0 s: dynamic thread (97) initialization call
+0 s: static thread (126) initialization call
+0 s: dynamic method (90,1) after wait on m_clk.posedge()
+0 s: dynamic thread (100) after wait on m_clk.posedge_event()
+1 ns: clocked thread (72) after wait on m_clk.pos()
+2 ns: stimulus (143) - suspending all processes
+3 ns: stimulus (153) - firing event1
+4 ns: stimulus (157) - firing event2
+
+6 ns: stimulus (167) - resuming all processes
+6 ns: dynamic method (90,1) after wait on m_clk.posedge()
+6 ns: static method (120) after wait on m_event1 | m_event2
+6 ns: clocked thread (72) after wait on m_clk.pos()
+6 ns: dynamic thread (105) after wait on m_event1 & m_event2
+6 ns: static thread (131) after wait on m_event1 | m_event2
+7 ns: clocked thread (72) after wait on m_clk.pos()
+8 ns: clocked thread (72) after wait on m_clk.pos()
+9 ns: clocked thread (72) after wait on m_clk.pos()
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/process_control/test02/test02.cpp b/src/systemc/tests/systemc/kernel/process_control/test02/test02.cpp
new file mode 100644
index 000000000..d770e43a4
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test02/test02.cpp
@@ -0,0 +1,237 @@
+/*****************************************************************************
+
+ 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 -- Test of resume after dynamic event completion
+
+ Original Author: Andy Goodrich
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ Revision log at end of the file to let __LINE__ give the same results
+ after a check-in.
+ *****************************************************************************/
+
+#include "systemc.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(cthread,m_clk.pos());
+ reset_signal_is(m_reset, true);
+ m_cthread = sc_get_current_process_handle();
+
+ SC_METHOD(dynamic_method);
+ m_dynamic_method = sc_get_current_process_handle();
+
+ SC_THREAD(dynamic_thread);
+ m_dynamic_thread = sc_get_current_process_handle();
+
+ SC_METHOD(static_method);
+ sensitive << m_event1 << m_event2;
+ m_static_method = sc_get_current_process_handle();
+
+ SC_THREAD(static_thread);
+ sensitive << m_event1 << m_event2;
+ m_static_thread = sc_get_current_process_handle();
+
+ SC_CTHREAD(stimulus,m_clk.pos());
+ reset_signal_is(m_reset, true);
+ }
+ void cthread()
+ {
+ for (;;)
+ {
+ wait();
+ cout << sc_time_stamp() << ": clocked thread (" << __LINE__
+ << ") after wait on m_clk.pos() " << endl;
+ }
+ }
+ void dynamic_method()
+ {
+ static int state = 0;
+ switch ( state )
+ {
+ case 0:
+ next_trigger( m_clk.posedge_event() );
+ cout << sc_time_stamp() << ": dynamic method (" << __LINE__
+ << "," << state << ") initialization call " << endl;
+ state = 1;
+ break;
+ default:
+ case 1:
+ next_trigger( m_event1 & m_event2 );
+ cout << sc_time_stamp() << ": dynamic method (" << __LINE__
+ << "," << state << ") after wait on m_clk.posedge() " << endl;
+ break;
+ }
+ }
+ void dynamic_thread()
+ {
+ cout << sc_time_stamp() << ": dynamic thread (" << __LINE__ << ")"
+ << " initialization call " << endl;
+ wait(m_clk.posedge_event());
+ cout << sc_time_stamp() << ": dynamic thread (" << __LINE__
+ << ") after wait on m_clk.posedge_event() " << endl;
+ for (;;)
+ {
+ wait(m_event1 & m_event2 );
+ cout << sc_time_stamp() << ": dynamic thread (" << __LINE__
+ << ") after wait on m_event1 & m_event2 " << endl;
+ }
+ }
+ void static_method()
+ {
+ static bool initialized = false;
+ if ( !initialized )
+ {
+ initialized = true;
+ cout << sc_time_stamp() << ": static method (" << __LINE__
+ << ")" << " initialization call " << endl;
+ }
+ else
+ {
+ cout << sc_time_stamp() << ": static method (" << __LINE__
+ << ") after wait on m_event1 | m_event2 " << endl;
+ }
+ }
+ void static_thread()
+ {
+ cout << sc_time_stamp() << ": static thread (" << __LINE__ << ")"
+ << " initialization call " << endl;
+ for (;;)
+ {
+ wait();
+ cout << sc_time_stamp() << ": static thread (" << __LINE__
+ << ") after wait on m_event1 | m_event2 " << endl;
+ }
+
+ }
+ void stimulus()
+ {
+ for (;;)
+ {
+ wait();
+ wait();
+ cout << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - suspending all processes" << endl;
+ m_cthread.suspend();
+ m_dynamic_method.suspend();
+ m_dynamic_thread.suspend();
+ m_static_method.suspend();
+ m_static_thread.suspend();
+ wait();
+
+ m_event1.notify(SC_ZERO_TIME);
+ cout << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - firing event1 " << endl;
+ wait();
+ m_event2.notify(SC_ZERO_TIME);
+ cout << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - firing event2 " << endl;
+ wait();
+ wait();
+
+ m_cthread.resume();
+ m_dynamic_method.resume();
+ m_dynamic_thread.resume();
+ m_static_method.resume();
+ m_static_thread.resume();
+ cout << endl << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - resuming all processes" << endl;
+ wait();
+ wait();
+ wait();
+ sc_stop();
+ }
+ }
+ sc_in<bool> m_clk;
+ sc_process_handle m_cthread;
+ sc_process_handle m_dynamic_method;
+ sc_process_handle m_dynamic_thread;
+ sc_event m_event1;
+ sc_event m_event2;
+ sc_event m_event3;
+ sc_event m_event4;
+ sc_in<bool> m_reset;
+ sc_process_handle m_static_method;
+ sc_process_handle m_static_thread;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_core::sc_allow_process_control_corners = true;
+ sc_clock clock;
+ DUT dut("dut");
+ sc_signal<bool> reset;
+
+ dut.m_clk(clock);
+ dut.m_reset(reset);
+
+ sc_core::sc_allow_process_control_corners = true;
+ reset = true;
+ sc_start(1, SC_NS);
+ reset = false;
+ sc_start(21, SC_NS);
+
+ cout << "Program completed" << endl;
+ return 0;
+}
+
+// $Log: test02.cpp,v $
+// Revision 1.6 2011/04/02 00:08:27 acg
+// Andy Goodrich: turn off corner case error checking.
+//
+// Revision 1.5 2011/03/07 19:32:11 acg
+// Andy Goodrich: addition to set sc_core::sc_allow_process_control_corners
+// to true so that this test avoids corner case error messages.
+//
+// Revision 1.4 2011/02/20 13:43:58 acg
+// Andy Goodrich: updates for IEEE 1666 2011.
+//
+// Revision 1.3 2011/02/14 17:00:00 acg
+// Andy Goodrich: updated copyright and added cvs logging information inline.
+//
+// Revision 1.2 2011/01/20 16:55:23 acg
+// Andy Goodrich: changes for IEEE 1666 2011.
+//
+// Revision 1.1.1.1 2006/12/15 20:26:03 acg
+// systemc_tests-2.3
+//
+// Revision 1.1 2006/12/14 21:40:06 acg
+// Andy Goodrich: moving test to new directory.
+//
+// Revision 1.2 2006/04/20 19:43:34 acg
+// Andy Goodrich: moved CVS log to end of file so that __LINE__ does not
+// change when a checkin is done.
+//
+// Revision 1.1 2006/04/17 20:11:02 acg
+// Andy Goodrich: First inclusion of test for suspend and resume support.
+//
+
diff --git a/src/systemc/tests/systemc/kernel/process_control/test03/golden/test03.log b/src/systemc/tests/systemc/kernel/process_control/test03/golden/test03.log
new file mode 100644
index 000000000..9bb03d038
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test03/golden/test03.log
@@ -0,0 +1,73 @@
+SystemC Simulation
+Status before sc_start(1,SC_NS) = SC_ELABORATION
+0 s dynamic_method_and_events: initialization call
+0 s dynamic_method_negedge: initialization call
+0 s dynamic_method_posedge: initialization call
+Status during sc_start(1,SC_NS) = SC_RUNNING
+0 s: stimulus (205) - disabling all processes
+0 s dynamic_thread_and_events: initialization call
+0 s dynamic_thread_negedge: initialization call
+0 s dynamic_thread_posedge: initialization call
+Status after sc_start(1,SC_NS) = SC_PAUSED
+
+3 ns: stimulus (238) - enabling all processes
+3500 ps dynamic_method_negedge: awakened
+3500 ps dynamic_thread_negedge: awakened
+4 ns: static method awakened
+4 ns dynamic_method_posedge: awakened
+
+4 ns: stimulus (244) - disabling all processes
+4 ns: static thread awakened
+4 ns dynamic_thread_posedge: awakened
+
+5 ns: stimulus (259) - enabling all processes
+5500 ps dynamic_method_negedge: awakened
+5500 ps dynamic_thread_negedge: awakened
+6 ns: static method awakened
+6 ns dynamic_method_posedge: awakened
+
+6 ns: stimulus (273) - firing event1
+6 ns: static thread awakened
+6 ns: cthread awakened
+6 ns dynamic_thread_posedge: awakened
+6500 ps dynamic_method_negedge: awakened
+6500 ps dynamic_thread_negedge: awakened
+7 ns: static method awakened
+7 ns dynamic_method_posedge: awakened
+
+7 ns: stimulus (278) - disabling all processes
+7 ns: static thread awakened
+7 ns: cthread awakened
+7 ns dynamic_thread_posedge: awakened
+
+8 ns: stimulus (295) - firing event2
+
+11 ns: stimulus (303) - enabling all processes
+11500 ps dynamic_method_negedge: awakened
+11500 ps dynamic_thread_negedge: awakened
+12 ns: static method awakened
+12 ns dynamic_method_posedge: awakened
+
+12 ns: stimulus (317) - firing event2
+12 ns: static thread awakened
+12 ns: cthread awakened
+12 ns dynamic_thread_posedge: awakened
+12 ns dynamic_method_and_events: awakened
+12 ns dynamic_thread_and_events: awakened
+12500 ps dynamic_method_negedge: awakened
+12500 ps dynamic_thread_negedge: awakened
+13 ns: static method awakened
+13 ns dynamic_method_posedge: awakened
+13 ns: static thread awakened
+13 ns: cthread awakened
+13 ns dynamic_thread_posedge: awakened
+13500 ps dynamic_method_negedge: awakened
+13500 ps dynamic_thread_negedge: awakened
+14 ns: static method awakened
+14 ns dynamic_method_posedge: awakened
+14 ns: static thread awakened
+14 ns: cthread awakened
+14 ns dynamic_thread_posedge: awakened
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/process_control/test03/test03.cpp b/src/systemc/tests/systemc/kernel/process_control/test03/test03.cpp
new file mode 100644
index 000000000..45e84c828
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test03/test03.cpp
@@ -0,0 +1,385 @@
+/*****************************************************************************
+
+ 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 -- Test of disable enable on processes
+
+ Original Author: Andy Goodrich
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ Revision log at end of the file to let __LINE__ give the same results
+ after a check-in.
+ *****************************************************************************/
+
+
+#include "systemc.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(cthread,m_clk.pos());
+ m_cthread = sc_get_current_process_handle();
+ SC_METHOD(dynamic_method_and_events);
+
+ m_dynamic_method_and_events = sc_get_current_process_handle();
+ SC_METHOD(dynamic_method_negedge);
+ m_dynamic_method_negedge = sc_get_current_process_handle();
+ SC_METHOD(dynamic_method_posedge);
+ m_dynamic_method_posedge = sc_get_current_process_handle();
+
+ SC_THREAD(dynamic_thread_and_events);
+ m_dynamic_thread_and_events = sc_get_current_process_handle();
+ SC_THREAD(dynamic_thread_negedge);
+ m_dynamic_thread_negedge = sc_get_current_process_handle();
+ SC_THREAD(dynamic_thread_posedge);
+ m_dynamic_thread_posedge = sc_get_current_process_handle();
+
+ SC_METHOD(static_method);
+ sensitive << m_clk.pos();
+ dont_initialize();
+ m_static_method = sc_get_current_process_handle();
+ SC_THREAD(static_thread);
+ sensitive << m_clk.pos();
+ m_static_thread = sc_get_current_process_handle();
+ SC_METHOD(stimulus_method);
+
+ SC_CTHREAD(stimulus,m_clk.pos());
+ reset_signal_is(m_reset, true);
+ }
+
+ void cthread()
+ {
+ for (;;)
+ {
+ wait();
+ cout << sc_time_stamp() << ": cthread awakened" << endl;
+ }
+ }
+
+ // dynamic_method_and_events - dynamic method waiting on the and of
+ // two events:
+
+ void dynamic_method_and_events()
+ {
+ static int state = 0;
+ switch( state )
+ {
+ case 0:
+ cout << sc_time_stamp()
+ << " dynamic_method_and_events: initialization call" << endl;
+ break;
+ case 1:
+ cout << sc_time_stamp() << " dynamic_method_and_events: awakened"
+ << endl;
+ break;
+ }
+ next_trigger( m_event1 & m_event2 );
+ state = 1;
+ }
+
+ // dynamic_method_negedge - dynamic method waiting on negedge events:
+
+ void dynamic_method_negedge()
+ {
+ static int state = 0;
+ switch( state )
+ {
+ case 0:
+ cout << sc_time_stamp()
+ << " dynamic_method_negedge: initialization call" << endl;
+ break;
+ case 1:
+ cout << sc_time_stamp() << " dynamic_method_negedge: awakened"
+ << endl;
+ break;
+ }
+ next_trigger( m_clk.negedge_event() );
+ state = 1;
+ }
+
+ // dynamic_method_posedge - dynamic method waiting on posedge events:
+
+ void dynamic_method_posedge()
+ {
+ static int state = 0;
+ switch( state )
+ {
+ case 0:
+ cout << sc_time_stamp()
+ << " dynamic_method_posedge: initialization call" << endl;
+ break;
+ default:
+ cout << sc_time_stamp() << " dynamic_method_posedge: awakened"
+ << endl;
+ }
+ next_trigger( m_clk.posedge_event() );
+ state = 1;
+ }
+
+ // dynamic_thread_and_events - dynamic thread waiting on the and of
+ // two events:
+
+ void dynamic_thread_and_events()
+ {
+ cout << sc_time_stamp()
+ << " dynamic_thread_and_events: initialization call" << endl;
+ for (;;)
+ {
+ wait( m_event1 & m_event2 );
+ cout << sc_time_stamp() << " dynamic_thread_and_events: awakened"
+ << endl;
+ }
+ }
+
+ // dynamic_thread_negedge - dynamic thread waiting on negedge events:
+
+ void dynamic_thread_negedge()
+ {
+ cout << sc_time_stamp()
+ << " dynamic_thread_negedge: initialization call" << endl;
+ for (;;)
+ {
+ wait( m_clk.negedge_event() );
+ cout << sc_time_stamp() << " dynamic_thread_negedge: awakened"
+ << endl;
+ }
+ }
+
+ // dynamic_thread_posedge - dynamic thread waiting on posedge events:
+
+ void dynamic_thread_posedge()
+ {
+ cout << sc_time_stamp()
+ << " dynamic_thread_posedge: initialization call" << endl;
+ for (;;)
+ {
+ wait( m_clk.posedge_event() );
+ cout << sc_time_stamp() << " dynamic_thread_posedge: awakened"
+ << endl;
+ }
+ }
+
+ void static_method()
+ {
+ cout << sc_time_stamp() << ": static method awakened" << endl;
+ }
+ void static_thread()
+ {
+ for (;;)
+ {
+ wait();
+ cout << sc_time_stamp() << ": static thread awakened" << endl;
+ }
+ }
+ void stimulus_method()
+ {
+ cout << "Status during sc_start(1,SC_NS) = " << sc_get_status() << endl;
+ cout << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - disabling all processes" << endl;
+ m_cthread.disable();
+ m_dynamic_method_and_events.disable();
+ m_dynamic_method_negedge.disable();
+ m_dynamic_method_posedge.disable();
+ m_dynamic_thread_and_events.disable();
+ m_dynamic_thread_negedge.disable();
+ m_dynamic_thread_posedge.disable();
+ m_static_method.disable();
+ m_static_thread.disable();
+ }
+ void stimulus()
+ {
+ for (;;)
+ {
+ // START OUT BY WAITING ON THE DISABLE FROM THE stimulus_method.
+
+ wait();
+ wait();
+ wait();
+
+ // PROCEED WITH AN ENABLE ON EVERYONE - EXPECTING posedge WAKES:
+
+ m_cthread.enable();
+ m_dynamic_method_and_events.enable();
+ m_dynamic_method_negedge.enable();
+ m_dynamic_method_posedge.enable();
+ m_dynamic_thread_and_events.enable();
+ m_dynamic_thread_negedge.enable();
+ m_dynamic_thread_posedge.enable();
+ m_static_method.enable();
+ m_static_thread.enable();
+ cout << endl << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - enabling all processes" << endl;
+ wait();
+
+ // DISABLE EVERYONE AGAIN:
+
+ cout << endl << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - disabling all processes" << endl;
+ m_cthread.disable();
+ m_dynamic_method_and_events.disable();
+ m_dynamic_method_negedge.disable();
+ m_dynamic_method_posedge.disable();
+ m_dynamic_thread_and_events.disable();
+ m_dynamic_thread_negedge.disable();
+ m_dynamic_thread_posedge.disable();
+ m_static_method.disable();
+ m_static_thread.disable();
+ wait();
+
+ // PROCEED WITH AN ENABLE ON EVERYONE - EXPECTING negedge WAKES:
+
+ cout << endl << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - enabling all processes" << endl;
+ m_cthread.enable();
+ m_dynamic_method_and_events.enable();
+ m_dynamic_method_negedge.enable();
+ m_dynamic_method_posedge.enable();
+ m_dynamic_thread_and_events.enable();
+ m_dynamic_thread_negedge.enable();
+ m_dynamic_thread_posedge.enable();
+ m_static_method.enable();
+ m_static_thread.enable();
+ wait();
+
+ // FIRE OFF EVENT 1:
+ cout << endl << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - firing event1 " << endl;
+ m_event1.notify(SC_ZERO_TIME);
+ wait();
+
+ cout << endl << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - disabling all processes" << endl;
+ m_cthread.disable();
+ m_dynamic_method_and_events.disable();
+ m_dynamic_method_negedge.disable();
+ m_dynamic_method_posedge.disable();
+ m_dynamic_thread_and_events.disable();
+ m_dynamic_thread_negedge.disable();
+ m_dynamic_thread_posedge.disable();
+ m_static_method.disable();
+ m_static_thread.disable();
+ wait();
+
+
+ // FIRE OFF EVENT 2: WITH EVERYONE DISABLED:
+
+ m_event2.notify(SC_ZERO_TIME);
+ cout << endl << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - firing event2 " << endl;
+ wait();
+ wait();
+ wait();
+
+ // FIRE OFF EVENT 2: WITH EVERYONE ENABLED:
+
+ cout << endl << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - enabling all processes" << endl;
+ m_cthread.enable();
+ m_dynamic_method_and_events.enable();
+ m_dynamic_method_negedge.enable();
+ m_dynamic_method_posedge.enable();
+ m_dynamic_thread_and_events.enable();
+ m_dynamic_thread_negedge.enable();
+ m_dynamic_thread_posedge.enable();
+ m_static_method.enable();
+ m_static_thread.enable();
+ wait();
+
+ m_event2.notify(SC_ZERO_TIME);
+ cout << endl << sc_time_stamp() << ": stimulus ("
+ << __LINE__ << ") - firing event2 " << endl;
+ wait();
+ wait();
+ sc_stop();
+ }
+ }
+ sc_in<bool> m_clk;
+ sc_process_handle m_cthread;
+ sc_process_handle m_dynamic_method_and_events;
+ sc_process_handle m_dynamic_method_negedge;
+ sc_process_handle m_dynamic_method_posedge;
+ sc_process_handle m_dynamic_thread_and_events;
+ sc_process_handle m_dynamic_thread_negedge;
+ sc_process_handle m_dynamic_thread_posedge;
+ sc_event m_event1;
+ sc_event m_event2;
+ sc_event m_event3;
+ sc_event m_event4;
+ sc_in<bool> m_reset;
+ sc_process_handle m_static_method;
+ sc_process_handle m_static_thread;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+ sc_signal<bool> reset;
+
+ dut.m_clk(clock);
+ dut.m_reset(reset);
+
+ reset = true;
+ cout << "Status before sc_start(1,SC_NS) = " << sc_get_status() << endl;
+ sc_start(1, SC_NS);
+ cout << "Status after sc_start(1,SC_NS) = " << sc_get_status() << endl;
+ reset = false;
+ sc_start();
+
+ cout << "Program completed" << endl;
+ return 0;
+}
+
+// $Log: test03.cpp,v $
+// Revision 1.5 2011/02/20 13:44:06 acg
+// Andy Goodrich: updates for IEEE 1666 2011.
+//
+// Revision 1.4 2011/02/14 17:00:00 acg
+// Andy Goodrich: updated copyright and added cvs logging information inline.
+//
+// Revision 1.3 2011/01/14 14:23:58 acg
+// Andy Goodrich: Fixes for 1666_2011
+//
+// Revision 1.2 2009/05/22 16:07:26 acg
+// Andy Goodrich: process control updates.
+//
+// Revision 1.1.1.1 2006/12/15 20:26:03 acg
+// systemc_tests-2.3
+//
+// Revision 1.1 2006/12/14 21:40:10 acg
+// Andy Goodrich: moving test to new directory.
+//
+// Revision 1.2 2006/04/20 19:43:31 acg
+// Andy Goodrich: moved CVS log to end of file so that __LINE__ does not
+// change when a checkin is done.
+//
+// Revision 1.1 2006/04/17 20:10:55 acg
+// Andy Goodrich: First inclusion of test for suspend and resume support.
+//
diff --git a/src/systemc/tests/systemc/kernel/process_control/test04/golden/test04.log b/src/systemc/tests/systemc/kernel/process_control/test04/golden/test04.log
new file mode 100644
index 000000000..e6b84c69a
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test04/golden/test04.log
@@ -0,0 +1,20 @@
+SystemC Simulation
+0 s:slave - in reset
+1 ns:slave - self-suspend...
+3 ns:master - resuming slave
+3 ns:slave - ... resumed
+4 ns:slave - self-disable ...
+4 ns:slave - ... executing ...
+6 ns:master - enabling slave
+7 ns:slave - ... enabled
+7 ns:master - sync reset on slave
+8 ns:slave - in reset
+9 ns:slave - in reset
+10 ns:slave - in reset
+10 ns:master - sync reset off slave
+11 ns:slave - self-suspend...
+13 ns:master - async reset on slave
+13 ns:slave - in reset
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/process_control/test04/test04.cpp b/src/systemc/tests/systemc/kernel/process_control/test04/test04.cpp
new file mode 100644
index 000000000..c8e744c2b
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test04/test04.cpp
@@ -0,0 +1,137 @@
+/*****************************************************************************
+
+ 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 -- Test of interaction of suspend-resume, disable-enable, and
+ resets on processes
+
+ Original Author: Andy Goodrich
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ Revision log at end of the file to let __LINE__ give the same results
+ after a check-in.
+ *****************************************************************************/
+// $Log: test04.cpp,v $
+// Revision 1.5 2011/04/02 00:08:29 acg
+// Andy Goodrich: turn off corner case error checking.
+//
+// Revision 1.4 2011/03/07 19:32:14 acg
+// Andy Goodrich: addition to set sc_core::sc_allow_process_control_corners
+// to true so that this test avoids corner case error messages.
+//
+// Revision 1.3 2011/02/14 17:00:00 acg
+// Andy Goodrich: updated copyright and added cvs logging information inline.
+//
+
+#include "systemc.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(master,m_clk.pos());
+ SC_CTHREAD(slave,m_clk.pos());
+ }
+ void slave()
+ {
+ m_handle0 = sc_get_current_process_handle();
+ cout << sc_time_stamp() << ":slave - in reset" << endl;
+ for (;;)
+ {
+ wait();
+ cout << sc_time_stamp() << ":slave - self-suspend..." << endl;
+ m_handle0.suspend();
+ cout << sc_time_stamp() << ":slave - ... resumed" << endl;
+ wait();
+ cout << sc_time_stamp() << ":slave - self-disable ..." << endl;
+ m_handle0.disable();
+ cout << sc_time_stamp() << ":slave - ... executing ..." << endl;
+ wait();
+ cout << sc_time_stamp() << ":slave - ... enabled" << endl;
+ wait();
+ wait();
+ wait();
+ }
+ }
+ void master()
+ {
+ m_handle1 = sc_get_current_process_handle();
+ for (;;)
+ {
+ wait();
+ wait();
+ wait();
+ cout << sc_time_stamp()
+ << ":master - resuming slave" << endl;
+ m_handle0.resume();
+ wait();
+ wait();
+ wait();
+ cout << sc_time_stamp()
+ << ":master - enabling slave" << endl;
+ m_handle0.enable();
+ wait();
+ cout << sc_time_stamp()
+ << ":master - sync reset on slave" << endl;
+ m_handle0.sync_reset_on();
+ wait();
+ wait();
+ wait();
+ cout << sc_time_stamp()
+ << ":master - sync reset off slave" << endl;
+ m_handle0.sync_reset_off();
+ wait();
+ wait();
+ wait();
+ cout << sc_time_stamp()
+ << ":master - async reset on slave" << endl;
+ m_handle0.reset();
+ wait(20);
+ sc_stop();
+ }
+ }
+ sc_in<bool> m_clk;
+ sc_process_handle m_handle0;
+ sc_process_handle m_handle1;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_core::sc_allow_process_control_corners = true;
+ sc_clock clock;
+ DUT dut("dut");
+
+ dut.m_clk(clock);
+
+ sc_core::sc_allow_process_control_corners = true;
+ sc_start();
+
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/process_control/test05/golden/test05.log b/src/systemc/tests/systemc/kernel/process_control/test05/golden/test05.log
new file mode 100644
index 000000000..dd5bbfcbb
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test05/golden/test05.log
@@ -0,0 +1,10 @@
+SystemC Simulation
+3 ns throwing my exception
+3 ns caught my exception
+4 ns throwing my exception
+4 ns caught my exception
+4 ns throwing your exception
+4 ns caught your exception
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/process_control/test05/test05.cpp b/src/systemc/tests/systemc/kernel/process_control/test05/test05.cpp
new file mode 100644
index 000000000..5fe76c345
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test05/test05.cpp
@@ -0,0 +1,112 @@
+/*****************************************************************************
+
+ 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 -- Test user exception throws.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 15 December 2006
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: test05.cpp,v $
+// Revision 1.3 2011/02/14 17:00:00 acg
+// Andy Goodrich: updated copyright and added cvs logging information inline.
+//
+
+#include "systemc.h"
+
+class my_exception {};
+class your_exception {};
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(thread,m_clk.pos());
+ SC_THREAD(monitor);
+ }
+ void monitor()
+ {
+ m_monitor_handle = sc_get_current_process_handle();
+ for (;;)
+ {
+ try
+ {
+ wait(m_never_event);
+ }
+ catch (my_exception& except)
+ {
+ cout << sc_time_stamp() << " caught my exception " << endl;
+ }
+ catch (your_exception& except)
+ {
+ cout << sc_time_stamp() << " caught your exception " << endl;
+ }
+ }
+ }
+ void thread()
+ {
+ my_exception exception;
+ your_exception other_exception;
+ for (;;)
+ {
+ wait(3);
+ cout << sc_time_stamp() << " throwing my exception " << endl;
+ m_monitor_handle.throw_it(exception);
+ wait();
+
+ // test that both exceptions appear.
+
+ cout << sc_time_stamp() << " throwing my exception " << endl;
+ m_monitor_handle.throw_it(exception);
+ cout << sc_time_stamp() << " throwing your exception " << endl;
+ m_monitor_handle.throw_it(other_exception);
+ wait();
+ wait();
+ sc_stop();
+ }
+ }
+ sc_in<bool> m_clk;
+ sc_process_handle m_monitor_handle;
+ sc_event m_never_event;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+
+ dut.m_clk(clock);
+
+ sc_start();
+
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/process_control/test06/golden/test06.log b/src/systemc/tests/systemc/kernel/process_control/test06/golden/test06.log
new file mode 100644
index 000000000..01aaf232f
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test06/golden/test06.log
@@ -0,0 +1,21 @@
+SystemC Simulation
+top.parent.method_0 triggered (0 s @ 1)
+top.parent.thread_0 triggered (0 s @ 1)
+top.parent.method_0.thread_0 triggered (0 s @ 1)
+top.parent.thread_0.method_0 triggered (0 s @ 1)
+top.parent.method_0.thread_0.method_0 triggered (0 s @ 1)
+top.parent.thread_0.method_0.thread_0 triggered (0 s @ 1)
+top.parent.method_0.thread_0.method_0 triggered (10 ns @ 4)
+top.parent.thread_0.method_0 triggered (10 ns @ 4)
+top.parent.method_0 triggered (10 ns @ 4)
+top.parent.thread_0.method_0.thread_0 triggered (10 ns @ 4)
+top.parent.method_0.thread_0 triggered (10 ns @ 4)
+top.parent.thread_0 triggered (10 ns @ 4)
+top.parent.thread_0 kill requested (sc_thread_process) (10 ns @ 4)
+top.parent.thread_0.method_0.thread_0 local deleted (10 ns @ 4)
+top.parent.thread_0 local deleted (10 ns @ 4)
+top.parent.method_0 kill requested (sc_method_process) (10 ns @ 4)
+top.parent.method_0.thread_0 local deleted (10 ns @ 4)
+top.parent ended (20 ns @ 7)
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/process_control/test06/test06.cpp b/src/systemc/tests/systemc/kernel/process_control/test06/test06.cpp
new file mode 100644
index 000000000..616e3acf7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test06/test06.cpp
@@ -0,0 +1,130 @@
+//----------------------------------------------------------------------
+// Copyright 2009 Cadence Design Systems, Inc.
+// All Rights Reserved Worldwide
+// Copyright 2009 Forte Design Systems, Inc.
+// Copyright 2010 OFFIS Institute for Information technology
+//
+// test06: test hierarchical kills
+//----------------------------------------------------------------------
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include <systemc.h>
+
+SC_MODULE(top) {
+public:
+ SC_CTOR(top) {
+ SC_THREAD(parent);
+ sensitive << clk.pos();
+ dont_initialize();
+ }
+
+ void proc_tree( unsigned depth, unsigned width, bool as_method, bool spawn_only )
+ {
+ unsigned w = width;
+ if (sc_time_stamp() == SC_ZERO_TIME || spawn_only )
+ while( depth && w --> 0 )
+ {
+ sc_spawn_options sp;
+ sp.set_sensitivity( &clk.pos() );
+
+ if(as_method) // we are spawned as method, spawn a thread
+ {
+ sc_spawn( sc_bind( &top::proc_tree, this, depth-1, width, !as_method, false )
+ , sc_gen_unique_name("thread"), &sp );
+ }
+ else // we are spawned as thread, spawn a method
+ {
+ sp.spawn_method();
+ sc_spawn( sc_bind( &top::proc_tree, this, depth-1, width, !as_method, false )
+ , sc_gen_unique_name("method"), &sp );
+ }
+ }
+
+ if(spawn_only) return;
+
+ std::cout << sc_get_current_process_handle().name()
+ << " triggered "
+ << "(" << sc_time_stamp() << " @ " << sc_delta_count() << ")"
+ << std::endl;
+
+ // start thread
+ if( !as_method ) thread_loop();
+ }
+
+ void thread_loop()
+ {
+ struct local_ {
+ ~local_(){
+ std::cout
+ << sc_get_current_process_handle().name()
+ << " local deleted "
+ << "(" << sc_time_stamp() << " @ " << sc_delta_count() << ")"
+ << std::endl;
+ }
+ } l; l=l;
+
+ unsigned rounds = 5;
+ while( rounds --> 0 )
+ {
+ wait();
+ std::cout << sc_get_current_process_handle().name()
+ << " triggered "
+ << "(" << sc_time_stamp() << " @ " << sc_delta_count() << ")"
+ << std::endl;
+ }
+ std::cout << sc_get_current_process_handle().name()
+ << " ended "
+ << "(" << sc_time_stamp() << " @ " << sc_delta_count() << ")"
+ << std::endl;
+ }
+
+ void parent()
+ {
+ proc_tree( 3, 1, true , true );
+ proc_tree( 3, 1, false, true );
+
+ wait();
+
+ // copy children (needed, since children may get reordered)
+ std::vector< sc_object* > children =
+ sc_get_current_process_handle().get_child_objects();
+
+ std::vector< sc_object* >::const_iterator it = children.begin();
+
+ while( it != children.end() )
+ {
+ sc_process_handle h( *it++ );
+ sc_assert( h.valid() );
+
+ std::cout << h.name() << " "
+ << "kill requested "
+ << "(" << h.get_process_object()->kind() << ") "
+ << "(" << sc_time_stamp() << " @ " << sc_delta_count() << ")"
+ << std::endl;
+
+ h.kill( SC_INCLUDE_DESCENDANTS );
+ }
+
+ wait();
+
+ std::cout << sc_get_current_process_handle().name()
+ << " ended "
+ << "(" << sc_time_stamp() << " @ " << sc_delta_count() << ")"
+ << std::endl;
+
+ wait();
+ sc_stop();
+ while(true) wait();
+ }
+
+ sc_in<bool> clk;
+};
+
+int sc_main (int argc, char *argv[])
+{
+ sc_clock clk("clk", 10, SC_NS, 0.5);
+ top t("top");
+ t.clk(clk);
+ sc_start();
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/process_control/test07/golden/test07.log b/src/systemc/tests/systemc/kernel/process_control/test07/golden/test07.log
new file mode 100644
index 000000000..015022982
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test07/golden/test07.log
@@ -0,0 +1,90 @@
+SystemC Simulation
+------ (50 ns) ------
+ dut (sc_module)
+ dut.parent (sc_thread_process) (running)
+----------------------
++++ dut.parent.child0 starting (50 ns)
++++ dut.parent.child1 starting (50 ns)
+------ (100 ns) ------
+ dut (sc_module)
+ dut.parent (sc_thread_process) (running)
+ dut.parent.child0 (sc_thread_process) (running)
+ dut.parent.child0.local (sc_object)
+ dut.parent.child1 (sc_thread_process) (running)
+ dut.parent.child1.local (sc_object)
+ dut.parent.child1.dyn_obj (sc_object)
+----------------------
++++ dut.parent.child1.grandchild starting (150 ns)
++++ dut.parent.child0.grandchild starting (150 ns)
+------ (200 ns) ------
+ dut (sc_module)
+ dut.parent (sc_thread_process) (running)
+ dut.parent.child0 (sc_thread_process) (running)
+ dut.parent.child0.local (sc_object)
+ dut.parent.child0.grandchild (sc_thread_process) (running)
+ dut.parent.child0.grandchild.local (sc_object)
+ dut.parent.child1 (sc_thread_process) (running)
+ dut.parent.child1.local (sc_object)
+ dut.parent.child1.dyn_obj (sc_object)
+ dut.parent.child1.grandchild (sc_thread_process) (running)
+ dut.parent.child1.grandchild.local (sc_object)
+----------------------
++++ dut.parent.child1 exiting (250 ns)
++++ dut.parent.child1.local deleted
++++ dut.parent.child0 exiting (250 ns)
++++ dut.parent.child0.local deleted
+------ (300 ns) ------
+ dut (sc_module)
+ dut.parent (sc_thread_process) (running)
+ dut.parent.child0 (sc_thread_process) (terminated)
+ dut.parent.child0.grandchild (sc_thread_process) (running)
+ dut.parent.child0.grandchild.local (sc_object)
+ dut.parent.child1 (sc_thread_process) (terminated)
+ dut.parent.child1.grandchild (sc_thread_process) (running)
+ dut.parent.child1.grandchild.local (sc_object)
+ dut.parent.child1.dyn_obj (sc_object)
+----------------------
++++ dut.parent.child1.grandchild exiting (350 ns)
++++ dut.parent.child1.grandchild.local deleted
++++ dut.parent.child0.grandchild exiting (350 ns)
++++ dut.parent.child0.grandchild.local deleted
+------ (400 ns) ------
+ dut (sc_module)
+ dut.parent (sc_thread_process) (running)
+ dut.parent.child1 (sc_thread_process) (terminated)
+ dut.parent.child1.dyn_obj (sc_object)
+----------------------
++++ dut.parent.child1.dyn_obj deleted
+------ (500 ns) ------
+ dut (sc_module)
+ dut.parent (sc_thread_process) (running)
+----------------------
++++ dut.parent.child0 starting (500 ns)
++++ dut.parent.child1 starting (500 ns)
+------ (600 ns) ------
+ dut (sc_module)
+ dut.parent (sc_thread_process) (running)
+ dut.parent.child0 (sc_thread_process) (running)
+ dut.parent.child0.local (sc_object)
+ dut.parent.child1 (sc_thread_process) (running)
+ dut.parent.child1.local (sc_object)
+----------------------
++++ dut.parent.child1.grandchild starting (600 ns)
++++ dut.parent.child0.grandchild starting (600 ns)
++++ dut.parent.child0.local deleted
++++ dut.parent.child1.grandchild.local deleted
++++ dut.parent.child1.local deleted
++++ kills sent ... (650 ns)
+------ (700 ns) ------
+ dut (sc_module)
+ dut.parent (sc_thread_process) (running)
+ dut.parent.child0 (sc_thread_process) (terminated)
+ dut.parent.child0.grandchild (sc_thread_process) (running)
+ dut.parent.child0.grandchild.local (sc_object)
+----------------------
++++ dut.parent exiting (700 ns)
++++ dut.parent.child0.grandchild exiting (800 ns)
++++ dut.parent.child0.grandchild.local deleted
+------ (900 ns) ------
+ dut (sc_module)
+----------------------
diff --git a/src/systemc/tests/systemc/kernel/process_control/test07/test07.cpp b/src/systemc/tests/systemc/kernel/process_control/test07/test07.cpp
new file mode 100644
index 000000000..5478d6d7d
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/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 -- Test handling of process objects with living descendants
+
+ Original Author: Philipp A. Hartmann, OFFIS
+
+ *****************************************************************************/
+/*****************************************************************************
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+// $Log: test07.cpp,v $
+// Revision 1.2 2011/02/14 17:00:00 acg
+// Andy Goodrich: updated copyright and added cvs logging information inline.
+//
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include <systemc.h>
+
+void
+dump_hierarchy(
+ std::vector< sc_object* > const & objs = sc_get_top_level_objects()
+ , unsigned level = 0
+)
+{
+ if (!level)
+ std::cout << "------ " << "(" << sc_time_stamp() << ")" << " ------"
+ << std::endl;
+
+ std::vector<sc_object*>::const_iterator it = objs.begin();
+ for( ; it != objs.end(); it++ )
+ {
+ std::cout << std::string( level + 1, ' ' )
+ << (*it)->name() << " (" << (*it)->kind() << ")";
+
+ sc_process_handle h(*it);
+
+ std::cout << ( h.valid() // is it a process? -> print state
+ ? (! h.terminated() ? " (running)" : " (terminated)" )
+ : "" )
+ << std::endl;
+
+ dump_hierarchy( (*it)->get_child_objects(), level+1 );
+ }
+
+ if (!level)
+ std::cout << "---------------------- " << std::endl;
+}
+
+struct my_object : sc_object {
+ my_object( const char* name ) : sc_object( name ) {}
+ ~my_object()
+ {
+ std::cout << "+++ " << this->name() << " deleted" << std::endl;
+ }
+};
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ : leaf_(0)
+ {
+ SC_THREAD(parent);
+ }
+
+ enum start_options
+ {
+ no_children = 0,
+ start_child_proc = 1,
+ create_child_obj = 2,
+ both_children = 3
+ };
+
+ void child( start_options opt ){
+ start();
+
+ my_object local( "local" );
+
+ if( opt & create_child_obj )
+ leaf_=new my_object("dyn_obj");
+
+ wait( 100, SC_NS );
+
+ if( opt & start_child_proc )
+ sc_spawn( sc_bind( &DUT::child, this, no_children )
+ , "grandchild" );
+
+ wait( 100, SC_NS );
+ end();
+ }
+
+ void parent()
+ {
+ // only parent alive
+ wait( 50, SC_NS );
+ dump_hierarchy();
+
+ sc_spawn( sc_bind( &DUT::child, this, start_child_proc ), "child0" );
+ sc_spawn( sc_bind( &DUT::child, this, both_children ), "child1" );
+
+ // direct children up and running
+ wait( 50, SC_NS );
+ dump_hierarchy();
+
+ // grandchildren started, child object created
+ wait( 100, SC_NS );
+ dump_hierarchy();
+
+ // direct children ended (zombies kept)
+ wait( 100, SC_NS );
+ dump_hierarchy();
+
+ // grandhildren ended (zombie with child object kept)
+ wait( 100, SC_NS );
+ dump_hierarchy();
+
+ // child object removed, zombies deleted
+ delete leaf_; leaf_ = 0;
+ wait( 100, SC_NS );
+ dump_hierarchy();
+
+ {
+ // create another pair of children
+ sc_process_handle
+ h0 = sc_spawn( sc_bind( &DUT::child, this, start_child_proc ), "child0" ),
+ h1 = sc_spawn( sc_bind( &DUT::child, this, start_child_proc ), "child1" );
+
+ wait( 100, SC_NS );
+ dump_hierarchy();
+
+ // and kill them, after it has spawned its grandchild
+ wait( 50, SC_NS );
+ h0.kill();
+ h1.kill( SC_INCLUDE_DESCENDANTS );
+
+ std::cout << "+++ kills sent ... "
+ << "(" << sc_time_stamp() << ")"
+ << std::endl;
+
+ // needed to avoid segfault
+ //wait(SC_ZERO_TIME);
+
+ } // drop handles
+
+ wait( 50, SC_NS );
+ dump_hierarchy();
+
+ end();
+ }
+
+ void start()
+ {
+ std::cout
+ << "+++ "
+ << sc_get_current_process_handle().name()
+ << " starting "
+ << "(" << sc_time_stamp() << ")"
+ << std::endl;
+ }
+ void end()
+ {
+ std::cout
+ << "+++ "
+ << sc_get_current_process_handle().name()
+ << " exiting "
+ << "(" << sc_time_stamp() << ")"
+ << std::endl;
+ }
+
+ my_object* leaf_;
+};
+
+
+int sc_main( int, char*[] )
+{
+ DUT dut("dut");
+ sc_start(900, SC_NS );
+ // everything cleaned up (only module still alive)
+ dump_hierarchy();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/process_control/test08/golden/test08.log b/src/systemc/tests/systemc/kernel/process_control/test08/golden/test08.log
new file mode 100644
index 000000000..c08a26aec
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test08/golden/test08.log
@@ -0,0 +1,16 @@
+SystemC Simulation
+0 s target: initializing
+10 ns tb: firing event
+10 ns target: awoke
+20 ns tb: suspending target
+30 ns tb: firing event while target suspended
+40 ns tb: resetting target
+40 ns target: initializing
+50 ns tb: resuming target
+60 ns tb: 10ns after resume
+70 ns tb: firing event again
+70 ns target: awoke
+80 ns tb: stopping
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/process_control/test08/test08.cpp b/src/systemc/tests/systemc/kernel/process_control/test08/test08.cpp
new file mode 100644
index 000000000..8e5a91599
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/test08/test08.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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test08.cpp -- Test of suspend and asynchronous reset interaction
+
+ Original Author: Andy Goodrich, 14 Februrary 2011
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+// $Log: test08.cpp,v $
+// Revision 1.4 2011/04/02 00:08:36 acg
+// Andy Goodrich: turn off corner case error checking.
+//
+// Revision 1.3 2011/03/07 19:32:16 acg
+// Andy Goodrich: addition to set sc_core::sc_allow_process_control_corners
+// to true so that this test avoids corner case error messages.
+//
+// Revision 1.2 2011/02/20 13:44:06 acg
+// Andy Goodrich: updates for IEEE 1666 2011.
+//
+// Revision 1.1 2011/02/14 16:59:29 acg
+// Andy Goodrich: first check in.
+//
+
+#include "systemc.h"
+
+sc_event event1;
+sc_process_handle t;
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_THREAD(thread);
+ t = sc_get_current_process_handle();
+ }
+ void thread()
+ {
+ cout << sc_time_stamp() << " target: initializing" << endl;
+ for (;;)
+ {
+ wait(event1);
+ cout << sc_time_stamp() << " target: awoke" << endl;
+ }
+ }
+};
+
+SC_MODULE(TB)
+{
+ SC_CTOR(TB)
+ {
+ SC_THREAD(tb_thread);
+ }
+ void tb_thread()
+ {
+ wait( 10, SC_NS );
+ cout << sc_time_stamp() << " tb: firing event " << endl;
+ event1.notify();
+ wait( 10, SC_NS );
+
+ cout << sc_time_stamp() << " tb: suspending target " << endl;
+ t.suspend();
+ wait( 10, SC_NS );
+
+ cout << sc_time_stamp() << " tb: firing event while target suspended"
+ << endl;
+ event1.notify();
+ wait( 10, SC_NS );
+
+ cout << sc_time_stamp() << " tb: resetting target " << endl;
+ t.reset();
+ wait( 10, SC_NS );
+
+ cout << sc_time_stamp() << " tb: resuming target" << endl;
+ t.resume();
+ wait( 10, SC_NS );
+
+ cout << sc_time_stamp() << " tb: 10ns after resume" << endl;
+ wait( 10, SC_NS );
+
+ cout << sc_time_stamp() << " tb: firing event again" << endl;
+ event1.notify();
+ wait( 10, SC_NS );
+
+ cout << sc_time_stamp() << " tb: stopping" << endl;
+ sc_stop();
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_core::sc_allow_process_control_corners = true;
+ DUT dut("dut");
+ TB tb("tb");
+
+ sc_core::sc_allow_process_control_corners = true;
+ sc_start();
+
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/process_control/throw_it/test1/golden/test1.log b/src/systemc/tests/systemc/kernel/process_control/throw_it/test1/golden/test1.log
new file mode 100644
index 000000000..18c914736
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/throw_it/test1/golden/test1.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+0 s: starting victim thread
+10 ns: in perpetrator throwing exception in victim
+10 ns: in victim thread, caught exception from pepetrator, exiting
+10 ns: in perpetrator after throwing exception in victim
diff --git a/src/systemc/tests/systemc/kernel/process_control/throw_it/test1/test1.cpp b/src/systemc/tests/systemc/kernel/process_control/throw_it/test1/test1.cpp
new file mode 100644
index 000000000..1a3ceb192
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/process_control/throw_it/test1/test1.cpp
@@ -0,0 +1,57 @@
+//----------------------------------------------------------------------
+// Copyright 2009 Cadence Design Systems, Inc.
+// All Rights Reserved Worldwide
+//----------------------------------------------------------------------
+
+#include <systemc.h>
+
+class my_exception {
+public:
+ my_exception(const char* s) : s_(s) { }
+ const char* message() { return s_.c_str(); }
+protected:
+ std::string s_;
+};
+
+SC_MODULE(top) {
+public:
+ SC_CTOR(top) {
+ SC_THREAD(victim);
+ h = sc_get_current_process_handle();
+ SC_THREAD(perpetrator);
+ }
+
+ void victim() {
+ try {
+ cerr << sc_time_stamp() << ": starting victim thread" << endl;
+ ::sc_core::wait(100, SC_NS);
+ }
+ catch (my_exception& x) {
+ cerr << sc_time_stamp() << ": in victim thread, caught exception "
+ << x.message() << ", exiting" << endl;
+ return;
+ }
+ }
+
+ void perpetrator() {
+ wait(10, SC_NS);
+ cerr << sc_time_stamp()
+ << ": in perpetrator throwing exception in victim "
+ << endl;
+ h.throw_it(my_exception("from pepetrator"));
+ cerr << sc_time_stamp()
+ << ": in perpetrator after throwing exception in victim "
+ << endl;
+ }
+
+protected:
+ sc_process_handle h;
+};
+
+int sc_main (int argc, char *argv[])
+{
+ top t("top");
+ sc_start();
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/reset_signal_is/test01/golden/test01.log
new file mode 100644
index 000000000..2fdc2c177
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test01/golden/test01.log
@@ -0,0 +1,8 @@
+SystemC Simulation
+Before start
+A: reset
+B: reset
+A: reset
+B: reset
+After reset true
+Ending
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test01/test01.cpp b/src/systemc/tests/systemc/kernel/reset_signal_is/test01/test01.cpp
new file mode 100644
index 000000000..af0ca999e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test01/test01.cpp
@@ -0,0 +1,106 @@
+/*****************************************************************************
+
+ 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 -- Test for reset_signal_is support.
+
+ Original Author: Andy Goodrich
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+
+
+SC_MODULE(A)
+{
+ SC_CTOR(A)
+ {
+ SC_CTHREAD(test,m_clk.pos());
+ reset_signal_is( m_reset, false );
+ }
+ void test()
+ {
+ {
+ cout << "A: reset" << endl;
+ wait();
+ }
+ for (;;)
+ {
+ wait();
+ }
+ }
+ sc_in_clk m_clk;
+ sc_in<bool> m_reset;
+};
+
+SC_MODULE(B)
+{
+ B(sc_module_name name, sc_signal<bool>* reset_p ):
+ sc_module(name), m_reset_p(reset_p)
+ {
+ SC_HAS_PROCESS(B);
+ SC_CTHREAD(test,m_clk.pos());
+ reset_signal_is( *m_reset_p, false );
+ }
+ void test()
+ {
+ {
+ cout << "B: reset" << endl;
+ wait();
+ }
+ for (;;)
+ {
+ wait();
+ }
+ }
+ sc_in_clk m_clk;
+ sc_signal<bool>* m_reset_p;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clk;
+ sc_signal<bool> reset;
+ A a("a");
+ B b("b",&reset);
+
+ a.m_clk(clk);
+ a.m_reset(reset);
+ b.m_clk(clk);
+
+ cout << "Before start" << endl;
+ sc_start(2, SC_NS);
+ reset = true;
+ cout << "After reset true" << endl;
+ sc_start(3, SC_NS);
+ cout << "Ending" << endl;
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/reset_signal_is/test02/golden/test02.log
new file mode 100644
index 000000000..4d9276f04
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test02/golden/test02.log
@@ -0,0 +1,10 @@
+SystemC Simulation
+0 s: initializing
+3 ns: waited 3
+4 ns: initializing
+7 ns: waited 3
+10 ns: waited 3
+12 ns: initializing
+15 ns: initializing
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test02/test02.cpp b/src/systemc/tests/systemc/kernel/reset_signal_is/test02/test02.cpp
new file mode 100644
index 000000000..2fc27a1f7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test02/test02.cpp
@@ -0,0 +1,84 @@
+/*****************************************************************************
+
+ 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 -- Test reset_signal_is() usage with SC_CTHREAD processes.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 12 August 2005
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(cthread,m_clk.pos());
+ reset_signal_is(m_reset,true);
+ SC_CTHREAD(resetter,m_clk.pos());
+ }
+ void cthread()
+ {
+ cout << sc_time_stamp() << ": initializing" << endl;
+ for (;;)
+ {
+ wait(3);
+ cout << sc_time_stamp() << ": waited 3" << endl;
+ }
+ }
+ void resetter()
+ {
+ m_reset = false;
+ wait(3);
+ m_reset = true;
+ wait(2);
+ m_reset = false;
+ wait(6);
+ m_reset = true;
+ wait(5);
+ sc_stop();
+ }
+ sc_in<bool> m_clk;
+ sc_inout<bool> m_reset;
+};
+
+int sc_main( int argc, char* argv[] )
+{
+ sc_clock clock;
+ DUT dut("dut");
+ sc_signal<bool> reset;
+
+ dut.m_clk(clock);
+ dut.m_reset(reset);
+
+ sc_start();
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test03/golden/test03.log b/src/systemc/tests/systemc/kernel/reset_signal_is/test03/golden/test03.log
new file mode 100644
index 000000000..41347fb58
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test03/golden/test03.log
@@ -0,0 +1,9 @@
+SystemC Simulation
+0 s: initializing
+3 ns: initializing
+6 ns: waited 3
+9 ns: waited 3
+11 ns: initializing
+14 ns: initializing
+17 ns: waited 3
+20 ns: waited 3
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test03/test03.cpp b/src/systemc/tests/systemc/kernel/reset_signal_is/test03/test03.cpp
new file mode 100644
index 000000000..e0cf86131
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test03/test03.cpp
@@ -0,0 +1,80 @@
+/*****************************************************************************
+
+ 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 -- Test reset_signal_is() usage with SC_CTHREAD processes.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 12 August 2005
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(cthread,m_clk.pos());
+ reset_signal_is(m_reset,true);
+ }
+ void cthread()
+ {
+ cout << sc_time_stamp() << ": initializing" << endl;
+ for (;;)
+ {
+ wait(3);
+ cout << sc_time_stamp() << ": waited 3" << endl;
+ }
+ }
+ sc_in<bool> m_clk;
+ sc_in<bool> m_reset;
+};
+
+int sc_main( int argc, char* argv[] )
+{
+ sc_clock clock;
+ DUT dut("dut");
+ sc_signal<bool> reset;
+
+ dut.m_clk(clock);
+ dut.m_reset(reset);
+
+ reset = false;
+ sc_start(3, SC_NS);
+ reset = true;
+ sc_start(2, SC_NS);
+ reset = false;
+ sc_start(6, SC_NS);
+ reset = true;
+ sc_start(5, SC_NS);
+ reset = false;
+ sc_start(5, SC_NS);
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test04/golden/test04.log b/src/systemc/tests/systemc/kernel/reset_signal_is/test04/golden/test04.log
new file mode 100644
index 000000000..4d9276f04
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test04/golden/test04.log
@@ -0,0 +1,10 @@
+SystemC Simulation
+0 s: initializing
+3 ns: waited 3
+4 ns: initializing
+7 ns: waited 3
+10 ns: waited 3
+12 ns: initializing
+15 ns: initializing
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test04/test04.cpp b/src/systemc/tests/systemc/kernel/reset_signal_is/test04/test04.cpp
new file mode 100644
index 000000000..00b6676e2
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test04/test04.cpp
@@ -0,0 +1,84 @@
+/*****************************************************************************
+
+ 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 -- Test reset_signal_is() with SC_CTHREAD processes and sc_out.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 12 August 2005
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(cthread,m_clk.pos());
+ reset_signal_is(m_reset,true);
+ SC_CTHREAD(resetter,m_clk.pos());
+ }
+ void cthread()
+ {
+ cout << sc_time_stamp() << ": initializing" << endl;
+ for (;;)
+ {
+ wait(3);
+ cout << sc_time_stamp() << ": waited 3" << endl;
+ }
+ }
+ void resetter()
+ {
+ m_reset = false;
+ wait(3);
+ m_reset = true;
+ wait(2);
+ m_reset = false;
+ wait(6);
+ m_reset = true;
+ wait(5);
+ sc_stop();
+ }
+ sc_in<bool> m_clk;
+ sc_out<bool> m_reset;
+};
+
+int sc_main( int argc, char* argv[] )
+{
+ sc_clock clock;
+ DUT dut("dut");
+ sc_signal<bool> reset;
+
+ dut.m_clk(clock);
+ dut.m_reset(reset);
+
+ sc_start();
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test05/golden/test05.log b/src/systemc/tests/systemc/kernel/reset_signal_is/test05/golden/test05.log
new file mode 100644
index 000000000..efb2d4750
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test05/golden/test05.log
@@ -0,0 +1,63 @@
+SystemC Simulation
+0 s ... static method
+0 s ... static thread event wait
+0 s ... static thread timed wait
+0 s ... static thread clocked
+0 s ... static cthread
+1 ns ... dynamic method
+1 ns ... dynamic thread clocked
+1 ns ... dynamic thread event wait
+1 ns ... dynamic thread timed wait
+
+2500 ps asserting asynchronous reset
+2500 ps ... dynamic thread timed wait
+2500 ps ... dynamic thread event wait
+2500 ps ... dynamic thread clocked
+2500 ps ... static thread timed wait
+2500 ps ... static thread event wait
+2500 ps ... static thread clocked
+2500 ps ... static cthread
+3 ns ... static thread clocked
+3 ns ... static cthread
+3 ns ... dynamic thread clocked
+
+3500 ps clearing asynchronous reset
+
+5500 ps asserting synchronous reset
+6 ns ... static thread clocked
+6 ns ... static cthread
+6 ns ... dynamic thread clocked
+
+6500 ps clearing synchronous reset
+
+13500 ps asserting asynchronous reset
+13500 ps ... dynamic thread timed wait
+13500 ps ... dynamic thread event wait
+13500 ps ... dynamic thread clocked
+13500 ps ... static thread timed wait
+13500 ps ... static thread event wait
+13500 ps ... static thread clocked
+13500 ps ... static cthread
+14 ns ... static thread clocked
+14 ns ... static cthread
+14 ns ... dynamic thread clocked
+15 ns ... static thread clocked
+15 ns ... static cthread
+15 ns ... dynamic thread clocked
+
+15500 ps clearing asynchronous reset
+
+17500 ps asserting synchronous reset
+18 ns ... static thread clocked
+18 ns ... static cthread
+18 ns ... dynamic thread clocked
+19 ns ... static thread clocked
+19 ns ... static cthread
+19 ns ... dynamic thread clocked
+
+19500 ps clearing synchronous reset
+
+24500 ps terminating simulation
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test05/test05.cpp b/src/systemc/tests/systemc/kernel/reset_signal_is/test05/test05.cpp
new file mode 100644
index 000000000..d811a109e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test05/test05.cpp
@@ -0,0 +1,220 @@
+/*****************************************************************************
+
+ 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 -- Test reset_signal_is() and async_reset_signal_is() usage.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 14 December 2006
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ 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.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(creator,m_clk.pos());
+ SC_CTHREAD(resetter,m_clk.neg());
+
+ // SET UP STATICALLY DEFINED PROCESSES:
+
+ SC_CTHREAD(static_cthread,m_clk.pos());
+ async_reset_signal_is(m_areset,true);
+ reset_signal_is(m_sreset,true);
+ SC_METHOD(static_method);
+ reset_signal_is(m_areset,true);
+ SC_THREAD(static_thread_clocked);
+ sensitive << m_clk.pos();
+ dont_initialize();
+ async_reset_signal_is(m_areset,true);
+ reset_signal_is(m_sreset,true);
+ SC_THREAD(static_thread_event);
+ async_reset_signal_is(m_areset,true);
+ reset_signal_is(m_sreset,true);
+ SC_THREAD(static_thread_timed);
+ async_reset_signal_is(m_areset,true);
+ reset_signal_is(m_sreset,true);
+ }
+
+ // creator - create the dynamic processes after the start of simulation:
+ void creator()
+ {
+ sc_spawn_options options_method;
+ sc_spawn_options options_thread_clocked;
+ sc_spawn_options options_thread_event;
+ sc_spawn_options options_thread_timed;
+
+ wait(1);
+
+ options_method.reset_signal_is( m_areset, true );
+ options_method.spawn_method();
+ sc_spawn( sc_bind(&DUT::dynamic_method, this), "dynamic_method",
+ &options_method);
+
+ options_thread_clocked.async_reset_signal_is( m_areset, true );
+ options_thread_clocked.reset_signal_is( m_sreset, true );
+ options_thread_clocked.set_sensitivity( &m_clk.posedge_event() );
+ sc_spawn( sc_bind(&DUT::dynamic_thread_clocked, this),
+ "dynamic_thread_clocked", &options_thread_clocked);
+
+ options_thread_event.async_reset_signal_is( m_areset, true );
+ options_thread_event.reset_signal_is( m_sreset, true );
+ sc_spawn( sc_bind(&DUT::dynamic_thread_event, this),
+ "dynamic_thread_event", &options_thread_event);
+
+ options_thread_timed.async_reset_signal_is( m_areset, true );
+ options_thread_timed.reset_signal_is( m_sreset, true );
+ sc_spawn( sc_bind(&DUT::dynamic_thread_timed, this),
+ "dynamic_thread_timed", &options_thread_timed);
+
+ }
+
+ void dynamic_method()
+ {
+ cout << sc_time_stamp() << " ... dynamic method" << endl;
+ next_trigger(m_non_event);
+ }
+
+ void dynamic_thread_clocked()
+ {
+ cout << sc_time_stamp() << " ... dynamic thread clocked" << endl;
+ for (;;)
+ {
+ wait();
+ }
+ }
+
+ void dynamic_thread_event()
+ {
+ cout << sc_time_stamp() << " ... dynamic thread event wait" << endl;
+ for (;;)
+ {
+ wait(m_non_event);
+ }
+ }
+
+ void dynamic_thread_timed()
+ {
+ cout << sc_time_stamp() << " ... dynamic thread timed wait" << endl;
+ for (;;)
+ {
+ wait(1000, SC_NS);
+ }
+ }
+
+
+ void resetter()
+ {
+ for ( int wait_i = 1; wait_i < 3; wait_i++ )
+ {
+ wait(2);
+ cout << endl << sc_time_stamp() << " asserting asynchronous reset"
+ << endl;
+ m_areset = true;
+ wait(wait_i);
+ cout << endl << sc_time_stamp() << " clearing asynchronous reset"
+ << endl;
+ m_areset = false;
+ wait(2);
+ cout << endl << sc_time_stamp() << " asserting synchronous reset"
+ << endl;
+ m_sreset = true;
+ wait(wait_i);
+ cout << endl << sc_time_stamp() << " clearing synchronous reset"
+ << endl;
+ m_sreset = false;
+ wait(5);
+ }
+ cout << endl << sc_time_stamp() << " terminating simulation" << endl;
+ sc_stop();
+ }
+
+ void static_cthread()
+ {
+ cout << sc_time_stamp() << " ... static cthread" << endl;
+ for (;;)
+ {
+ wait();
+ }
+ }
+
+ void static_method()
+ {
+ cout << sc_time_stamp() << " ... static method" << endl;
+ next_trigger(m_non_event);
+ }
+
+ void static_thread_clocked()
+ {
+ cout << sc_time_stamp() << " ... static thread clocked" << endl;
+ for (;;)
+ {
+ wait();
+ }
+ }
+
+ void static_thread_event()
+ {
+ cout << sc_time_stamp() << " ... static thread event wait " << endl;
+ for (;;)
+ {
+ wait(m_non_event);
+ }
+ }
+
+ void static_thread_timed()
+ {
+ cout << sc_time_stamp() << " ... static thread timed wait " << endl;
+ for (;;)
+ {
+ wait(1000, SC_NS);
+ }
+ }
+
+ sc_signal<bool> m_areset;
+ sc_in<bool> m_clk;
+ sc_event m_non_event;
+ sc_signal<bool> m_sreset;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+
+ dut.m_clk(clock);
+
+ sc_start();
+
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_attribute/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_attribute/test01/golden/test01.log
new file mode 100644
index 000000000..f62393491
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_attribute/test01/golden/test01.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+a1
+42
+a1
+a2
diff --git a/src/systemc/tests/systemc/kernel/sc_attribute/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_attribute/test01/test01.cpp
new file mode 100644
index 000000000..99bd4b473
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_attribute/test01/test01.cpp
@@ -0,0 +1,74 @@
+/*****************************************************************************
+
+ 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:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of sc_attribute - general test
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_clock clk;
+
+ sc_attribute<int> a1( "a1", 42 );
+ sc_attribute<std::string> a2( "a2", "foobar" );
+
+ clk.add_attribute( a1 );
+ clk.add_attribute( a2 );
+
+ sc_attr_base* p = clk.get_attribute( "a1" );
+ cout << p->name() << endl;
+ sc_attribute<int>* pi = dynamic_cast<sc_attribute<int>*>( p );
+ if( pi != 0 ) {
+ cout << pi->value << endl;
+ }
+ sc_attribute<std::string>* ps = dynamic_cast<sc_attribute<std::string>*>( p );
+ if( ps != 0 ) {
+ cout << ps->value << endl;
+ }
+
+ const sc_attr_cltn& attrs = clk.attr_cltn();
+ sc_attr_cltn::const_iterator it = attrs.begin();
+ for( ; it != attrs.end(); ++ it ) {
+ cout << (*it)->name() << endl;
+ }
+
+ clk.remove_attribute( "a1" );
+ clk.remove_attribute( "a2" );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_attribute/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/sc_attribute/test02/golden/test02.log
new file mode 100644
index 000000000..b5133c9f1
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_attribute/test02/golden/test02.log
@@ -0,0 +1,21 @@
+SystemC Simulation
+a1
+clock
+a1
+clock
+
+added attributes to the attribute collection class
+a1 clock
+a3 24
+a4 casio
+
+size of the class
+3
+
+looking whether the name is in collection class
+a3 exists
+a5 does not exist
+
+removing names
+a1 is removed
+a5 does not exist
diff --git a/src/systemc/tests/systemc/kernel/sc_attribute/test02/test02.cpp b/src/systemc/tests/systemc/kernel/sc_attribute/test02/test02.cpp
new file mode 100644
index 000000000..6bd979657
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_attribute/test02/test02.cpp
@@ -0,0 +1,114 @@
+/*****************************************************************************
+
+ 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: 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 sc_attribute
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_clock clk;
+ sc_attr_cltn att_cltn;
+ sc_attr_cltn att_cln(att_cltn);
+ sc_attribute<std::string> a1( "a1", "clock" );
+ sc_attribute<std::string> a2( a1 );
+ sc_attribute<int> a3( "a3", 24 );
+ sc_attribute<std::string> a4( "a4", "casio" );
+ sc_attribute<int> a5("a5");
+
+ cout << a2.name() << endl;
+ cout << a2.value << endl;
+
+ clk.add_attribute( a2 );
+
+ sc_attr_base* p = clk.get_attribute("a1");
+ cout << p->name() << endl;
+ sc_attribute<std::string>* pi = dynamic_cast<sc_attribute<std::string>*>( p );
+ if( pi != 0 ) {
+ cout << pi->value << endl;
+ }
+
+ cout << endl;
+ cout << "added attributes to the attribute collection class" << endl;
+
+ if(att_cltn.push_back(&a1) == true) {
+ cout << a1.name() << " ";
+ cout << a1.value << endl;
+ }
+
+ if(att_cltn.push_back(&a3) == true) {
+ cout << a3.name() << " ";
+ cout << a3.value << endl;
+ }
+
+ if(att_cltn.push_back(&a4) == true) {
+ cout << a4.name() << " ";
+ cout << a4.value << endl << endl;
+ }
+
+ cout << "size of the class\n";
+ cout << att_cltn.size()<< endl<< endl;
+
+ cout << "looking whether the name is in collection class\n";
+ sc_attr_base *pr = att_cltn.operator []("a3");
+ if(pr != 0)
+ cout << pr->name() << " exists" << endl;
+ else
+ cout << "a3 does not exist\n";
+
+ sc_attr_base *pm = att_cltn.operator []("a5");
+ if(pm != 0)
+ cout << pm->name() << " exists" << endl;
+ else
+ cout << "a5 does not exist\n" << endl;
+
+ cout << "removing names \n";
+ sc_attr_base *pk = att_cltn.remove("a1");
+ if(pk != 0)
+ cout << "a1 is removed \n";
+ else
+ cout << "a1 does not exist\n";
+ sc_attr_base *pn = att_cltn.remove("a5");
+ if(pn != 0)
+ cout << "a5 is removed \n";
+ else
+ cout << "a5 does not exist\n";
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_elab_and_sim/golden/sc_elab_and_sim.log b/src/systemc/tests/systemc/kernel/sc_elab_and_sim/golden/sc_elab_and_sim.log
new file mode 100644
index 000000000..0d934d401
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_elab_and_sim/golden/sc_elab_and_sim.log
@@ -0,0 +1,2 @@
+SystemC Simulation
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/sc_elab_and_sim/sc_elab_and_sim.cpp b/src/systemc/tests/systemc/kernel/sc_elab_and_sim/sc_elab_and_sim.cpp
new file mode 100644
index 000000000..e5cd39efe
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_elab_and_sim/sc_elab_and_sim.cpp
@@ -0,0 +1,30 @@
+#include "systemc.h"
+
+
+int main()
+{
+ char* argv[] = { "0", "1", "2", "3", "4" };
+ return sc_elab_and_sim( sizeof(argv)/sizeof(char*), argv );
+}
+
+int sc_main(int argc, char* argv[])
+{
+ if ( argc != sc_argc() )
+ {
+ cout << "sc_argc mismatch: expected " << argc << " got " << sc_argc()
+ << endl;
+ }
+ for ( int argi = 0; argi < argc; argi++ )
+ {
+ if ( strcmp( argv[argi], sc_argv()[argi] ) )
+ {
+ cout << "sc_argv()[" << argi << "] mismatch: expected: '"
+ << argv[argi] << "' got: '" << sc_argv()[argi] << "'" << endl;
+ }
+ }
+
+ cerr << "Program completed" << endl;
+
+ return 0;
+}
+
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.
diff --git a/src/systemc/tests/systemc/kernel/sc_lambda/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_lambda/test01/golden/test01.log
new file mode 100644
index 000000000..680d78ed8
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_lambda/test01/golden/test01.log
@@ -0,0 +1,12 @@
+SystemC Simulation
+i = 0
+i = 1
+i = 2
+i = 3
+i = 4
+i = 5
+i = 6
+i = 7
+i = 8
+i = 9
+i = 10
diff --git a/src/systemc/tests/systemc/kernel/sc_lambda/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_lambda/test01/test01.cpp
new file mode 100644
index 000000000..99cfdc747
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_lambda/test01/test01.cpp
@@ -0,0 +1,86 @@
+/*****************************************************************************
+
+ 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-03-22
+ Ucar Aziz, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date: Andy Goodrich, Forte Design Systems, 2005-11-10
+ Description of Modification: Removal of Lambda exressions
+
+ *****************************************************************************/
+// $Log: test01.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:04 acg
+// systemc_tests-2.3
+//
+// Revision 1.2 2006/01/24 21:04:54 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+
+// test of sc_lambda-style wait_until w/normal loop.
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_in_clk clk1;
+ sc_in<bool> clk2;
+
+ void main_action()
+ {
+ int i = 0;
+
+ while( true ) {
+ do { wait(); } while ( !(clk2 == true) );
+ cout << "i = " << i << endl;
+ i ++;
+ wait();
+ }
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_CTHREAD( main_action, clk1.pos() );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+ sc_clock clk1( "clk1", 0.1, SC_NS );
+ sc_clock clk2( "clk2", 0.5, SC_NS );
+ a.clk1( clk1 );
+ a.clk2( clk2 );
+
+ sc_start( 3, SC_NS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_macros/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_macros/test01/golden/test01.log
new file mode 100644
index 000000000..d2d9af1f2
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_macros/test01/golden/test01.log
@@ -0,0 +1,59 @@
+SystemC Simulation
+
+*** fx
+
+1
+1
+
+1
+1
+
+1
+1
+
+1
+1
+
+1
+4294967295
+
+1
+4294967295
+
+1
+1
+
+1
+1
+
+1
+4294967295
+
+1
+4294967295
+
+*** int
+
+1
+1
+
+1
+4294967295
+
+1
+1
+
+1
+4294967295
+
+1
+1
+
+1
+4294967295
+
+1
+1
+
+1
+4294967295
diff --git a/src/systemc/tests/systemc/kernel/sc_macros/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_macros/test01/test01.cpp
new file mode 100644
index 000000000..7ce7aa58c
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_macros/test01/test01.cpp
@@ -0,0 +1,239 @@
+/*****************************************************************************
+
+ 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:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of sc_abs<T> for all SystemC arithmetic datatypes
+
+#define SC_INCLUDE_FX
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ cout << "\n*** fx" << endl;
+
+ // sc_fxval
+ {
+ sc_fxval a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_fxval_fast
+ {
+ sc_fxval_fast a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_fix
+ {
+ sc_fix a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_fix_fast
+ {
+ sc_fix_fast a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_ufix
+ {
+ sc_ufix a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_ufix_fast
+ {
+ sc_ufix_fast a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_fixed
+ {
+ sc_fixed<32,32> a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_fixed_fast
+ {
+ sc_fixed_fast<32,32> a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_ufixed
+ {
+ sc_ufixed<32,32> a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_ufixed_fast
+ {
+ sc_ufixed_fast<32,32> a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ cout << "\n*** int" << endl;
+
+ // sc_signed
+ {
+ sc_signed a( 32 );
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_unsigned
+ {
+ sc_unsigned a( 32 );
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_bigint
+ {
+ sc_bigint<32> a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_biguint
+ {
+ sc_biguint<32> a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_signed_subref
+ // sc_unsigned_subref
+
+ // sc_int_base
+ {
+ sc_int_base a( 32 );
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_uint_base
+ {
+ sc_uint_base a( 32 );
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_int
+ {
+ sc_int<32> a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_uint
+ {
+ sc_uint<32> a;
+ cout << endl;
+ a = 1;
+ cout << sc_abs( a ) << endl;
+ a = -1;
+ cout << sc_abs( a ) << endl;
+ }
+
+ // sc_int_subref
+ // sc_uint_subref
+ // sc_int_concref
+ // sc_uint_concref
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_main_main/golden/sc_main_main.log b/src/systemc/tests/systemc/kernel/sc_main_main/golden/sc_main_main.log
new file mode 100644
index 000000000..0d934d401
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_main_main/golden/sc_main_main.log
@@ -0,0 +1,2 @@
+SystemC Simulation
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/sc_main_main/sc_main_main.cpp b/src/systemc/tests/systemc/kernel/sc_main_main/sc_main_main.cpp
new file mode 100644
index 000000000..4937b27ff
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_main_main/sc_main_main.cpp
@@ -0,0 +1,42 @@
+#include "systemc.h"
+
+int main()
+{
+ char *argv[] = { strdup("0"), strdup("1"), strdup("2"), strdup("3"),
+ strdup("4"), NULL };
+ int argc = sizeof argv / sizeof argv[0] - 1;
+ sc_elab_and_sim( argc, argv );
+ for (int i = 0; i < argc; ++i) {
+ free(argv[i]);
+ }
+}
+
+int sc_main(int argc, char* argv[])
+{
+ // Number of arguments should be the same
+ sc_assert(argc == sc_argc());
+
+ // Ensure all arguments are the same as sc_argv
+ for ( int argi = 0; argi < argc; argi++ ) {
+ if ( strcmp( argv[argi], sc_argv()[argi] ) != 0 ) {
+ cout << "sc_argv()[" << argi << "] mismatch: expected: '"
+ << argv[argi] << "' got: '" << sc_argv()[argi] << "'" << endl;
+ }
+ }
+
+ // This check will most likely not do anything since we are likely to have
+ // zeros on the stack, but let's add it anyway.
+ sc_assert(argv[argc] == NULL);
+ sc_assert(sc_argv()[argc] == NULL);
+
+ // Ensure that modifying argv does not alter sc_argv
+ argv[1][0] = '9';
+ free(argv[2]);
+ argv[2] = strdup("new-2");
+ sc_assert(strcmp(sc_argv()[2], "2") == 0);
+ sc_assert(strcmp(sc_argv()[1], "1") == 0);
+
+ cerr << "Program completed" << endl;
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_module/test01/golden/test01.log
new file mode 100644
index 000000000..6d243dcc5
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test01/golden/test01.log
@@ -0,0 +1 @@
+SystemC Simulation
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_module/test01/test01.cpp
new file mode 100644
index 000000000..156ada47f
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test01/test01.cpp
@@ -0,0 +1,179 @@
+/*****************************************************************************
+
+ 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:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of positional binding
+
+#include "systemc.h"
+
+template <class T>
+SC_MODULE( prim_source )
+{
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ SC_CTOR( prim_source ) {}
+};
+
+template <class T>
+SC_MODULE( prim_transfer )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+
+ SC_CTOR( prim_transfer ) {}
+};
+
+template <class T>
+SC_MODULE( prim_sink )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+
+ SC_CTOR( prim_sink ) {}
+};
+
+template <class T>
+SC_MODULE( hier_source )
+{
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ prim_source<T> prim_source1;
+
+ SC_CTOR( hier_source )
+ : prim_source1( "prim_source1" )
+ {
+ prim_source1( out, port_out);
+ }
+};
+
+template <class T>
+SC_MODULE( hier_transfer )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ prim_transfer<T> prim_transfer1;
+
+ SC_CTOR( hier_transfer )
+ : prim_transfer1( "prim_transfer1" )
+ {
+ prim_transfer1( in, port_in, out, port_out);
+ }
+};
+
+template <class T>
+SC_MODULE( hier_sink )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+
+ prim_sink<T> prim_sink1;
+
+ SC_CTOR( hier_sink )
+ : prim_sink1( "prim_sink1" )
+ {
+ prim_sink1( in, port_in );
+ }
+};
+
+template <class T>
+SC_MODULE( hier1 )
+{
+ sc_signal<T> sig1;
+ sc_signal<T> sig2;
+ sc_signal<T> sig3;
+ sc_signal<T> sig4;
+
+ prim_source<T> prim_source1;
+ prim_transfer<T> prim_transfer1;
+ prim_sink<T> prim_sink1;
+
+ SC_CTOR( hier1 )
+ : prim_source1( "prim_source1" ),
+ prim_transfer1( "prim_transfer1" ),
+ prim_sink1( "prim_sink1" )
+ {
+ prim_source1( sig1, sig2);
+ prim_transfer1( sig1, sig2, sig3, sig4);
+ prim_sink1( sig3, sig4);
+ }
+};
+
+template <class T>
+SC_MODULE( hier2 )
+{
+ sc_signal<T> sig1;
+ sc_signal<T> sig2;
+ sc_signal<T> sig3;
+ sc_signal<T> sig4;
+
+ hier_source<T> hier_source1;
+ hier_transfer<T> hier_transfer1;
+ hier_sink<T> hier_sink1;
+
+ SC_CTOR( hier2 )
+ : hier_source1( "hier_source1" ),
+ hier_transfer1( "hier_transfer1" ),
+ hier_sink1( "hier_sink1" )
+ {
+ hier_source1( sig1, sig2);
+ hier_transfer1( sig1, sig2, sig3, sig4);
+ hier_sink1( sig3, sig4);
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ hier1<int> hier1_int( "hier1_int" );
+ hier1<bool> hier1_bool( "hier1_bool" );
+ hier1<sc_logic> hier1_logic( "hier1_logic" );
+
+ hier2<int> hier2_int( "hier2_int" );
+ hier2<bool> hier2_bool( "hier2_bool" );
+ hier2<sc_logic> hier2_logic( "hier2_logic" );
+
+ sc_start(0, SC_NS);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/sc_module/test02/golden/test02.log
new file mode 100644
index 000000000..642bb49f7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test02/golden/test02.log
@@ -0,0 +1,11 @@
+SystemC Simulation
+
+Info: (I804) /IEEE_Std_1666/deprecated: positional binding using << or , is deprecated, use () instead.
+
+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_module/test02/test02.cpp b/src/systemc/tests/systemc/kernel/sc_module/test02/test02.cpp
new file mode 100644
index 000000000..8ff9f9072
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test02/test02.cpp
@@ -0,0 +1,179 @@
+/*****************************************************************************
+
+ 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 positional binding -- general test of operator ,
+
+#include "systemc.h"
+
+template <class T>
+SC_MODULE( prim_source )
+{
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ SC_CTOR( prim_source ) {}
+};
+
+template <class T>
+SC_MODULE( prim_transfer )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+
+ SC_CTOR( prim_transfer ) {}
+};
+
+template <class T>
+SC_MODULE( prim_sink )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+
+ SC_CTOR( prim_sink ) {}
+};
+
+template <class T>
+SC_MODULE( hier_source )
+{
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ prim_source<T> prim_source1;
+
+ SC_CTOR( hier_source )
+ : prim_source1( "prim_source1" )
+ {
+ prim_source1, out, port_out;
+ }
+};
+
+template <class T>
+SC_MODULE( hier_transfer )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ prim_transfer<T> prim_transfer1;
+
+ SC_CTOR( hier_transfer )
+ : prim_transfer1( "prim_transfer1" )
+ {
+ prim_transfer1, in, port_in, out, port_out;
+ }
+};
+
+template <class T>
+SC_MODULE( hier_sink )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+
+ prim_sink<T> prim_sink1;
+
+ SC_CTOR( hier_sink )
+ : prim_sink1( "prim_sink1" )
+ {
+ prim_sink1, in, port_in;
+ }
+};
+
+template <class T>
+SC_MODULE( hier1 )
+{
+ sc_signal<T> sig1;
+ sc_signal<T> sig2;
+ sc_signal<T> sig3;
+ sc_signal<T> sig4;
+
+ prim_source<T> prim_source1;
+ prim_transfer<T> prim_transfer1;
+ prim_sink<T> prim_sink1;
+
+ SC_CTOR( hier1 )
+ : prim_source1( "prim_source1" ),
+ prim_transfer1( "prim_transfer1" ),
+ prim_sink1( "prim_sink1" )
+ {
+ prim_source1, sig1, sig2;
+ prim_transfer1, sig1, sig2, sig3, sig4;
+ prim_sink1, sig3, sig4;
+ }
+};
+
+template <class T>
+SC_MODULE( hier2 )
+{
+ sc_signal<T> sig1;
+ sc_signal<T> sig2;
+ sc_signal<T> sig3;
+ sc_signal<T> sig4;
+
+ hier_source<T> hier_source1;
+ hier_transfer<T> hier_transfer1;
+ hier_sink<T> hier_sink1;
+
+ SC_CTOR( hier2 )
+ : hier_source1( "hier_source1" ),
+ hier_transfer1( "hier_transfer1" ),
+ hier_sink1( "hier_sink1" )
+ {
+ hier_source1, sig1, sig2;
+ hier_transfer1, sig1, sig2, sig3, sig4;
+ hier_sink1, sig3, sig4;
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ hier1<int> hier1_int( "hier1_int" );
+ hier1<bool> hier1_bool( "hier1_bool" );
+ hier1<sc_logic> hier1_logic( "hier1_logic" );
+
+ hier2<int> hier2_int( "hier2_int" );
+ hier2<bool> hier2_bool( "hier2_bool" );
+ hier2<sc_logic> hier2_logic( "hier2_logic" );
+
+ sc_start(0, SC_NS);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test03/golden/test03.log b/src/systemc/tests/systemc/kernel/sc_module/test03/golden/test03.log
new file mode 100644
index 000000000..6d243dcc5
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test03/golden/test03.log
@@ -0,0 +1 @@
+SystemC Simulation
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test03/test03.cpp b/src/systemc/tests/systemc/kernel/sc_module/test03/test03.cpp
new file mode 100644
index 000000000..e6c34483d
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test03/test03.cpp
@@ -0,0 +1,179 @@
+/*****************************************************************************
+
+ 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 positional binding -- general test of operator ()
+
+#include "systemc.h"
+
+template <class T>
+SC_MODULE( prim_source )
+{
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ SC_CTOR( prim_source ) {}
+};
+
+template <class T>
+SC_MODULE( prim_transfer )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+
+ SC_CTOR( prim_transfer ) {}
+};
+
+template <class T>
+SC_MODULE( prim_sink )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+
+ SC_CTOR( prim_sink ) {}
+};
+
+template <class T>
+SC_MODULE( hier_source )
+{
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ prim_source<T> prim_source1;
+
+ SC_CTOR( hier_source )
+ : prim_source1( "prim_source1" )
+ {
+ prim_source1( out, port_out );
+ }
+};
+
+template <class T>
+SC_MODULE( hier_transfer )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ prim_transfer<T> prim_transfer1;
+
+ SC_CTOR( hier_transfer )
+ : prim_transfer1( "prim_transfer1" )
+ {
+ prim_transfer1( in, port_in, out, port_out );
+ }
+};
+
+template <class T>
+SC_MODULE( hier_sink )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+
+ prim_sink<T> prim_sink1;
+
+ SC_CTOR( hier_sink )
+ : prim_sink1( "prim_sink1" )
+ {
+ prim_sink1( in, port_in );
+ }
+};
+
+template <class T>
+SC_MODULE( hier1 )
+{
+ sc_signal<T> sig1;
+ sc_signal<T> sig2;
+ sc_signal<T> sig3;
+ sc_signal<T> sig4;
+
+ prim_source<T> prim_source1;
+ prim_transfer<T> prim_transfer1;
+ prim_sink<T> prim_sink1;
+
+ SC_CTOR( hier1 )
+ : prim_source1( "prim_source1" ),
+ prim_transfer1( "prim_transfer1" ),
+ prim_sink1( "prim_sink1" )
+ {
+ prim_source1( sig1, sig2 );
+ prim_transfer1( sig1, sig2, sig3, sig4 );
+ prim_sink1( sig3, sig4 );
+ }
+};
+
+template <class T>
+SC_MODULE( hier2 )
+{
+ sc_signal<T> sig1;
+ sc_signal<T> sig2;
+ sc_signal<T> sig3;
+ sc_signal<T> sig4;
+
+ hier_source<T> hier_source1;
+ hier_transfer<T> hier_transfer1;
+ hier_sink<T> hier_sink1;
+
+ SC_CTOR( hier2 )
+ : hier_source1( "hier_source1" ),
+ hier_transfer1( "hier_transfer1" ),
+ hier_sink1( "hier_sink1" )
+ {
+ hier_source1( sig1, sig2 );
+ hier_transfer1( sig1, sig2, sig3, sig4 );
+ hier_sink1( sig3, sig4 );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ hier1<int> hier1_int( "hier1_int" );
+ hier1<bool> hier1_bool( "hier1_bool" );
+ hier1<sc_logic> hier1_logic( "hier1_logic" );
+
+ hier2<int> hier2_int( "hier2_int" );
+ hier2<bool> hier2_bool( "hier2_bool" );
+ hier2<sc_logic> hier2_logic( "hier2_logic" );
+
+ sc_start(0, SC_NS);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test04/golden/test04.log b/src/systemc/tests/systemc/kernel/sc_module/test04/golden/test04.log
new file mode 100644
index 000000000..17539c402
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test04/golden/test04.log
@@ -0,0 +1,18 @@
+SystemC Simulation
+signal_0
+signal_1
+a
+b
+c
+a.port_0
+a.port_1
+b.port_0
+b.port_1
+c.a
+c.b
+c.signal_0
+c.signal_1
+c.a.port_0
+c.a.port_1
+c.b.port_0
+c.b.port_1
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test04/test04.cpp b/src/systemc/tests/systemc/kernel/sc_module/test04/test04.cpp
new file mode 100644
index 000000000..14b7970c7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test04/test04.cpp
@@ -0,0 +1,105 @@
+/*****************************************************************************
+
+ 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 the unique name generation for objects
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_in<int> in;
+ sc_out<int> out;
+ SC_CTOR( mod_a ) {}
+};
+
+SC_MODULE( mod_b )
+{
+ sc_out<int> out;
+ sc_in<int> in;
+ SC_CTOR( mod_b ) {}
+};
+
+SC_MODULE( mod_c )
+{
+ mod_a a;
+ mod_b b;
+ sc_signal<int> sig1;
+ sc_signal<int> sig2;
+ SC_CTOR( mod_c ) : a("a"), b("b")
+ {
+ a.in( sig1 );
+ a.out( sig2 );
+ b.out( sig1 );
+ b.in( sig2 );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ sc_signal<int> sig1;
+ sc_signal<int> sig2;
+ mod_a a("a");
+ mod_b b("b");
+ mod_c c("c");
+ a.in( sig1 );
+ a.out( sig2 );
+ b.out( sig1 );
+ b.in( sig2 );
+
+ sc_start(0, SC_NS);
+
+ cout << sig1.name() << endl;
+ cout << sig2.name() << endl;
+ cout << a.name() << endl;
+ cout << b.name() << endl;
+ cout << c.name() << endl;
+ cout << a.in.name() << endl;
+ cout << a.out.name() << endl;
+ cout << b.out.name() << endl;
+ cout << b.in.name() << endl;
+ cout << c.a.name() << endl;
+ cout << c.b.name() << endl;
+ cout << c.sig1.name() << endl;
+ cout << c.sig2.name() << endl;
+ cout << c.a.in.name() << endl;
+ cout << c.a.out.name() << endl;
+ cout << c.b.out.name() << endl;
+ cout << c.b.in.name() << endl;
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test05/golden/test05.log b/src/systemc/tests/systemc/kernel/sc_module/test05/golden/test05.log
new file mode 100644
index 000000000..d923779ad
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test05/golden/test05.log
@@ -0,0 +1,34 @@
+SystemC Simulation
+1
+1
+2
+2
+500 ps
+***
+sc_module a
+sc_module b
+sc_clock clock_0
+sc_signal signal_0
+sc_module c
+sc_method_process clock_0_posedge_action_0
+sc_method_process clock_0_negedge_action_0
+***
+sc_in a.port_0
+sc_out a.port_1
+sc_method_process a.main_action
+***
+sc_in b.port_0
+sc_thread_process b.main_action
+***
+sc_in c.port_0
+sc_module c.a
+sc_module c.b
+sc_signal c.signal_0
+sc_cthread_process c.main_action
+***
+sc_in c.a.port_0
+sc_out c.a.port_1
+sc_method_process c.a.main_action
+***
+sc_in c.b.port_0
+sc_thread_process c.b.main_action
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test05/test05.cpp b/src/systemc/tests/systemc/kernel/sc_module/test05/test05.cpp
new file mode 100644
index 000000000..8bdad10ea
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test05/test05.cpp
@@ -0,0 +1,143 @@
+/*****************************************************************************
+
+ 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 the child objects of a module and the simcontext
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_in_clk clk;
+ sc_out<int> out;
+
+ int a;
+
+ void main_action()
+ {
+ out = ++ a;
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_METHOD( main_action );
+ sensitive << clk.pos();
+ a = 0;
+ }
+};
+
+SC_MODULE( mod_b )
+{
+ sc_in<int> in;
+
+ void main_action()
+ {
+ while( true ) {
+ wait();
+ cout << in.read() << endl;
+ }
+ }
+
+ SC_CTOR( mod_b )
+ {
+ SC_THREAD( main_action );
+ sensitive << in;
+ }
+};
+
+SC_MODULE( mod_c )
+{
+ sc_in_clk clk;
+
+ void main_action()
+ {
+ while( true ) {
+ cout << sc_time_stamp() << endl;
+ wait();
+ }
+ }
+
+ mod_a a;
+ mod_b b;
+ sc_signal<int> sig;
+
+ SC_CTOR( mod_c )
+ : a( "a" ), b( "b" )
+ {
+ SC_CTHREAD( main_action, clk.neg() );
+ a.clk( clk );
+ a.out( sig );
+ b.in( sig );
+ }
+};
+
+void
+print_child_objects( const ::std::vector<sc_object*>& child_objects_ )
+{
+ int size = child_objects_.size();
+ cout << "***\n";
+ for( int i = 0; i < size; ++ i ) {
+ sc_object* object = child_objects_[i];
+ cout << object->kind() << " " << object->name() << endl;
+ }
+}
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+ mod_b b( "b" );
+ sc_clock clk;
+ sc_signal<int> sig;
+
+ a.clk( clk );
+ a.out( sig );
+ b.in( sig );
+
+ mod_c c( "c" );
+ c.clk( clk );
+
+ sc_start(1, SC_NS);
+
+ print_child_objects( sc_get_top_level_objects() );
+ print_child_objects( a.get_child_objects() );
+ print_child_objects( b.get_child_objects() );
+ print_child_objects( c.get_child_objects() );
+ print_child_objects( c.a.get_child_objects() );
+ print_child_objects( c.b.get_child_objects() );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test06/golden/test06.log b/src/systemc/tests/systemc/kernel/sc_module/test06/golden/test06.log
new file mode 100644
index 000000000..015bf7741
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test06/golden/test06.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+
+Warning: (W569) sc_module(const char*), sc_module(const std::string&) have been deprecated, use sc_module(const sc_module_name&): module_a
+In file: <removed by verify.pl>
+module_a
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test06/test06.cpp b/src/systemc/tests/systemc/kernel/sc_module/test06/test06.cpp
new file mode 100644
index 000000000..9abf0ea0b
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test06/test06.cpp
@@ -0,0 +1,60 @@
+/*****************************************************************************
+
+ 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: 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 the sc_module::sc_module(const std::string&)
+
+#include "systemc.h"
+
+
+SC_MODULE( mod_a )
+{
+
+ mod_a(const std::string &m) : sc_module(m)
+ { end_module(); }
+
+};
+
+
+int
+sc_main( int, char*[] )
+{
+ const std::string nm = "module_a";
+ mod_a a(nm );
+ cout<<a.name()<<endl;;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test07/golden/test07.log b/src/systemc/tests/systemc/kernel/sc_module/test07/golden/test07.log
new file mode 100644
index 000000000..03a39e2a6
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test07/golden/test07.log
@@ -0,0 +1,7 @@
+SystemC Simulation
+
+Warning: (W569) sc_module(const char*), sc_module(const std::string&) have been deprecated, use sc_module(const sc_module_name&): m
+In file: <removed by verify.pl>
+
+Warning: (W509) module construction not properly completed: did you forget to add a sc_module_name parameter to your module constructor?: module 'm'
+In file: <removed by verify.pl>
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test07/test07.cpp b/src/systemc/tests/systemc/kernel/sc_module/test07/test07.cpp
new file mode 100644
index 000000000..f6ed8aa54
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test07/test07.cpp
@@ -0,0 +1,55 @@
+/*****************************************************************************
+
+ 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-03-22
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of missing sc_module_name ctor parameter warning
+
+#include "systemc.h"
+
+SC_MODULE( my_mod )
+{
+ my_mod( const char* nm ) : sc_module( nm ) {}
+};
+
+int
+sc_main( int, char*[] )
+{
+ my_mod m( "m" );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test08/golden/test08.log b/src/systemc/tests/systemc/kernel/sc_module/test08/golden/test08.log
new file mode 100644
index 000000000..be94b9e0f
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test08/golden/test08.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+
+Error: (E533) module name stack is empty: did you forget to add a sc_module_name parameter to your module constructor?
+In file: <removed by verify.pl>
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test08/test08.cpp b/src/systemc/tests/systemc/kernel/sc_module/test08/test08.cpp
new file mode 100644
index 000000000..cea5c11d7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test08/test08.cpp
@@ -0,0 +1,53 @@
+/*****************************************************************************
+
+ 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-03-22
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of missing sc_module_name ctor parameter error
+
+#include "systemc.h"
+
+SC_MODULE( my_mod )
+{
+ my_mod() {}
+};
+
+int
+sc_main( int, char*[] )
+{
+ my_mod m;
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test09/golden/test09.log b/src/systemc/tests/systemc/kernel/sc_module/test09/golden/test09.log
new file mode 100644
index 000000000..f428ebc24
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test09/golden/test09.log
@@ -0,0 +1,124 @@
+SystemC Simulation
+0 s: ModuleBase
+0 s: NonModuleDerived
+0 s: ModuleDerived
+0 s: NonModuleDerived
+0 s: ModuleBase
+0 s: ModuleDerived
+500 ps: NonModuleDerived
+500 ps: ModuleBase
+500 ps: ModuleDerived
+1 ns: NonModuleDerived
+1 ns: ModuleBase
+1 ns: ModuleDerived
+1500 ps: NonModuleDerived
+1500 ps: ModuleBase
+1500 ps: ModuleDerived
+2 ns: NonModuleDerived
+2 ns: ModuleBase
+2 ns: ModuleDerived
+2500 ps: NonModuleDerived
+2500 ps: ModuleBase
+2500 ps: ModuleDerived
+3 ns: NonModuleDerived
+3 ns: ModuleBase
+3 ns: ModuleDerived
+3500 ps: NonModuleDerived
+3500 ps: ModuleBase
+3500 ps: ModuleDerived
+4 ns: NonModuleDerived
+4 ns: ModuleBase
+4 ns: ModuleDerived
+4500 ps: NonModuleDerived
+4500 ps: ModuleBase
+4500 ps: ModuleDerived
+5 ns: NonModuleDerived
+5 ns: ModuleBase
+5 ns: ModuleDerived
+5500 ps: NonModuleDerived
+5500 ps: ModuleBase
+5500 ps: ModuleDerived
+6 ns: NonModuleDerived
+6 ns: ModuleBase
+6 ns: ModuleDerived
+6500 ps: NonModuleDerived
+6500 ps: ModuleBase
+6500 ps: ModuleDerived
+7 ns: NonModuleDerived
+7 ns: ModuleBase
+7 ns: ModuleDerived
+7500 ps: NonModuleDerived
+7500 ps: ModuleBase
+7500 ps: ModuleDerived
+8 ns: NonModuleDerived
+8 ns: ModuleBase
+8 ns: ModuleDerived
+8500 ps: NonModuleDerived
+8500 ps: ModuleBase
+8500 ps: ModuleDerived
+9 ns: NonModuleDerived
+9 ns: ModuleBase
+9 ns: ModuleDerived
+9500 ps: NonModuleDerived
+9500 ps: ModuleBase
+9500 ps: ModuleDerived
+10 ns: NonModuleDerived
+10 ns: ModuleBase
+10 ns: ModuleDerived
+10500 ps: NonModuleDerived
+10500 ps: ModuleBase
+10500 ps: ModuleDerived
+11 ns: NonModuleDerived
+11 ns: ModuleBase
+11 ns: ModuleDerived
+11500 ps: NonModuleDerived
+11500 ps: ModuleBase
+11500 ps: ModuleDerived
+12 ns: NonModuleDerived
+12 ns: ModuleBase
+12 ns: ModuleDerived
+12500 ps: NonModuleDerived
+12500 ps: ModuleBase
+12500 ps: ModuleDerived
+13 ns: NonModuleDerived
+13 ns: ModuleBase
+13 ns: ModuleDerived
+13500 ps: NonModuleDerived
+13500 ps: ModuleBase
+13500 ps: ModuleDerived
+14 ns: NonModuleDerived
+14 ns: ModuleBase
+14 ns: ModuleDerived
+14500 ps: NonModuleDerived
+14500 ps: ModuleBase
+14500 ps: ModuleDerived
+15 ns: NonModuleDerived
+15 ns: ModuleBase
+15 ns: ModuleDerived
+15500 ps: NonModuleDerived
+15500 ps: ModuleBase
+15500 ps: ModuleDerived
+16 ns: NonModuleDerived
+16 ns: ModuleBase
+16 ns: ModuleDerived
+16500 ps: NonModuleDerived
+16500 ps: ModuleBase
+16500 ps: ModuleDerived
+17 ns: NonModuleDerived
+17 ns: ModuleBase
+17 ns: ModuleDerived
+17500 ps: NonModuleDerived
+17500 ps: ModuleBase
+17500 ps: ModuleDerived
+18 ns: NonModuleDerived
+18 ns: ModuleBase
+18 ns: ModuleDerived
+18500 ps: NonModuleDerived
+18500 ps: ModuleBase
+18500 ps: ModuleDerived
+19 ns: NonModuleDerived
+19 ns: ModuleBase
+19 ns: ModuleDerived
+19500 ps: NonModuleDerived
+19500 ps: ModuleBase
+19500 ps: ModuleDerived
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test09/test09.cpp b/src/systemc/tests/systemc/kernel/sc_module/test09/test09.cpp
new file mode 100644
index 000000000..a0f1b1b74
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test09/test09.cpp
@@ -0,0 +1,106 @@
+/*****************************************************************************
+
+ 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 -- Test derivation from and to sc_module instances.
+
+ Original Author: Andy Goodrich, Forte Design Systemc, Inc. 2003-10-01
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+
+// sc_module ---> non-sc_module
+
+SC_MODULE(ModuleBase)
+{
+ public:
+ SC_CTOR(ModuleBase)
+ {
+ }
+ void base_method()
+ {
+ cout << sc_time_stamp() << ": ModuleBase" << endl;
+ }
+ sc_in_clk m_clk;
+};
+
+class NonModuleDerived : public ModuleBase
+{
+ public:
+ SC_HAS_PROCESS(NonModuleDerived);
+ NonModuleDerived(sc_module_name name_) : ModuleBase(name_)
+ {
+ SC_METHOD(base_method)
+ sensitive << m_clk;
+ SC_METHOD(derived_method)
+ sensitive << m_clk;
+ }
+ void derived_method()
+ {
+ cout << sc_time_stamp() << ": NonModuleDerived" << endl;
+ }
+};
+
+// non-sc_module ---> sc_module
+
+class NonModuleBase
+{
+ public:
+ sc_in_clk m_clk;
+};
+
+SC_MODULE(ModuleDerived), public NonModuleBase
+{
+ SC_CTOR(ModuleDerived) : NonModuleBase()
+ {
+ SC_METHOD(derived_method)
+ sensitive << m_clk;
+ }
+ void derived_method()
+ {
+ cout << sc_time_stamp() << ": ModuleDerived" << endl;
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ NonModuleDerived non_derived("nonderived");
+ ModuleDerived derived("derived");
+ non_derived.m_clk(clock);
+ derived.m_clk(clock);
+
+ sc_start(20, SC_NS);
+ return 0;
+}
+
+
+
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test10/golden/test10.log b/src/systemc/tests/systemc/kernel/sc_module/test10/golden/test10.log
new file mode 100644
index 000000000..9f139851e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test10/golden/test10.log
@@ -0,0 +1,6 @@
+SystemC Simulation
+0 s
+0 s
+500 ps
+1 ns
+1500 ps
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test10/test10.cpp b/src/systemc/tests/systemc/kernel/sc_module/test10/test10.cpp
new file mode 100644
index 000000000..87716b7fb
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test10/test10.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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test10.cpp -- Test sc_module::set_stack_size
+
+ Original Author: Andy Goodrich, Forte Design Systemc, Inc. 2003-10-13
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+
+#include "systemc.h"
+
+SC_MODULE(A)
+{
+ SC_CTOR(A)
+ {
+ SC_THREAD(thread);
+ sensitive << m_clk;
+ set_stack_size(0x600000);
+ }
+ void thread()
+ {
+ int x[0x100000]; // Grab a lot of stack...
+ x[0x100000-1] = 42; // ... and then modify the last location`
+
+ for (;;)
+ {
+ cout << sc_time_stamp() << endl;
+ wait();
+ }
+ }
+ sc_in_clk m_clk;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ A a("a");
+ a.m_clk(clock);
+
+ sc_start(2, SC_NS);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module_name/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_module_name/test01/golden/test01.log
new file mode 100644
index 000000000..e0851dcd1
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module_name/test01/golden/test01.log
@@ -0,0 +1,3 @@
+SystemC Simulation
+m1
+m2
diff --git a/src/systemc/tests/systemc/kernel/sc_module_name/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_module_name/test01/test01.cpp
new file mode 100644
index 000000000..48ea7cb63
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module_name/test01/test01.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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ 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:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of module inheritance and sc_module_name
+
+#include "systemc.h"
+
+class base_mod
+: public sc_module
+{
+public:
+ base_mod( sc_module_name name_ )
+ : sc_module( name_ )
+ {}
+};
+
+class derived_mod
+: public base_mod
+{
+public:
+ derived_mod( sc_module_name name_ )
+ : base_mod( name_ )
+ {}
+};
+
+int
+sc_main( int, char*[] )
+{
+ base_mod m1( "m1" );
+ derived_mod m2( "m2" );
+
+ sc_start(0, SC_NS);
+
+ cout << m1.name() << endl;
+ cout << m2.name() << endl;
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_name_gen/test1/golden/test1.log b/src/systemc/tests/systemc/kernel/sc_name_gen/test1/golden/test1.log
new file mode 100644
index 000000000..dc1ce1ff0
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_name_gen/test1/golden/test1.log
@@ -0,0 +1,20 @@
+SystemC Simulation
+
+Warning: (W505) object already exists: a.abc. Latter declaration will be renamed to a.abc_0
+In file: <removed by verify.pl>
+
+Warning: (W505) object already exists: a.def. Latter declaration will be renamed to a.def_0
+In file: <removed by verify.pl>
+
+Warning: (W505) object already exists: a.def. Latter declaration will be renamed to a.def_1
+In file: <removed by verify.pl>
+
+Warning: (W505) object already exists: a.ghi. Latter declaration will be renamed to a.ghi_0
+In file: <removed by verify.pl>
+a.def
+a.def_0
+a.def_1
+a.ghi
+a.ghi_0
+a.abc_0
+a.abc
diff --git a/src/systemc/tests/systemc/kernel/sc_name_gen/test1/test1.cpp b/src/systemc/tests/systemc/kernel/sc_name_gen/test1/test1.cpp
new file mode 100644
index 000000000..9604a37d6
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_name_gen/test1/test1.cpp
@@ -0,0 +1,80 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test1.cpp --
+
+ Original Author: Andy Goodrich, Forte Design Systems 16 July 2004
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// TEST THAT sc_gen_unique_user_name() GENERATES THE CORRECT NAMING.
+
+#include "systemc.h"
+
+SC_MODULE(A)
+{
+ SC_CTOR(A)
+ {
+ SC_CTHREAD(abc, m_clk.pos());
+ SC_CTHREAD(abc, m_clk.pos());
+ SC_METHOD(def);
+ SC_METHOD(def);
+ SC_METHOD(def);
+ SC_THREAD(ghi);
+ SC_THREAD(ghi);
+ }
+ void abc()
+ {
+ sc_curr_proc_handle cpi = sc_get_curr_simcontext()->get_curr_proc_info();
+ cout << cpi->process_handle->name() << endl;
+ }
+ void def()
+ {
+ sc_curr_proc_handle cpi = sc_get_curr_simcontext()->get_curr_proc_info();
+ cout << cpi->process_handle->name() << endl;
+ }
+ void ghi()
+ {
+ sc_curr_proc_handle cpi = sc_get_curr_simcontext()->get_curr_proc_info();
+ cout << cpi->process_handle->name() << endl;
+ }
+ sc_in_clk m_clk;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ A a("a");
+ sc_clock clock;
+ a.m_clk(clock);
+
+ sc_start(10, SC_NS);
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_object/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_object/test01/golden/test01.log
new file mode 100644
index 000000000..a2b78ddf0
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_object/test01/golden/test01.log
@@ -0,0 +1,20 @@
+SystemC Simulation
+attributes of object:
+a1
+a2
+a3
+
+name = module
+kind = sc_module
+name = module
+kind = sc_module
+
+module
+
+Module base name: module
+number of attributes: 3
+after removing attribute a1
+number of attributes: 2
+removing all attributes
+number of attributes: 0
+
diff --git a/src/systemc/tests/systemc/kernel/sc_object/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_object/test01/test01.cpp
new file mode 100644
index 000000000..6f14dcd11
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_object/test01/test01.cpp
@@ -0,0 +1,90 @@
+/*****************************************************************************
+
+ 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: 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 attributes
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+
+
+ SC_CTOR( mod_a )
+ {}
+};
+
+
+int
+sc_main( int, char*[] )
+{
+ mod_a module("module");
+ mod_a module_1();
+
+ sc_attr_base a1("a1");
+ sc_attr_base a2("a2");
+ sc_attr_base a3("a3");
+
+ module.add_attribute(a1);
+ module.add_attribute(a2);
+ module.add_attribute(a3);
+
+ cout<<"attributes of object:\n";
+ sc_attr_cltn& att_cltn = module.attr_cltn();
+ sc_attr_cltn::const_iterator it = att_cltn.begin();
+ for( ; it != att_cltn.end(); ++ it ) {
+ cout << (*it)->name() << endl;
+ }
+
+ cout<<endl;
+ module.dump(cout);
+ module.dump();
+ cout<<endl;
+
+ module.print();
+
+ cout<<endl<<endl<<"Module base name: "<<module.basename()<<endl;
+ cout<<"number of attributes: "<< module.num_attributes()<<endl;
+ cout<<"after removing attribute a1\n";
+ module.remove_attribute("a1");
+ cout<<"number of attributes: "<< module.num_attributes()<<endl;
+ cout<<"removing all attributes\n";
+ module.remove_all_attributes( );
+ cout<<"number of attributes: "<< module.num_attributes()<<endl;
+ cout<<endl;
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_object/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/sc_object/test02/golden/test02.log
new file mode 100644
index 000000000..a723fe316
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_object/test02/golden/test02.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+object_0
+object_1
+object_2
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/sc_object/test02/test02.cpp b/src/systemc/tests/systemc/kernel/sc_object/test02/test02.cpp
new file mode 100644
index 000000000..d747694e5
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_object/test02/test02.cpp
@@ -0,0 +1,71 @@
+/*****************************************************************************
+
+ 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: Andy Goodrich, Forte Design Systems, Inc., 2005-12-11
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// Test automatic object name generation.
+
+#include "systemc.h"
+
+class Name : public sc_object {
+ public:
+ Name(const char* name) : sc_object(name)
+ {}
+};
+
+class NoName : public sc_object {
+ public:
+ NoName() : sc_object()
+ {}
+};
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ }
+};
+int sc_main(int argc, char* argv[])
+{
+ Name name(0);
+ Name name1("");
+ NoName no_name;
+
+ cout << name.name() << endl;
+ cout << name1.name() << endl;
+ cout << no_name.name() << endl;
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_object_manager/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_object_manager/test01/golden/test01.log
new file mode 100644
index 000000000..e50eff47c
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_object_manager/test01/golden/test01.log
@@ -0,0 +1,18 @@
+SystemC Simulation
+External:
+ a.a: sc_signal
+ a.b: sc_signal
+ a.c: sc_signal
+ a.signal_0: sc_signal
+ a.signal_1: sc_signal
+ a.signal_2: sc_signal
+
+Internal:
+ a.a: sc_signal
+ a.b: sc_signal
+ a.c: sc_signal
+ a.signal_0: sc_signal
+ a.signal_1: sc_signal
+ a.signal_2: sc_signal
+
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/sc_object_manager/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_object_manager/test01/test01.cpp
new file mode 100644
index 000000000..fe82205e0
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_object_manager/test01/test01.cpp
@@ -0,0 +1,104 @@
+/*****************************************************************************
+
+ 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: Andy Goodrich, Forte Design Systems
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+
+void dump_signals(const char* module_name)
+{
+ sc_simcontext* c_p = sc_get_curr_simcontext();
+ unsigned int mod_name_len = strlen(module_name);
+ sc_object* obj_p;
+ const char* obj_name_p;
+
+
+ for (obj_p = c_p->first_object(); obj_p; obj_p=c_p->next_object())
+ {
+ obj_name_p = obj_p->name();
+ if ( strlen(obj_name_p) > mod_name_len &&
+ !strncmp(obj_p->name(),module_name, mod_name_len) &&
+ !strcmp(obj_p->kind(),"sc_signal") )
+ {
+ cout << " " << obj_p->name() << ": " << obj_p->kind() << endl;
+ }
+ }
+ cout << endl;
+}
+
+SC_MODULE(A)
+{
+ SC_CTOR(A) : a("a"), b("b"), c("c")
+ {
+ }
+ sc_signal<int> a, b, c;
+ sc_in_clk m_clk;
+ sc_signal<int> x, y, z;
+};
+
+
+SC_MODULE(TB)
+{
+ SC_CTOR(TB)
+ {
+ SC_METHOD(sync);
+ sensitive << m_clk.pos();
+ dont_initialize();
+ }
+ void sync()
+ {
+ cout << "Internal: " << endl;
+ dump_signals("a");
+ }
+ sc_in_clk m_clk;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ sc_signal<int> dummy;
+ A module_a("a");
+ TB tb("tb");
+ module_a.m_clk(clock);
+ tb.m_clk(clock);
+
+ cout << "External: " << endl;
+ dump_signals(module_a.name());
+ sc_start(1, SC_NS);
+
+
+ cerr << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_object_manager/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/sc_object_manager/test02/golden/test02.log
new file mode 100644
index 000000000..0d934d401
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_object_manager/test02/golden/test02.log
@@ -0,0 +1,2 @@
+SystemC Simulation
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/sc_object_manager/test02/test02.cpp b/src/systemc/tests/systemc/kernel/sc_object_manager/test02/test02.cpp
new file mode 100644
index 000000000..9a94d134a
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_object_manager/test02/test02.cpp
@@ -0,0 +1,93 @@
+/*****************************************************************************
+
+ 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: Andy Goodrich, Forte Design Systems
+
+ *****************************************************************************/
+/*****************************************************************************
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// TEST THAT THE CORRECT PARENT POINTER IS SET FOR THE before_end_of_elaboration
+// and end_of_elaboration CALLBACKS
+
+#include "systemc.h"
+
+class my_object : public sc_object
+{
+ public:
+ my_object() {}
+ virtual ~my_object() {}
+};
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(thread,m_clk.pos());
+ reset_signal_is(m_reset, true);
+ }
+ void before_end_of_elaboration()
+ {
+ m_before_p = new my_object;
+ }
+ void end_of_elaboration()
+ {
+ m_end_p = new my_object;
+ }
+ void thread()
+ {
+ for (;;)
+ {
+ wait();
+ if ( m_before_p->get_parent_object() == 0 )
+ cout << "before_end_of_elaboration parent is 0!" <<endl;
+ if ( m_end_p->get_parent_object() == 0 )
+ cout << "end_of_elaboration parent is 0!" <<endl;
+ }
+ }
+ my_object* m_before_p;
+ sc_in<bool> m_clk;
+ my_object* m_end_p;
+ sc_in<bool> m_reset;
+};
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+ sc_signal<bool> reset;
+
+ dut.m_clk(clock);
+ dut.m_reset(reset);
+
+ reset = true;
+ sc_start(1, SC_NS);
+ reset = false;
+ sc_start(1, SC_NS);
+
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_process_b/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_process_b/test01/golden/test01.log
new file mode 100644
index 000000000..573bc27a1
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_process_b/test01/golden/test01.log
@@ -0,0 +1,2 @@
+SystemC Simulation
+main action sc_method_process
diff --git a/src/systemc/tests/systemc/kernel/sc_process_b/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_process_b/test01/test01.cpp
new file mode 100644
index 000000000..b8d6642db
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_process_b/test01/test01.cpp
@@ -0,0 +1,65 @@
+/*****************************************************************************
+
+ 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-03-22
+ Ucar Aziz, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date: Andy Goodrich, Forte Design Systems, 10 Aug 05
+ Description of Modification: Rewrite to use sc_process_handle::kind().
+
+ *****************************************************************************/
+
+// test of sc_process_b::kind()
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ void main_action()
+ {
+ cout << "main action ";
+ cout << sc_get_current_process_b()->kind() << endl;
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_METHOD( main_action );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+
+ sc_start( 5, SC_NS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_process_b/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/sc_process_b/test02/golden/test02.log
new file mode 100644
index 000000000..754880b32
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_process_b/test02/golden/test02.log
@@ -0,0 +1,11 @@
+SystemC Simulation
+
+Warning: (W505) object already exists: tb.sync. Latter declaration will be renamed to tb.sync_0
+In file: <removed by verify.pl>
+0 s: tb.sync
+0 s: tb.sync_0
+0 s: tb.sync_0
+0 s: tb.sync
+1 ns: tb.sync_0
+1 ns: tb.sync
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/sc_process_b/test02/test02.cpp b/src/systemc/tests/systemc/kernel/sc_process_b/test02/test02.cpp
new file mode 100644
index 000000000..1da5cefd1
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_process_b/test02/test02.cpp
@@ -0,0 +1,31 @@
+#include "systemc.h"
+
+SC_MODULE(TB)
+{
+ SC_CTOR(TB)
+ {
+ SC_METHOD(sync);
+ sensitive << m_clk.pos();
+ SC_METHOD(sync);
+ sensitive << m_clk.pos();
+ }
+ void sync()
+ {
+ sc_curr_proc_handle cpi =
+ sc_get_curr_simcontext()->get_curr_proc_info();
+ cout << sc_time_stamp() << ": " << cpi->process_handle->name() << endl;
+ }
+ sc_in_clk m_clk;
+};
+
+int sc_main(int argc,char **argv)
+{
+ sc_clock clock;
+ TB tb("tb");
+
+ tb.m_clk(clock);
+ sc_start(2, SC_NS);
+
+ cerr << "Program completed" << endl;
+ return (0);
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_process_b/test03/golden/test03.log b/src/systemc/tests/systemc/kernel/sc_process_b/test03/golden/test03.log
new file mode 100644
index 000000000..e489be005
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_process_b/test03/golden/test03.log
@@ -0,0 +1,13 @@
+SystemC Simulation
+t1.method 1
+t1.thread 3
+t1.method 1
+t1.method 1
+t1.thread 3
+t1.method 1
+t1.thread 3
+t1.method 1
+t1.thread 3
+t1.method 1
+t1.thread 3
+t1.method 1
diff --git a/src/systemc/tests/systemc/kernel/sc_process_b/test03/test03.cpp b/src/systemc/tests/systemc/kernel/sc_process_b/test03/test03.cpp
new file mode 100644
index 000000000..9bc8b29cb
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_process_b/test03/test03.cpp
@@ -0,0 +1,80 @@
+/*****************************************************************************
+
+ 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: Andy Goodrich, Forte Design Systems, 27 July 2005
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+
+// This tests that one can get process handles on static processes.
+
+#include "systemc.h"
+
+
+SC_MODULE(Test) {
+ sc_in<bool> m_clk;
+
+ void method() {
+ sc_process_handle handle = sc_get_current_process_handle();
+ cout << handle.name() << " " << handle.proc_kind() << endl;
+ }
+ void thread() {
+ for (;;)
+ {
+ wait();
+ sc_process_handle handle = sc_get_current_process_handle();
+ cout << handle.name() << " " << handle.proc_kind() << endl;
+ }
+ }
+ SC_CTOR(Test) {
+ SC_METHOD(method);
+ sensitive << m_clk.neg();
+ sc_process_handle method_handle = sc_get_current_process_handle();
+ cout << name() << ".method " << method_handle.proc_kind() << endl;
+ SC_CTHREAD(thread,m_clk.pos());
+ sc_process_handle thread_handle = sc_get_current_process_handle();
+ cout << name() << ".thread " << thread_handle.proc_kind() << endl;
+ }
+};
+
+
+int sc_main(int argc,char *argv[]) {
+
+ Test t1("t1");
+ sc_clock clk("clk",10,SC_NS);
+
+ t1.m_clk(clk);
+
+ sc_start(50,SC_NS);
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_process_handle/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_process_handle/test01/golden/test01.log
new file mode 100644
index 000000000..0d934d401
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_process_handle/test01/golden/test01.log
@@ -0,0 +1,2 @@
+SystemC Simulation
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/sc_process_handle/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_process_handle/test01/test01.cpp
new file mode 100644
index 000000000..5c2730d2c
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_process_handle/test01/test01.cpp
@@ -0,0 +1,205 @@
+/*****************************************************************************
+
+ 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: Andy Goodrich, Forte Design Systems, 8 December 2005
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// Test of return values for sc_process handle instances, along with
+// comparison operators.
+
+#include "systemc.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(process_a, m_clk.pos());
+ SC_THREAD(process_b)
+ sensitive << m_clk.pos();
+ }
+ void process_a()
+ {
+ m_a = sc_get_current_process_handle();
+ sc_process_handle b;
+ sc_process_handle c = sc_get_current_process_handle();
+
+ // TEST COMPARISONS:
+
+ if ( m_a == b )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << " non-null process handle == null process handle" << endl;
+ }
+ if ( m_a != c )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << " process handles for same process not equal" << endl;
+ }
+ wait(1);
+
+ // TEST RETURN VALUES:
+
+ const std::vector<sc_object*>& objects = m_a.get_child_objects();
+ if ( objects.size() != 0 )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << "get_child_objects() returned non-null vector" << endl;
+ }
+ if ( m_a.get_parent_object() == 0 )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << " get_parent_object() returned null value" << endl;
+ }
+ if ( !strcmp( m_a.name(), "") )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << "name() returned empty string" << endl;
+ }
+ if ( m_a.proc_kind() != SC_CTHREAD_PROC_ )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << "proc_kind() returned " << m_a.proc_kind()
+ << " not " << SC_CTHREAD_PROC_ << endl;
+ }
+ if ( m_a.terminated() )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << "terminated() returned true" << endl;
+ }
+ if ( !m_a.valid() )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << "valid() returned false" << endl;
+ }
+ }
+ void process_b()
+ {
+ wait(1);
+ sc_process_handle b = sc_get_current_process_handle();
+ if ( m_a == b )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << " process handles for two different processes were equal"
+ << endl;
+ }
+ if ( b.get_parent_object() == 0 )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << " get_parent_object() returned null value" << endl;
+ }
+ if ( b.proc_kind() != SC_THREAD_PROC_ )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << "proc_kind() returned " << b.proc_kind()
+ << " not " << SC_THREAD_PROC_ << endl;
+ }
+ wait(2);
+ if ( m_a.valid() )
+ {
+ if ( !m_a.terminated() )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << "terminated() returned false" << endl;
+ }
+ }
+ else
+ {
+ if ( m_a.terminated() )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << "terminated() returned true" << endl;
+ }
+ }
+ }
+
+ sc_process_handle m_a;
+ sc_in<bool> m_clk;
+};
+
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+ sc_process_handle handle;
+ sc_process_handle handle2;
+
+ dut.m_clk(clock);
+ if ( handle == handle2 )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << " == operator returned true" << endl;
+ }
+ if ( !(handle != handle2) )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << " != operator returned true" << endl;
+ }
+ const std::vector<sc_object*>& objects = handle.get_child_objects();
+ if ( objects.size() != 0 )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << " get_child_objects() returned non-null vector" << endl;
+ }
+ if ( handle.get_parent_object() != 0 )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << " get_parent_object() returned non-null value" << endl;
+ }
+ if ( strcmp( handle.name(), "") )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << " name() returned non-empty string" << endl;
+ }
+ if ( handle.proc_kind() != SC_NO_PROC_ )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << " proc_kind() returned " << handle.proc_kind()
+ << " not " << SC_NO_PROC_ << endl;
+ }
+ if ( handle.terminated() )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << " terminated() returned true" << endl;
+ }
+ if ( handle.valid() )
+ {
+ cout << __FILE__ << " " << __LINE__
+ << " valid() returned true" << endl;
+ }
+
+ sc_start(10, SC_NS);
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_process_handle/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/sc_process_handle/test02/golden/test02.log
new file mode 100644
index 000000000..0d934d401
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_process_handle/test02/golden/test02.log
@@ -0,0 +1,2 @@
+SystemC Simulation
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/sc_process_handle/test02/test02.cpp b/src/systemc/tests/systemc/kernel/sc_process_handle/test02/test02.cpp
new file mode 100644
index 000000000..6d3edb2a6
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_process_handle/test02/test02.cpp
@@ -0,0 +1,92 @@
+/*****************************************************************************
+
+ 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 -- Test proper process type for terminated processes
+
+ Original Author: Andy Goodrich, Forte Design Systems
+
+ *****************************************************************************/
+/*****************************************************************************
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// TEST THAT THE CORRECT PROCESS TYPE IS MAINTAINED FOR TERMINATED PROCESSES
+
+#include "systemc.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(cthread_target,m_clk.pos());
+ SC_THREAD(thread_target)
+ sensitive << m_clk.pos();
+ SC_CTHREAD(watcher,m_clk.pos());
+ }
+ void cthread_target()
+ {
+ m_cthread_handle = sc_get_current_process_handle();
+ wait();
+ }
+ void thread_target()
+ {
+ m_thread_handle = sc_get_current_process_handle();
+ wait();
+ }
+ void watcher()
+ {
+ wait();
+ wait();
+ if ( m_cthread_handle.valid() )
+ {
+ if ( m_cthread_handle.proc_kind() == SC_NO_PROC_ )
+ cout << "Cthread process handle kind not maintained" << endl;
+ if ( m_cthread_handle.terminated() == false )
+ cout<< "Cthread process handle doesn't show terminated" << endl;
+ }
+ if ( m_thread_handle.valid() )
+ {
+ if ( m_thread_handle.proc_kind() == SC_NO_PROC_ )
+ cout << "Thread process handle kind not maintained" << endl;
+ if ( m_thread_handle.terminated() == false )
+ cout<< "Thread process handle does not show terminated" << endl;
+ }
+ }
+ sc_in<bool> m_clk;
+ sc_process_handle m_cthread_handle;
+ sc_process_handle m_thread_handle;
+};
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+
+ dut.m_clk(clock);
+
+ sc_start(5, SC_NS);
+
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_sensitive/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_sensitive/test01/golden/test01.log
new file mode 100644
index 000000000..e0a49dc03
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_sensitive/test01/golden/test01.log
@@ -0,0 +1,19 @@
+SystemC Simulation
+i = 0
+j = 0
+i = 1
+j = 1
+i = 2
+j = 2
+i = 3
+j = 3
+i = 4
+j = 4
+i = 5
+j = 5
+i = 6
+j = 6
+i = 7
+j = 7
+i = 8
+j = 8
diff --git a/src/systemc/tests/systemc/kernel/sc_sensitive/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_sensitive/test01/test01.cpp
new file mode 100644
index 000000000..c6e1e52f5
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_sensitive/test01/test01.cpp
@@ -0,0 +1,122 @@
+/*****************************************************************************
+
+ 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-03-22
+ Ucar Aziz, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: test01.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:04 acg
+// systemc_tests-2.3
+//
+// Revision 1.2 2006/01/19 00:46:58 acg
+// Andy Goodrich: Added CVS logging.
+//
+
+// test of sc_sensitive::operator()(sc_cthread_process*, sc_in(inout)<bool>)
+
+#include "systemc.h"
+
+
+SC_MODULE( mod_a )
+{
+ sc_in<bool> clk;
+ sc_in<bool> in1;
+
+ void main_action1()
+ {
+ int i = 0;
+ while( true ) {
+ wait();
+ cout << "i = " << i << endl;
+ i ++;
+ }
+ }
+
+ void main_action2()
+ {
+ int j = 0;
+ while( true ) {
+ wait();
+ cout << "j = " << j << endl;
+ j ++;
+ }
+ }
+
+ SC_CTOR(mod_a)
+ {
+ SC_CTHREAD( main_action1, clk );
+ SC_CTHREAD( main_action2, in1 );
+ }
+};
+
+SC_MODULE( mod_b )
+{
+ sc_in<bool> clk;
+ sc_inout<bool> in1;
+
+ void main_action()
+ {
+ bool j = true;
+ while( true ) {
+ wait();
+ in1->write( j );
+ j = !j;
+ }
+ }
+
+ SC_CTOR( mod_b )
+ {
+ SC_CTHREAD( main_action, clk );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ sc_clock clk( "clk", 10, SC_NS );
+ sc_clock clk1( "clk1", 5, SC_NS );
+ sc_signal<bool> channel;
+ mod_a a( "a" );
+ mod_b b( "b" );
+
+ b.clk( clk1 );
+ b.in1( channel );
+ a.clk( clk );
+ a.in1( channel );
+
+ sc_start( 100, SC_NS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_sensitive/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/sc_sensitive/test02/golden/test02.log
new file mode 100644
index 000000000..358509035
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_sensitive/test02/golden/test02.log
@@ -0,0 +1,31 @@
+SystemC Simulation
+
+Info: (I804) /IEEE_Std_1666/deprecated: use of () to specify sensitivity is deprecated, use << instead
+
+Info: (I804) /IEEE_Std_1666/deprecated: sc_sensitive_neg is deprecated use sc_sensitive << with neg() instead
+j = 0
+i = 0
+j = 1
+i = 1
+j = 2
+i = 2
+j = 3
+i = 3
+j = 4
+i = 4
+j = 5
+i = 5
+j = 6
+i = 6
+j = 7
+i = 7
+j = 8
+i = 8
+
+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_sensitive/test02/test02.cpp b/src/systemc/tests/systemc/kernel/sc_sensitive/test02/test02.cpp
new file mode 100644
index 000000000..1607be024
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_sensitive/test02/test02.cpp
@@ -0,0 +1,128 @@
+/*****************************************************************************
+
+ 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-03-22
+ Ucar Aziz, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: test02.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:04 acg
+// systemc_tests-2.3
+//
+// Revision 1.2 2006/01/19 00:47:01 acg
+// Andy Goodrich: Added CVS logging.
+//
+
+// test of sc_sensitive_neg::operator(<<)()(sc_inout<bool>)
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_in<bool> in1;
+ sc_in<bool> in2;
+
+ void main_action1()
+ {
+ int i = 0;
+ while( true ) {
+ wait();
+ cout << "i = " << i << endl;
+ i ++;
+ }
+ }
+
+ void main_action2()
+ {
+ int j = 0;
+ while( true ) {
+ wait();
+ cout << "j = " << j << endl;
+ j ++;
+ }
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_THREAD( main_action1 );
+ sensitive_neg( in1 );
+ SC_THREAD( main_action2 );
+ sensitive_neg << in2;
+ }
+};
+
+SC_MODULE( mod_b )
+{
+ sc_in<bool> clk;
+ sc_inout<bool> in1;
+
+ void main_action()
+ {
+ bool j = true;
+ while( true ) {
+ wait();
+ in1->write( j );
+ j = !j;
+ }
+ }
+
+ SC_CTOR( mod_b )
+ {
+ SC_CTHREAD( main_action, clk );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ sc_clock clk1( "clk", 5, SC_NS );
+ sc_clock clk2( "clk1", 5, SC_NS );
+ sc_signal<bool> sig_1;
+ sc_signal<bool> sig_2;
+ mod_a a( "a" );
+ mod_b b1( "b1" );
+ mod_b b2( "b2" );
+
+ b1.clk( clk1 );
+ b1.in1( sig_1 );
+ b2.clk( clk2 );
+ b2.in1( sig_2 );
+
+ a.in1( sig_1 );
+ a.in2( sig_2 );
+
+ sc_start( 100, SC_NS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_sensitive/test03/golden/test03.log b/src/systemc/tests/systemc/kernel/sc_sensitive/test03/golden/test03.log
new file mode 100644
index 000000000..9523bdb62
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_sensitive/test03/golden/test03.log
@@ -0,0 +1,33 @@
+SystemC Simulation
+
+Info: (I804) /IEEE_Std_1666/deprecated: use of () to specify sensitivity is deprecated, use << instead
+
+Info: (I804) /IEEE_Std_1666/deprecated: sc_sensitive_pos is deprecated use sc_sensitive << with pos() instead
+j = 0
+i = 0
+j = 1
+i = 1
+j = 2
+i = 2
+j = 3
+i = 3
+j = 4
+i = 4
+j = 5
+i = 5
+j = 6
+i = 6
+j = 7
+i = 7
+j = 8
+i = 8
+j = 9
+i = 9
+
+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_sensitive/test03/test03.cpp b/src/systemc/tests/systemc/kernel/sc_sensitive/test03/test03.cpp
new file mode 100644
index 000000000..5eca3d7a2
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_sensitive/test03/test03.cpp
@@ -0,0 +1,128 @@
+/*****************************************************************************
+
+ 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-03-22
+ Ucar Aziz, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: test03.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:04 acg
+// systemc_tests-2.3
+//
+// Revision 1.2 2006/01/19 00:47:04 acg
+// Andy Goodrich: Added CVS logging.
+//
+
+// test of sc_sensitive_pos::operator(<<)()(sc_inout<bool>)
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_in<bool> in1;
+ sc_in<bool> in2;
+
+ void main_action1()
+ {
+ int i = 0;
+ while( true ) {
+ wait();
+ cout << "i = " << i << endl;
+ i ++;
+ }
+ }
+
+ void main_action2()
+ {
+ int j = 0;
+ while( true ) {
+ wait();
+ cout << "j = " << j << endl;
+ j ++;
+ }
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_THREAD( main_action1 );
+ sensitive_pos( in1 );
+ SC_THREAD( main_action2 );
+ sensitive_pos << in2;
+ }
+};
+
+SC_MODULE( mod_b )
+{
+ sc_in<bool> clk;
+ sc_inout<bool> in1;
+
+ void main_action()
+ {
+ bool j = true;
+ while( true ) {
+ wait();
+ in1->write( j );
+ j = !j;
+ }
+ }
+
+ SC_CTOR( mod_b )
+ {
+ SC_CTHREAD( main_action, clk );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ sc_clock clk1( "clk", 5, SC_NS );
+ sc_clock clk2( "clk1", 5, SC_NS );
+ sc_signal<bool> sig_1;
+ sc_signal<bool> sig_2;
+ mod_a a( "a" );
+ mod_b b1( "b1" );
+ mod_b b2( "b2" );
+
+ b1.clk( clk1 );
+ b1.in1( sig_1 );
+ b2.clk( clk2 );
+ b2.in1( sig_2 );
+
+ a.in1( sig_1 );
+ a.in2( sig_2 );
+
+ sc_start( 100, SC_NS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_sensitive/test04/golden/test04.log b/src/systemc/tests/systemc/kernel/sc_sensitive/test04/golden/test04.log
new file mode 100644
index 000000000..00de35f19
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_sensitive/test04/golden/test04.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+
+Error: (E526) make sensitive failed: simulation running
+In file: <removed by verify.pl>
+In process: x.able @ 0 s
diff --git a/src/systemc/tests/systemc/kernel/sc_sensitive/test04/test04.cpp b/src/systemc/tests/systemc/kernel/sc_sensitive/test04/test04.cpp
new file mode 100644
index 000000000..7892cd28a
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_sensitive/test04/test04.cpp
@@ -0,0 +1,31 @@
+#include "systemc.h"
+
+SC_MODULE(X)
+{
+ SC_CTOR(X)
+ {
+ SC_THREAD(able);
+ sensitive << clk.pos();
+ }
+
+ void able()
+ {
+ for (;;)
+ {
+ wait();
+ sensitive << clk.posedge_event();
+ cout << "able: " << sc_time_stamp() << endl;
+ }
+ }
+ sc_in_clk clk;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ X x("x");
+ x.clk(clock);
+
+ sc_start(100, SC_NS);
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_sensitive/test05/golden/test05.log b/src/systemc/tests/systemc/kernel/sc_sensitive/test05/golden/test05.log
new file mode 100644
index 000000000..252bd31f1
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_sensitive/test05/golden/test05.log
@@ -0,0 +1,7 @@
+SystemC Simulation
+1 ns
+5 ns
+6 ns
+1006 ns
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/sc_sensitive/test05/test05.cpp b/src/systemc/tests/systemc/kernel/sc_sensitive/test05/test05.cpp
new file mode 100644
index 000000000..fc2a8b21d
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_sensitive/test05/test05.cpp
@@ -0,0 +1,37 @@
+#include "systemc.h"
+
+SC_MODULE(TB)
+{
+ SC_CTOR(TB)
+ {
+ SC_THREAD(exec);
+ sensitive << m_clk.pos();
+ }
+ void exec()
+ {
+ for (;;)
+ {
+ wait(2);
+ cout << sc_time_stamp() << endl;
+ wait(4);
+ cout << sc_time_stamp() << endl;
+ wait(1);
+ cout << sc_time_stamp() << endl;
+ wait(1000);
+ cout << sc_time_stamp() << endl;
+ sc_stop();
+ }
+ }
+ sc_in_clk m_clk;
+};
+
+int sc_main( int, char*[] )
+{
+ sc_clock clock;
+ TB tb("tb");
+
+ tb.m_clk(clock);
+ sc_start(2000, SC_NS);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_simcontext/sc_delta_count/golden/sc_delta_count.log b/src/systemc/tests/systemc/kernel/sc_simcontext/sc_delta_count/golden/sc_delta_count.log
new file mode 100644
index 000000000..bb953300a
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_simcontext/sc_delta_count/golden/sc_delta_count.log
@@ -0,0 +1,6 @@
+SystemC Simulation
+2
+4
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+Program completed after 5 ns
diff --git a/src/systemc/tests/systemc/kernel/sc_simcontext/sc_delta_count/sc_delta_count.cpp b/src/systemc/tests/systemc/kernel/sc_simcontext/sc_delta_count/sc_delta_count.cpp
new file mode 100644
index 000000000..087e7157e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_simcontext/sc_delta_count/sc_delta_count.cpp
@@ -0,0 +1,33 @@
+#include "systemc.h"
+
+SC_MODULE(TB)
+{
+ SC_CTOR(TB)
+ {
+ SC_METHOD(method)
+ sensitive << m_flipper;
+ SC_THREAD(thread)
+ }
+ void method()
+ {
+ }
+ void thread()
+ {
+ m_flipper = !m_flipper;
+ wait(2, SC_NS);
+ cout << sc_delta_count() << endl;
+ m_flipper = !m_flipper;
+ wait(3, SC_NS);
+ cout << sc_delta_count() << endl;
+ sc_stop();
+ }
+ sc_signal<bool> m_flipper;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ TB tb("tb");
+ sc_start();
+ cout << "Program completed after " << sc_time_stamp() << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_simcontext/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_simcontext/test01/golden/test01.log
new file mode 100644
index 000000000..3db91fdf5
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_simcontext/test01/golden/test01.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+0 main_action_method called
+0 main_action_thread called
+1 main_action_cthread called
diff --git a/src/systemc/tests/systemc/kernel/sc_simcontext/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_simcontext/test01/test01.cpp
new file mode 100644
index 000000000..bbe48deb5
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_simcontext/test01/test01.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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ 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:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of SC_METHOD and SC_THREAD (but not SC_CTHREAD) initialization
+
+#include "systemc.h"
+
+SC_MODULE( mod_a ) {
+
+ sc_in_clk clk;
+
+ void main_action_method()
+ {
+ cout << sc_delta_count()
+ << " main_action_method called" << endl;
+ }
+
+ void main_action_thread()
+ {
+ while( true ) {
+ cout << sc_delta_count()
+ << " main_action_thread called" << endl;
+ wait(); // for what?
+ }
+ }
+
+ void main_action_cthread()
+ {
+ while( true ) {
+ cout << sc_delta_count()
+ << " main_action_cthread called" << endl;
+ wait();
+ }
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_METHOD( main_action_method );
+ SC_THREAD( main_action_thread );
+ SC_CTHREAD( main_action_cthread, clk.pos() );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ sc_clock clk;
+
+ mod_a a( "a" );
+ a.clk( clk );
+
+ sc_start(1, SC_NS);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_simcontext/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/sc_simcontext/test02/golden/test02.log
new file mode 100644
index 000000000..df6c708dc
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_simcontext/test02/golden/test02.log
@@ -0,0 +1,24 @@
+SystemC Simulation
+
+Warning: (W524) dont_initialize() has no effect for SC_CTHREADs
+In file: <removed by verify.pl>
+0 s method_a
+0 s thread_a
+500 ps method_a
+500 ps method_b
+500 ps cthread_a
+500 ps thread_a
+500 ps cthread_b
+500 ps thread_b
+1500 ps method_a
+1500 ps method_b
+1500 ps cthread_a
+1500 ps thread_a
+1500 ps cthread_b
+1500 ps thread_b
+2500 ps method_a
+2500 ps method_b
+2500 ps cthread_a
+2500 ps thread_a
+2500 ps cthread_b
+2500 ps thread_b
diff --git a/src/systemc/tests/systemc/kernel/sc_simcontext/test02/test02.cpp b/src/systemc/tests/systemc/kernel/sc_simcontext/test02/test02.cpp
new file mode 100644
index 000000000..f168c6829
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_simcontext/test02/test02.cpp
@@ -0,0 +1,139 @@
+/*****************************************************************************
+
+ 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 process initialization -- the dont_initialize() method
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_in_clk clk;
+
+ void write( const char* msg )
+ {
+ cout << sc_time_stamp() << " " << msg << endl;
+ }
+
+ void method_a()
+ {
+ write( "method_a" );
+ }
+
+ void thread_a()
+ {
+ while( true ) {
+ write( "thread_a" );
+ wait();
+ }
+ }
+
+ void cthread_a()
+ {
+ while( true ) {
+ write( "cthread_a" );
+ wait();
+ }
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_METHOD( method_a );
+ sensitive << clk.neg();
+ SC_THREAD( thread_a );
+ sensitive << clk.neg();
+ SC_CTHREAD( cthread_a, clk.neg() );
+ }
+};
+
+SC_MODULE( mod_b )
+{
+ sc_in_clk clk;
+
+ void write( const char* msg )
+ {
+ cout << sc_time_stamp() << " " << msg << endl;
+ }
+
+ void method_b()
+ {
+ write( "method_b" );
+ }
+
+ void thread_b()
+ {
+ while( true ) {
+ write( "thread_b" );
+ wait();
+ }
+ }
+
+ void cthread_b()
+ {
+ while( true ) {
+ write( "cthread_b" );
+ wait();
+ }
+ }
+
+ SC_CTOR( mod_b )
+ {
+ SC_METHOD( method_b );
+ sensitive << clk.neg();
+ dont_initialize();
+ SC_THREAD( thread_b );
+ sensitive << clk.neg();
+ dont_initialize();
+ SC_CTHREAD( cthread_b, clk.neg() );
+ dont_initialize();
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ sc_clock clk;
+
+ mod_a a( "a" );
+ mod_b b( "b" );
+
+ a.clk( clk );
+ b.clk( clk );
+
+ sc_start( 3, SC_NS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test1/golden/test1.log b/src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test1/golden/test1.log
new file mode 100644
index 000000000..8cb9086ca
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test1/golden/test1.log
@@ -0,0 +1,50 @@
+SystemC Simulation
+Event Start Parameters End Parameters
+------------- ---------------- --------------
+
+sc_start(1, SC_NS) - 0 s 0
+ X::comb() - 0 s 0
+ 1 ns 0
+~tweak - 1 ns 0
+ 1 ns 0
+sc_start(0, SC_NS) - 1 ns 0
+ 1 ns 1
+sc_start(0, SC_NS) - 1 ns 1
+ X::comb() - 1 ns 1
+ X::sync() - 1 ns 1
+ 1 ns 1
+sc_start(1, SC_NS) - 1 ns 1
+ 2 ns 1
+sc_start(0, SC_NS) - 2 ns 1
+ 2 ns 1
+sc_start(0, SC_NS) - 2 ns 1
+ X::sync() - 2 ns 1
+ 2 ns 1
+~tweak - 2 ns 1
+ 2 ns 1
+sc_start(0, SC_NS) - 2 ns 1
+ 2 ns 0
+~tweak - 2 ns 0
+ 2 ns 0
+sc_start(0, SC_NS) - 2 ns 0
+ X::comb() - 2 ns 0
+ 2 ns 1
+sc_start(0, SC_NS) - 2 ns 1
+ X::comb() - 2 ns 1
+ 2 ns 1
+sc_start(1, SC_NS) - 2 ns 1
+ 3 ns 1
+sc_start(1, SC_NS) - 3 ns 1
+ X::sync() - 3 ns 1
+ 4 ns 1
+sc_start(0, SC_NS) - 4 ns 1
+ 4 ns 1
+~tweak - 4 ns 1
+ 4 ns 1
+sc_start(0, SC_NS) - 4 ns 1
+ X::sync() - 4 ns 1
+ 4 ns 0
+sc_start(0, SC_NS) - 4 ns 0
+ X::comb() - 4 ns 0
+ 4 ns 0
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test1/test1.cpp b/src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test1/test1.cpp
new file mode 100644
index 000000000..7b2502d04
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test1/test1.cpp
@@ -0,0 +1,117 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test1.cpp -- Test alternations of sc_start(0, SC_NS) and sc_start(1, SC_NS).
+
+ Original Author: Andy Goodrich, Forte Design Systems, 18 August 2006
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification: -
+
+ *****************************************************************************/
+
+
+#include "systemc.h"
+
+SC_MODULE(X)
+{
+ SC_CTOR(X)
+ {
+ SC_METHOD(comb);
+ sensitive << tweak;
+ SC_CTHREAD(sync, clk.pos());
+ }
+ void comb()
+ {
+ cout << " X::comb() - " <<
+ sc_time_stamp() << " " <<
+ tweak.read() << endl;
+ }
+ void sync()
+ {
+ for (;;)
+ {
+ wait();
+ cout << " X::sync() - " <<
+ sc_time_stamp() << " " <<
+ tweak.read() << endl;
+ }
+ }
+ sc_in_clk clk;
+ sc_in<bool> tweak;
+};
+
+#define ACTION(action,descr) \
+{ \
+ cout << descr << " - " << \
+ sc_time_stamp() << " " << \
+ tweak.read() << endl; \
+ action ; \
+ cout << " " << \
+ sc_time_stamp() << " " << \
+ tweak.read() << endl; \
+}
+
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ sc_signal<bool> tweak;
+ X x("x");
+ x.clk(clock);
+ x.tweak(tweak);
+
+ cout << "Event Start Parameters End Parameters" << endl;
+ cout << "------------- ---------------- --------------\n" << endl;
+
+ ACTION(sc_start(1, SC_NS),"sc_start(1, SC_NS)")
+ ACTION(tweak = !tweak,"~tweak ")
+ ACTION(sc_start(0, SC_NS),"sc_start(0, SC_NS)")
+ ACTION(sc_start(0, SC_NS),"sc_start(0, SC_NS)")
+ ACTION(sc_start(1, SC_NS),"sc_start(1, SC_NS)")
+ ACTION(sc_start(0, SC_NS),"sc_start(0, SC_NS)")
+ ACTION(sc_start(0, SC_NS),"sc_start(0, SC_NS)")
+
+ ACTION(tweak = !tweak,"~tweak ")
+ ACTION(sc_start(0, SC_NS),"sc_start(0, SC_NS)")
+
+ ACTION(tweak = !tweak,"~tweak ")
+ ACTION(sc_start(0, SC_NS),"sc_start(0, SC_NS)")
+ ACTION(sc_start(0, SC_NS),"sc_start(0, SC_NS)")
+
+ ACTION(sc_start(1, SC_NS),"sc_start(1, SC_NS)")
+ ACTION(sc_start(1, SC_NS),"sc_start(1, SC_NS)")
+ ACTION(sc_start(0, SC_NS),"sc_start(0, SC_NS)")
+ ACTION(tweak = !tweak,"~tweak ")
+ ACTION(sc_start(0, SC_NS),"sc_start(0, SC_NS)")
+ ACTION(sc_start(0, SC_NS),"sc_start(0, SC_NS)")
+
+ cerr << "Program completed" << endl;
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test2/golden/test2.log b/src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test2/golden/test2.log
new file mode 100644
index 000000000..d3ee758f2
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test2/golden/test2.log
@@ -0,0 +1,16 @@
+SystemC Simulation
+0 s 1 thread
+0 s 2 cascade0
+0 s 3 cascade1
+0 s 4 cascade2
+
+1 ns 7 thread
+1 ns 8 cascade0
+1 ns 9 cascade1
+1 ns 10 cascade2
+
+2 ns 13 thread
+2 ns 14 cascade0
+2 ns 15 cascade1
+2 ns 16 cascade2
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test2/test2.cpp b/src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test2/test2.cpp
new file mode 100644
index 000000000..8b701d1da
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_start/sc_start_0/test2/test2.cpp
@@ -0,0 +1,112 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test2.cpp -- Test use of sc_pending_activity_at_current_time()
+
+ Original Author: Andy Goodrich, Forte Design Systems, 18 August 2006
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification: -
+
+ *****************************************************************************/
+
+#include "systemc.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_THREAD(thread)
+ sensitive << m_clk.pos();
+ dont_initialize();
+ SC_METHOD(cascade0_monitor);
+ sensitive << m_cascade0;
+ dont_initialize();
+ SC_METHOD(cascade1_monitor);
+ sensitive << m_cascade1;
+ dont_initialize();
+ SC_METHOD(cascade2_monitor);
+ sensitive << m_cascade2;
+ dont_initialize();
+ }
+
+ void cascade0_monitor()
+ {
+ cout << sc_time_stamp() << " " << sc_delta_count() << " cascade0"
+ << endl;
+ m_cascade1 = m_cascade0;
+ }
+
+ void cascade1_monitor()
+ {
+ cout << sc_time_stamp() << " " << sc_delta_count() << " cascade1"
+ << endl;
+ m_cascade2 = m_cascade1;
+ }
+
+ void cascade2_monitor()
+ {
+ cout << sc_time_stamp() << " " << sc_delta_count() << " cascade2"
+ << endl;
+ }
+
+ void thread()
+ {
+ for (;;)
+ {
+ cout << sc_time_stamp() << " " << sc_delta_count() << " thread"
+ << endl;
+ m_cascade0 = !m_cascade0.read();
+ wait();
+ }
+ }
+ sc_signal<bool> m_cascade0;
+ sc_signal<bool> m_cascade1;
+ sc_signal<bool> m_cascade2;
+ sc_in<bool> m_clk;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+
+ dut.m_clk(clock);
+
+
+ do { sc_start(0, SC_NS); } while (sc_pending_activity_at_current_time());
+ cout << endl;
+ sc_start(1, SC_NS);
+ do { sc_start(0, SC_NS); } while (sc_pending_activity_at_current_time());
+ cout << endl;
+ sc_start(1, SC_NS);
+ do { sc_start(0, SC_NS); } while (sc_pending_activity_at_current_time());
+
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_start/time_overflow/golden/time_overflow.log b/src/systemc/tests/systemc/kernel/sc_start/time_overflow/golden/time_overflow.log
new file mode 100644
index 000000000..cedb62065
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_start/time_overflow/golden/time_overflow.log
@@ -0,0 +1,11 @@
+SystemC Simulation
+0 s: Issuing sc_start(10, SC_NS)
+10 ns: Issuing sc_start()
+18446744073709551615 ps: Issuing sc_start()
+
+Warning: (W571) no activity or clock movement for sc_start() invocation
+In file: <removed by verify.pl>
+18446744073709551615 ps: Issuing sc_start(10, SC_NS)
+
+Error: (E544) simulation time value overflow, simulation aborted
+In file: <removed by verify.pl>
diff --git a/src/systemc/tests/systemc/kernel/sc_start/time_overflow/time_overflow.cpp b/src/systemc/tests/systemc/kernel/sc_start/time_overflow/time_overflow.cpp
new file mode 100644
index 000000000..e02fae353
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_start/time_overflow/time_overflow.cpp
@@ -0,0 +1,51 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ Original Author: Bishnupriya Bhattacharya, Cadence Design Systems,
+ Spetember 5, 2003
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+#include "systemc.h"
+
+int sc_main(int argc, char* argv[])
+{
+ cout << sc_time_stamp() << ": Issuing sc_start(10, SC_NS)" << endl;
+ sc_start(10, SC_NS);
+ cout << sc_time_stamp() << ": Issuing sc_start()" << endl;
+ sc_start(sc_max_time() - sc_time(10,SC_NS) );
+ cout << sc_time_stamp() << ": Issuing sc_start()" << endl;
+ sc_start();
+ cout << sc_time_stamp() << ": Issuing sc_start(10, SC_NS)" << endl;
+ sc_start(10, SC_NS);
+ cerr << sc_time_stamp() << ": Program completed" << endl;
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/sc_stop/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_stop/test01/golden/test01.log
new file mode 100644
index 000000000..f23521c69
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_stop/test01/golden/test01.log
@@ -0,0 +1,7 @@
+SystemC Simulation
+Creating able...
+Creating baker...
+Creating charlie...
+charlie: 0 s
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/sc_stop/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_stop/test01/test01.cpp
new file mode 100644
index 000000000..90a1405c9
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_stop/test01/test01.cpp
@@ -0,0 +1,94 @@
+/*****************************************************************************
+
+ 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: Andy Goodrich, Forte Design Systems, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+
+SC_MODULE(X)
+{
+ SC_CTOR(X)
+ {
+ cout << "Creating able..." << endl;
+ SC_THREAD(able);
+ sensitive << clk.pos();
+ cout << "Creating baker..." << endl;
+ SC_THREAD(baker);
+ sensitive << clk.pos();
+ cout << "Creating charlie..." << endl;
+ SC_THREAD(charlie);
+ sensitive << clk.pos();
+ }
+
+ void able()
+ {
+ for (;;)
+ {
+ wait();
+ cout << "able: " << sc_time_stamp() << endl;
+ sc_stop();
+ }
+ }
+ void baker()
+ {
+ for (;;)
+ {
+ wait();
+ cout << "baker: " << sc_time_stamp() << endl;
+ sc_stop();
+ }
+ }
+ void charlie()
+ {
+ for (;;)
+ {
+ wait();
+ cout << "charlie: " << sc_time_stamp() << endl;
+ sc_stop();
+ }
+ }
+ sc_in_clk clk;
+};
+
+int sc_main(int argc, char* argv[] )
+{
+ sc_clock clock;
+ X x("x");
+ x.clk(clock);
+
+ sc_set_stop_mode(SC_STOP_IMMEDIATE);
+ sc_start(100, SC_NS);
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_stop/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/sc_stop/test02/golden/test02.log
new file mode 100644
index 000000000..c62642dbc
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_stop/test02/golden/test02.log
@@ -0,0 +1,13 @@
+SystemC Simulation
+Creating able...
+Creating baker...
+Creating charlie...
+charlie: 0 s
+baker: 0 s
+
+Warning: (W545) sc_stop has already been called
+In file: <removed by verify.pl>
+In process: x.baker @ 0 s
+able: 0 s
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/sc_stop/test02/test02.cpp b/src/systemc/tests/systemc/kernel/sc_stop/test02/test02.cpp
new file mode 100644
index 000000000..b5b1c0c38
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_stop/test02/test02.cpp
@@ -0,0 +1,93 @@
+/*****************************************************************************
+
+ 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: Andy Goodrich, Forte Design Systems
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+
+SC_MODULE(X)
+{
+ SC_CTOR(X)
+ {
+ cout << "Creating able..." << endl;
+ SC_THREAD(able);
+ sensitive << clk.pos();
+ cout << "Creating baker..." << endl;
+ SC_THREAD(baker);
+ sensitive << clk.pos();
+ cout << "Creating charlie..." << endl;
+ SC_THREAD(charlie);
+ sensitive << clk.pos();
+ }
+
+ void able()
+ {
+ for (;;)
+ {
+ wait();
+ cout << "able: " << sc_time_stamp() << endl;
+ sc_stop();
+ }
+ }
+ void baker()
+ {
+ for (;;)
+ {
+ wait();
+ cout << "baker: " << sc_time_stamp() << endl;
+ sc_stop();
+ }
+ }
+ void charlie()
+ {
+ for (;;)
+ {
+ wait();
+ cout << "charlie: " << sc_time_stamp() << endl;
+ sc_stop();
+ }
+ }
+ sc_in_clk clk;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ X x("x");
+ x.clk(clock);
+
+ sc_start(100, SC_NS);
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_stop/test03/golden/test03.log b/src/systemc/tests/systemc/kernel/sc_stop/test03/golden/test03.log
new file mode 100644
index 000000000..0904f9740
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_stop/test03/golden/test03.log
@@ -0,0 +1,7 @@
+SystemC Simulation
+Creating able...
+Creating baker...
+baker: 0 s: issuing sc_stop()
+able: 0 s
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/sc_stop/test03/test03.cpp b/src/systemc/tests/systemc/kernel/sc_stop/test03/test03.cpp
new file mode 100644
index 000000000..0489ab963
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_stop/test03/test03.cpp
@@ -0,0 +1,75 @@
+/*****************************************************************************
+
+ 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: Andy Goodrich, Forte Design Systems
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+
+SC_MODULE(X)
+{
+ SC_CTOR(X)
+ {
+ cout << "Creating able..." << endl;
+ SC_THREAD(able);
+ sensitive << immediate_event;
+ cout << "Creating baker..." << endl;
+ SC_THREAD(baker);
+ }
+
+ void able()
+ {
+ wait();
+ cout << "able: " << sc_time_stamp() << endl;
+ }
+ void baker()
+ {
+ cout << "baker: " << sc_time_stamp()
+ << ": issuing sc_stop()" << endl;
+ sc_stop();
+ immediate_event.notify();
+ }
+ sc_event immediate_event;
+};
+
+int sc_main(int argc, char* argv[] )
+{
+ X x("x");
+
+ //sc_set_stop_mode(SC_STOP_IMMEDIATE);
+ sc_start(100, SC_NS);
+ return 0;
+}
+
+
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_time/test01/golden/test01.log
new file mode 100644
index 000000000..05f57cbfb
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test01/golden/test01.log
@@ -0,0 +1,115 @@
+SystemC Simulation
+test_print
+0 s
+1230 ps
+12300 ns
+1230 us
+12300 ms
+1230 s
+12300000 s
+test_constructors
+0 s
+0 s
+1235 ps
+1234 ps
+0 s
+18446744073709550382 ps
+18446744073709550383 ps
+1 ns
+2 ns
+3 ns
+4 ns
+5 ns
+6 ns
+7 ns
+8 ns
+9 ns
+10 ns
+11 ns
+0 s
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated constructor: sc_time(double,bool)
+1234 ps
+1235 ps
+18446744073709550383 ps
+18446744073709550382 ps
+1 ps
+2 ps
+0 s
+18446744073709551615 ps
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated constructor: sc_time(uint64,bool)
+0 s
+25 ns
+25 ps
+25 ps
+test_assignment
+0 s
+1235 ps
+18446744073709550074 ps
+test_conversion
+0
+0
+0 s
+0
+1234500
+1.2345e+06
+1234500 ps
+1.2345e-06
+18446744073709550074
+1.84467e+19
+18446744073709550074 ps
+1.84467e+07
+test_relational
+1
+0
+0
+1
+0
+1
+0
+1
+0
+0
+1
+1
+0
+1
+1
+1
+0
+0
+test_arithmetic
+0 s
+1235 ps
+18446744073709550074 ps
+1235 ps
+2469 ps
+18446744073709551309 ps
+18446744073709548532 ps
+0 s
+18446744073709550381 ps
+1542 ps
+1 ps
+2777 ps
+0 s
+0 s
+1525 ps
+2468 ps
+0 s
+617 ps
+1.00081
+1235 ps
+1 ps
+1 ps
+1 ps
+test_SC_ZERO_TIME
+0 s
+
+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_time/test01/golden/test01.log.mingw b/src/systemc/tests/systemc/kernel/sc_time/test01/golden/test01.log.mingw
new file mode 100644
index 000000000..c61cc7857
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test01/golden/test01.log.mingw
@@ -0,0 +1,115 @@
+SystemC Simulation
+test_print
+0 s
+1230 ps
+12300 ns
+1230 us
+12300 ms
+1230 s
+12300000 s
+test_constructors
+0 s
+0 s
+1235 ps
+1234 ps
+0 s
+18446744073709550382 ps
+18446744073709550383 ps
+1 ns
+2 ns
+3 ns
+4 ns
+5 ns
+6 ns
+7 ns
+8 ns
+9 ns
+10 ns
+11 ns
+0 s
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated constructor: sc_time(double,bool)
+1234 ps
+1235 ps
+18446744073709550383 ps
+18446744073709550382 ps
+1 ps
+2 ps
+0 s
+18446744073709551615 ps
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated constructor: sc_time(uint64,bool)
+0 s
+25 ns
+25 ps
+25 ps
+test_assignment
+0 s
+1235 ps
+18446744073709550074 ps
+test_conversion
+0
+0
+0 s
+0
+1234500
+1.2345e+006
+1234500 ps
+1.2345e-006
+18446744073709550074
+1.84467e+019
+18446744073709550074 ps
+1.84467e+007
+test_relational
+1
+0
+0
+1
+0
+1
+0
+1
+0
+0
+1
+1
+0
+1
+1
+1
+0
+0
+test_arithmetic
+0 s
+1235 ps
+18446744073709550074 ps
+1235 ps
+2469 ps
+18446744073709551309 ps
+18446744073709548532 ps
+0 s
+18446744073709550381 ps
+1542 ps
+1 ps
+2777 ps
+0 s
+0 s
+1525 ps
+2468 ps
+0 s
+617 ps
+1.00081
+1235 ps
+1 ps
+1 ps
+1 ps
+test_SC_ZERO_TIME
+0 s
+
+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_time/test01/golden/test01.log.mingw64 b/src/systemc/tests/systemc/kernel/sc_time/test01/golden/test01.log.mingw64
new file mode 100644
index 000000000..c61cc7857
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test01/golden/test01.log.mingw64
@@ -0,0 +1,115 @@
+SystemC Simulation
+test_print
+0 s
+1230 ps
+12300 ns
+1230 us
+12300 ms
+1230 s
+12300000 s
+test_constructors
+0 s
+0 s
+1235 ps
+1234 ps
+0 s
+18446744073709550382 ps
+18446744073709550383 ps
+1 ns
+2 ns
+3 ns
+4 ns
+5 ns
+6 ns
+7 ns
+8 ns
+9 ns
+10 ns
+11 ns
+0 s
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated constructor: sc_time(double,bool)
+1234 ps
+1235 ps
+18446744073709550383 ps
+18446744073709550382 ps
+1 ps
+2 ps
+0 s
+18446744073709551615 ps
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated constructor: sc_time(uint64,bool)
+0 s
+25 ns
+25 ps
+25 ps
+test_assignment
+0 s
+1235 ps
+18446744073709550074 ps
+test_conversion
+0
+0
+0 s
+0
+1234500
+1.2345e+006
+1234500 ps
+1.2345e-006
+18446744073709550074
+1.84467e+019
+18446744073709550074 ps
+1.84467e+007
+test_relational
+1
+0
+0
+1
+0
+1
+0
+1
+0
+0
+1
+1
+0
+1
+1
+1
+0
+0
+test_arithmetic
+0 s
+1235 ps
+18446744073709550074 ps
+1235 ps
+2469 ps
+18446744073709551309 ps
+18446744073709548532 ps
+0 s
+18446744073709550381 ps
+1542 ps
+1 ps
+2777 ps
+0 s
+0 s
+1525 ps
+2468 ps
+0 s
+617 ps
+1.00081
+1235 ps
+1 ps
+1 ps
+1 ps
+test_SC_ZERO_TIME
+0 s
+
+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_time/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_time/test01/test01.cpp
new file mode 100644
index 000000000..31d8e8e8f
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test01/test01.cpp
@@ -0,0 +1,315 @@
+/*****************************************************************************
+
+ 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:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of sc_time's methods
+
+#include "systemc.h"
+
+void
+test_print()
+{
+ cout << "test_print" << endl;
+
+ sc_time t1;
+ cout << t1 << endl;
+
+ uint64 v = 1230;
+ sc_time t2 = sc_time::from_value( v );
+ cout << t2 << endl;
+
+ v *= 10000;
+ sc_time t3 = sc_time::from_value( v );
+ cout << t3 << endl;
+
+ v *= 100;
+ sc_time t4 = sc_time::from_value( v );
+ cout << t4 << endl;
+
+ v *= 10000;
+ sc_time t5 = sc_time::from_value( v );
+ cout << t5 << endl;
+
+ v *= 100;
+ sc_time t6 = sc_time::from_value( v );
+ cout << t6 << endl;
+
+ v *= 10000;
+ sc_time t7 = sc_time::from_value( v );
+ cout << t7 << endl;
+}
+
+void
+test_constructors()
+{
+ cout << "test_constructors" << endl;
+
+ sc_time t1;
+ cout << t1 << endl;
+
+ sc_time t2a( 0, SC_SEC );
+ cout << t2a << endl;
+
+ sc_time t2b( 1.2345, SC_NS );
+ cout << t2b << endl;
+ sc_time t2c( 1.2341, SC_NS );
+ cout << t2c << endl;
+
+ sc_time t2d( 1, SC_FS );
+ cout << t2d << endl;
+
+ sc_time t2e( -1.2345, SC_NS );
+ cout << t2e << endl;
+ sc_time t2f( -1.2341, SC_NS );
+ cout << t2f << endl;
+
+ char v1 = 1;
+ signed char v2 = 2;
+ unsigned char v3 = 3;
+ short v4 = 4;
+ unsigned short v5 = 5;
+ int v6 = 6;
+ unsigned int v7 = 7;
+ long v8 = 8;
+ unsigned long v9 = 9;
+ float v10 = 10;
+ double v11 = 11;
+
+ sc_time t2g( v1, SC_NS );
+ cout << t2g << endl;
+ sc_time t2h( v2, SC_NS );
+ cout << t2h << endl;
+ sc_time t2i( v3, SC_NS );
+ cout << t2i << endl;
+ sc_time t2j( v4, SC_NS );
+ cout << t2j << endl;
+ sc_time t2k( v5, SC_NS );
+ cout << t2k << endl;
+ sc_time t2l( v6, SC_NS );
+ cout << t2l << endl;
+ sc_time t2m( v7, SC_NS );
+ cout << t2m << endl;
+ sc_time t2n( v8, SC_NS );
+ cout << t2n << endl;
+ sc_time t2o( v9, SC_NS );
+ cout << t2o << endl;
+ sc_time t2p( v10, SC_NS );
+ cout << t2p << endl;
+ sc_time t2q( v11, SC_NS );
+ cout << t2q << endl;
+
+ sc_time t3a( 0, SC_SEC );
+ cout << t3a << endl;
+
+ sc_time t3b( 1.2341, true );
+ cout << t3b << endl;
+ sc_time t3c( 1.2345, true );
+ cout << t3c << endl;
+ sc_time t3d( -1.2341, true );
+ cout << t3d << endl;
+ sc_time t3e( -1.2345, true );
+ cout << t3e << endl;
+
+ sc_time t3f( 1.2345, false );
+ cout << t3f << endl;
+ sc_time t3g( 1.5432, false );
+ cout << t3g << endl;
+ sc_time t3h( -1.2345, false );
+ cout << t3h << endl;
+ sc_time t3i( -1.5432, false );
+ cout << t3i << endl;
+
+#if !defined( _MSC_VER )
+ sc_time t4a( 0ull, true );
+ cout << t4a << endl;
+ sc_time t4b( 25ull, true );
+ cout << t4b << endl;
+ sc_time t4c( 25ull, false );
+ cout << t4c << endl;
+#else
+ sc_time t4a( 0ui64, true );
+ cout << t4a << endl;
+ sc_time t4b( 25ui64, true );
+ cout << t4b << endl;
+ sc_time t4c( 25ui64, false );
+ cout << t4c << endl;
+#endif
+
+ sc_time t5( t4c );
+ cout << t5 << endl;
+}
+
+void
+test_assignment()
+{
+ cout << "test_assignment" << endl;
+
+ sc_time t1;
+
+ sc_time t2;
+ t1 = t2;
+ cout << t1 << endl;
+
+ sc_time t3( 1.2345, SC_NS );
+ t1 = t3;
+ cout << t1 << endl;
+
+ sc_time t4( -1.5432, SC_NS );
+ t1 = t4;
+ cout << t1 << endl;
+}
+
+void
+test_conversion()
+{
+ cout << "test_conversion" << endl;
+
+ sc_time t1;
+ cout << t1.value() << endl;
+ cout << t1.to_double() << endl;
+ cout << t1 << endl;
+ cout << t1.to_seconds() << endl;
+
+ sc_time t2( 1.2345, SC_US );
+ cout << t2.value() << endl;
+ cout << t2.to_double() << endl;
+ cout << t2 << endl;
+ cout << t2.to_seconds() << endl;
+
+ sc_time t3( -1.5432, SC_NS );
+ cout << t3.value() << endl;
+ cout << t3.to_double() << endl;
+ cout << t3 << endl;
+ cout << t3.to_seconds() << endl;
+}
+
+void
+test_relational()
+{
+ cout << "test_relational" << endl;
+
+ sc_time t1;
+ sc_time t2( 1, SC_FS );
+ sc_time t3( 1.2345, SC_NS );
+ sc_time t4( 1.2341, SC_NS );
+ sc_time t5( -1.5432, SC_NS );
+
+ cout << ( t1 == t2 ) << endl;
+ cout << ( t1 != t2 ) << endl;
+ cout << ( t1 < t2 ) << endl;
+ cout << ( t1 <= t2 ) << endl;
+ cout << ( t1 > t2 ) << endl;
+ cout << ( t1 >= t2 ) << endl;
+
+ cout << ( t3 == t4 ) << endl;
+ cout << ( t3 != t4 ) << endl;
+ cout << ( t3 < t4 ) << endl;
+ cout << ( t3 <= t4 ) << endl;
+ cout << ( t3 > t4 ) << endl;
+ cout << ( t3 >= t4 ) << endl;
+
+ cout << ( t1 == t5 ) << endl;
+ cout << ( t1 != t5 ) << endl;
+ cout << ( t1 < t5 ) << endl;
+ cout << ( t1 <= t5 ) << endl;
+ cout << ( t1 > t5 ) << endl;
+ cout << ( t1 >= t5 ) << endl;
+}
+
+void
+test_arithmetic()
+{
+ cout << "test_arithmetic" << endl;
+
+ sc_time t1;
+ sc_time t2( 1, SC_FS );
+ sc_time t3( 1.2345, SC_NS );
+ sc_time t4( 1.2341, SC_NS );
+ sc_time t5( -1.5432, SC_NS );
+
+ cout << ( t1 + t2 ) << endl;
+ cout << ( t1 + t3 ) << endl;
+ cout << ( t1 + t5 ) << endl;
+ cout << ( t3 + t2 ) << endl;
+ cout << ( t3 + t4 ) << endl;
+ cout << ( t3 + t5 ) << endl;
+ cout << ( t5 + t5 ) << endl;
+
+ cout << ( t1 - t2 ) << endl;
+ cout << ( t1 - t3 ) << endl;
+ cout << ( t1 - t5 ) << endl;
+ cout << ( t3 - t4 ) << endl;
+ cout << ( t3 - t5 ) << endl;
+ cout << ( t5 - t5 ) << endl;
+
+ cout << ( t1 * 1.2345 ) << endl;
+ cout << ( 1.2345 * t3 ) << endl;
+ cout << ( t4 * 2 ) << endl;
+
+ cout << ( t1 / 1.2345 ) << endl;
+ cout << ( t4 / 2 ) << endl;
+ cout << ( t3 / t4 ) << endl;
+
+ cout << ( t2 += t3 ) << endl;
+ cout << ( t2 -= t4 ) << endl;
+ cout << ( t2 *= 1.2345 ) << endl;
+ cout << ( t2 /= 2 ) << endl;
+}
+
+void
+test_SC_ZERO_TIME()
+{
+ cout << "test_SC_ZERO_TIME" << endl;
+
+ cout << SC_ZERO_TIME << endl;
+}
+
+int
+sc_main( int, char*[] )
+{
+#if defined(_MSC_VER) && _MSC_VER < 1900
+ _set_output_format(_TWO_DIGIT_EXPONENT);
+#endif
+ test_print();
+ test_constructors();
+ test_assignment();
+ test_conversion();
+ test_relational();
+ test_arithmetic();
+ test_SC_ZERO_TIME();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/sc_time/test02/golden/test02.log
new file mode 100644
index 000000000..8bfeddd7c
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test02/golden/test02.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+
+Error: (E514) set time resolution failed: value not positive
+In file: <removed by verify.pl>
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test02/test02.cpp b/src/systemc/tests/systemc/kernel/sc_time/test02/test02.cpp
new file mode 100644
index 000000000..d078bae2f
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test02/test02.cpp
@@ -0,0 +1,48 @@
+/*****************************************************************************
+
+ 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 function sc_set_time_resolution
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_set_time_resolution( -1, SC_NS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test03/golden/test03.log b/src/systemc/tests/systemc/kernel/sc_time/test03/golden/test03.log
new file mode 100644
index 000000000..146dd4c2e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test03/golden/test03.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+
+Error: (E514) set time resolution failed: value not a power of ten
+In file: <removed by verify.pl>
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test03/test03.cpp b/src/systemc/tests/systemc/kernel/sc_time/test03/test03.cpp
new file mode 100644
index 000000000..925fa543a
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test03/test03.cpp
@@ -0,0 +1,48 @@
+/*****************************************************************************
+
+ 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 function sc_set_time_resolution
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_set_time_resolution( 15, SC_NS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test04/golden/test04.log b/src/systemc/tests/systemc/kernel/sc_time/test04/golden/test04.log
new file mode 100644
index 000000000..2338c8de5
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test04/golden/test04.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+
+Error: (E514) set time resolution failed: simulation running
+In file: <removed by verify.pl>
+In process: src.main_action @ 0 s
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test04/test04.cpp b/src/systemc/tests/systemc/kernel/sc_time/test04/test04.cpp
new file mode 100644
index 000000000..fd71d60d5
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test04/test04.cpp
@@ -0,0 +1,77 @@
+/*****************************************************************************
+
+ 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 function sc_set_time_resolution
+
+#include "systemc.h"
+
+SC_MODULE( source )
+{
+ sc_in_clk clk;
+ sc_out<int> out;
+
+ void main_action()
+ {
+ sc_set_time_resolution( 10, SC_PS );
+ int a = 0;
+ while( true ) {
+ wait();
+ out = ++ a;
+ }
+ }
+
+ SC_CTOR( source )
+ {
+ SC_THREAD( main_action );
+ sensitive << clk.pos();
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ sc_clock clk( "clk" );
+ sc_signal<int> sig( "sig" );
+
+ source src( "src" );
+ src.clk( clk );
+ src.out( sig );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test05/golden/test05.log b/src/systemc/tests/systemc/kernel/sc_time/test05/golden/test05.log
new file mode 100644
index 000000000..2338c8de5
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test05/golden/test05.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+
+Error: (E514) set time resolution failed: simulation running
+In file: <removed by verify.pl>
+In process: src.main_action @ 0 s
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test05/test05.cpp b/src/systemc/tests/systemc/kernel/sc_time/test05/test05.cpp
new file mode 100644
index 000000000..c517afcc6
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test05/test05.cpp
@@ -0,0 +1,76 @@
+/*****************************************************************************
+
+ 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 function sc_set_time_resolution
+
+#include "systemc.h"
+
+SC_MODULE( source )
+{
+ sc_in_clk clk;
+ sc_out<int> out;
+
+ void main_action()
+ {
+ sc_set_time_resolution( 10, SC_PS );
+ int a = 0;
+ while( true ) {
+ wait();
+ out = ++ a;
+ }
+ }
+
+ SC_CTOR( source )
+ {
+ SC_CTHREAD( main_action, clk.pos() );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ sc_clock clk( "clk" );
+ sc_signal<int> sig( "sig" );
+
+ source src( "src" );
+ src.clk( clk );
+ src.out( sig );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test06/golden/test06.log b/src/systemc/tests/systemc/kernel/sc_time/test06/golden/test06.log
new file mode 100644
index 000000000..2338c8de5
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test06/golden/test06.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+
+Error: (E514) set time resolution failed: simulation running
+In file: <removed by verify.pl>
+In process: src.main_action @ 0 s
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test06/test06.cpp b/src/systemc/tests/systemc/kernel/sc_time/test06/test06.cpp
new file mode 100644
index 000000000..b2db9d513
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test06/test06.cpp
@@ -0,0 +1,85 @@
+/*****************************************************************************
+
+ 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 function sc_set_time_resolution
+
+#include "systemc.h"
+
+SC_MODULE( source )
+{
+ sc_in_clk clk;
+ sc_out<int> out;
+
+ int a;
+
+ void main_action()
+ {
+ if( m_first_time ) {
+ sc_set_time_resolution( 10, SC_PS );
+ a = 0;
+ m_first_time = false;
+ } else {
+ out = ++ a;
+ }
+ }
+
+ SC_CTOR( source )
+ : m_first_time( true )
+ {
+ SC_METHOD( main_action );
+ sensitive << clk.pos();
+ }
+
+private:
+
+ bool m_first_time;
+};
+
+int
+sc_main( int, char*[] )
+{
+ sc_clock clk( "clk" );
+ sc_signal<int> sig( "sig" );
+
+ source src( "src" );
+ src.clk( clk );
+ src.out( sig );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test07/golden/test07.log b/src/systemc/tests/systemc/kernel/sc_time/test07/golden/test07.log
new file mode 100644
index 000000000..cc032fff1
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test07/golden/test07.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+
+Error: (E514) set time resolution failed: already specified
+In file: <removed by verify.pl>
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test07/test07.cpp b/src/systemc/tests/systemc/kernel/sc_time/test07/test07.cpp
new file mode 100644
index 000000000..ea9f8efb3
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test07/test07.cpp
@@ -0,0 +1,49 @@
+/*****************************************************************************
+
+ 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 function sc_set_time_resolution
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_set_time_resolution( 1, SC_NS );
+ sc_set_time_resolution( 10, SC_FS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test08/golden/test08.log b/src/systemc/tests/systemc/kernel/sc_time/test08/golden/test08.log
new file mode 100644
index 000000000..0465b8580
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test08/golden/test08.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+
+Error: (E514) set time resolution failed: sc_time object(s) constructed
+In file: <removed by verify.pl>
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test08/test08.cpp b/src/systemc/tests/systemc/kernel/sc_time/test08/test08.cpp
new file mode 100644
index 000000000..982acd6cb
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test08/test08.cpp
@@ -0,0 +1,50 @@
+/*****************************************************************************
+
+ 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 function sc_set_time_resolution
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_time t1( 1.2345, SC_NS );
+ sc_set_time_resolution( 10, SC_FS );
+ cout << t1;
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test09/golden/test09.log b/src/systemc/tests/systemc/kernel/sc_time/test09/golden/test09.log
new file mode 100644
index 000000000..baf367a10
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test09/golden/test09.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+
+Error: (E514) set time resolution failed: value smaller than 1 fs
+In file: <removed by verify.pl>
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test09/test09.cpp b/src/systemc/tests/systemc/kernel/sc_time/test09/test09.cpp
new file mode 100644
index 000000000..108f71cd2
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test09/test09.cpp
@@ -0,0 +1,48 @@
+/*****************************************************************************
+
+ 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 function sc_set_time_resolution
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_set_time_resolution( 0.1, SC_FS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test10/golden/test10.log b/src/systemc/tests/systemc/kernel/sc_time/test10/golden/test10.log
new file mode 100644
index 000000000..22116047d
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test10/golden/test10.log
@@ -0,0 +1,13 @@
+SystemC Simulation
+1 fs
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated function: sc_get_default_time_unit
+1 ns
+
+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_time/test10/test10.cpp b/src/systemc/tests/systemc/kernel/sc_time/test10/test10.cpp
new file mode 100644
index 000000000..55f7ed908
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test10/test10.cpp
@@ -0,0 +1,50 @@
+/*****************************************************************************
+
+ 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 functions sc_set_time_resolution and sc_get_time_resolution
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_set_time_resolution( 1, SC_FS );
+ cout << sc_get_time_resolution() << endl;
+ cout << sc_get_default_time_unit() << endl;
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test11/golden/test11.log b/src/systemc/tests/systemc/kernel/sc_time/test11/golden/test11.log
new file mode 100644
index 000000000..2286a20df
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test11/golden/test11.log
@@ -0,0 +1,16 @@
+SystemC Simulation
+
+Warning: (W516) default time unit changed to time resolution
+In file: <removed by verify.pl>
+10 ns
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated function: sc_get_default_time_unit
+10 ns
+
+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_time/test11/test11.cpp b/src/systemc/tests/systemc/kernel/sc_time/test11/test11.cpp
new file mode 100644
index 000000000..1828c6928
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test11/test11.cpp
@@ -0,0 +1,50 @@
+/*****************************************************************************
+
+ 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 functions sc_set_time_resolution and sc_get_time_resolution
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_set_time_resolution( 10, SC_NS );
+ cout << sc_get_time_resolution() << endl;
+ cout << sc_get_default_time_unit() << endl;
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test12/golden/test12.log b/src/systemc/tests/systemc/kernel/sc_time/test12/golden/test12.log
new file mode 100644
index 000000000..427796f5c
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test12/golden/test12.log
@@ -0,0 +1,14 @@
+SystemC Simulation
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated function: sc_set_default_time_unit
+
+Error: (E515) set default time unit failed: value not positive
+In file: <removed by verify.pl>
+
+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_time/test12/test12.cpp b/src/systemc/tests/systemc/kernel/sc_time/test12/test12.cpp
new file mode 100644
index 000000000..cd9b0296a
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test12/test12.cpp
@@ -0,0 +1,48 @@
+/*****************************************************************************
+
+ 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 function sc_set_default_time_unit
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_set_default_time_unit( -1, SC_NS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test13/golden/test13.log b/src/systemc/tests/systemc/kernel/sc_time/test13/golden/test13.log
new file mode 100644
index 000000000..891bf5731
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test13/golden/test13.log
@@ -0,0 +1,14 @@
+SystemC Simulation
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated function: sc_set_default_time_unit
+
+Error: (E515) set default time unit failed: value not a power of ten
+In file: <removed by verify.pl>
+
+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_time/test13/test13.cpp b/src/systemc/tests/systemc/kernel/sc_time/test13/test13.cpp
new file mode 100644
index 000000000..6dacb61b3
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test13/test13.cpp
@@ -0,0 +1,48 @@
+/*****************************************************************************
+
+ 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: 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 function sc_set_default_time_unit
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_set_default_time_unit( 15, SC_NS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test14/golden/test14.log b/src/systemc/tests/systemc/kernel/sc_time/test14/golden/test14.log
new file mode 100644
index 000000000..91366709d
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test14/golden/test14.log
@@ -0,0 +1,15 @@
+SystemC Simulation
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated function: sc_set_default_time_unit
+
+Error: (E515) set default time unit failed: simulation running
+In file: <removed by verify.pl>
+In process: src.main_action @ 0 s
+
+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_time/test14/test14.cpp b/src/systemc/tests/systemc/kernel/sc_time/test14/test14.cpp
new file mode 100644
index 000000000..d05f8a41c
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test14/test14.cpp
@@ -0,0 +1,77 @@
+/*****************************************************************************
+
+ 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: 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 function sc_set_default_time_unit
+
+#include "systemc.h"
+
+SC_MODULE( source )
+{
+ sc_in_clk clk;
+ sc_out<int> out;
+
+ void main_action()
+ {
+ sc_set_default_time_unit( 10, SC_PS );
+ int a = 0;
+ while( true ) {
+ wait();
+ out = ++ a;
+ }
+ }
+
+ SC_CTOR( source )
+ {
+ SC_THREAD( main_action );
+ sensitive << clk.pos();
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ sc_clock clk( "clk" );
+ sc_signal<int> sig( "sig" );
+
+ source src( "src" );
+ src.clk( clk );
+ src.out( sig );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test15/golden/test15.log b/src/systemc/tests/systemc/kernel/sc_time/test15/golden/test15.log
new file mode 100644
index 000000000..ed48a2b5e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test15/golden/test15.log
@@ -0,0 +1,14 @@
+SystemC Simulation
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated function: sc_set_default_time_unit
+
+Error: (E515) set default time unit failed: already specified
+In file: <removed by verify.pl>
+
+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_time/test15/test15.cpp b/src/systemc/tests/systemc/kernel/sc_time/test15/test15.cpp
new file mode 100644
index 000000000..03be11a37
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test15/test15.cpp
@@ -0,0 +1,49 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test15.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 function sc_set_default_time_unit
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_set_default_time_unit( 1, SC_NS );
+ sc_set_default_time_unit( 10, SC_FS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test16/golden/test16.log b/src/systemc/tests/systemc/kernel/sc_time/test16/golden/test16.log
new file mode 100644
index 000000000..775681584
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test16/golden/test16.log
@@ -0,0 +1,14 @@
+SystemC Simulation
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated function: sc_set_default_time_unit
+
+Error: (E515) set default time unit failed: value smaller than time resolution
+In file: <removed by verify.pl>
+
+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_time/test16/test16.cpp b/src/systemc/tests/systemc/kernel/sc_time/test16/test16.cpp
new file mode 100644
index 000000000..89a0cd638
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test16/test16.cpp
@@ -0,0 +1,48 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test16.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 function sc_set_default_time_unit
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_set_default_time_unit( 10, SC_FS );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test17/golden/test17.log b/src/systemc/tests/systemc/kernel/sc_time/test17/golden/test17.log
new file mode 100644
index 000000000..8bda9c5a4
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test17/golden/test17.log
@@ -0,0 +1,14 @@
+SystemC Simulation
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated function: sc_set_default_time_unit
+
+Info: (I804) /IEEE_Std_1666/deprecated: deprecated function: sc_get_default_time_unit
+10 ms
+
+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_time/test17/test17.cpp b/src/systemc/tests/systemc/kernel/sc_time/test17/test17.cpp
new file mode 100644
index 000000000..7bcf3d385
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test17/test17.cpp
@@ -0,0 +1,49 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test17.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 functions sc_set_default_time_unit and sc_get_default_time_unit
+
+#include "systemc.h"
+
+int
+sc_main( int, char*[] )
+{
+ sc_set_default_time_unit( 10, SC_MS );
+ cout << sc_get_default_time_unit() << endl;
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test18/golden/test18.log b/src/systemc/tests/systemc/kernel/sc_time/test18/golden/test18.log
new file mode 100644
index 000000000..4c1985e07
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test18/golden/test18.log
@@ -0,0 +1,8 @@
+SystemC Simulation
+8 ns throwing
+8 ns caught
+9 ns throwing
+9 ns caught
+10 ns throwing
+10 ns caught
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test18/test18.cpp b/src/systemc/tests/systemc/kernel/sc_time/test18/test18.cpp
new file mode 100644
index 000000000..18a723d0e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test18/test18.cpp
@@ -0,0 +1,88 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test18.cpp -- Test that time cannot go backwards in simulator
+
+ Original Author: Andy Goodrich, Forte Design Systems, 2006-05-03
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: test18.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:06 acg
+// systemc_tests-2.3
+//
+// Revision 1.1 2006/05/03 19:37:10 acg
+// Andy Goodrich: new test to check that time will not run backward if a
+// negative value is given to sc_event::notify()
+//
+
+#include "systemc.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_METHOD(catcher);
+ sensitive << m_event;
+ dont_initialize();
+ SC_CTHREAD(thrower,m_clk.pos());
+ }
+ void catcher()
+ {
+ cout << sc_time_stamp() << " caught" << endl;
+ }
+ void thrower()
+ {
+ sc_time minus_four(-4.0, SC_NS);
+ wait(7);
+ for (;;)
+ {
+ wait();
+ cout << sc_time_stamp() << " throwing" << endl;
+ m_event.notify(minus_four);
+ }
+ }
+ sc_in<bool> m_clk;
+ sc_event m_event;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+
+ dut.m_clk(clock);
+
+ sc_start(11, SC_NS);
+
+ cout << "Program completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test19/golden/test19.log b/src/systemc/tests/systemc/kernel/sc_time/test19/golden/test19.log
new file mode 100644
index 000000000..20d4fe0a1
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test19/golden/test19.log
@@ -0,0 +1,83 @@
+SystemC Simulation
+
+Resolution = 1 ps
+10 ns, value=10000
+ t.value=10, t.unit=ns
+100 ns, value=100000
+ t.value=100, t.unit=ns
+1 us, value=1000000
+ t.value=1, t.unit=us
+100 ns, value=100000
+ t.value=100, t.unit=ns
+1 us, value=1000000
+ t.value=1, t.unit=us
+10 us, value=10000000
+ t.value=10, t.unit=us
+100 us, value=100000000
+ t.value=100, t.unit=us
+1 ms, value=1000000000
+ t.value=1, t.unit=ms
+100 s, value=100000000000000
+ t.value=100, t.unit=s
+
+Resolution = 100 fs
+10 ns, value=100000
+ t.value=10, t.unit=ns
+100 ns, value=1000000
+ t.value=100, t.unit=ns
+1 us, value=10000000
+ t.value=1, t.unit=us
+100 ns, value=1000000
+ t.value=100, t.unit=ns
+1 us, value=10000000
+ t.value=1, t.unit=us
+10 us, value=100000000
+ t.value=10, t.unit=us
+100 us, value=1000000000
+ t.value=100, t.unit=us
+1 ms, value=10000000000
+ t.value=1, t.unit=ms
+100 s, value=1000000000000000
+ t.value=100, t.unit=s
+
+Resolution = 10 fs
+10 ns, value=1000000
+ t.value=10, t.unit=ns
+100 ns, value=10000000
+ t.value=100, t.unit=ns
+1 us, value=100000000
+ t.value=1, t.unit=us
+100 ns, value=10000000
+ t.value=100, t.unit=ns
+1 us, value=100000000
+ t.value=1, t.unit=us
+10 us, value=1000000000
+ t.value=10, t.unit=us
+100 us, value=10000000000
+ t.value=100, t.unit=us
+1 ms, value=100000000000
+ t.value=1, t.unit=ms
+100 s, value=10000000000000000
+ t.value=100, t.unit=s
+
+Resolution = 1 fs
+10 ns, value=10000000
+ t.value=10, t.unit=ns
+100 ns, value=100000000
+ t.value=100, t.unit=ns
+1 us, value=1000000000
+ t.value=1, t.unit=us
+100 ns, value=100000000
+ t.value=100, t.unit=ns
+1 us, value=1000000000
+ t.value=1, t.unit=us
+10 us, value=10000000000
+ t.value=10, t.unit=us
+100 us, value=100000000000
+ t.value=100, t.unit=us
+1 ms, value=1000000000000
+ t.value=1, t.unit=ms
+100 s, value=100000000000000000
+ t.value=100, t.unit=s
+
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test19/test19.cpp b/src/systemc/tests/systemc/kernel/sc_time/test19/test19.cpp
new file mode 100644
index 000000000..c7a7f357c
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_time/test19/test19.cpp
@@ -0,0 +1,93 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test19.cpp -- Test sc_time string/tuple conversions
+
+ Original Author: Philipp A. Hartmann, OFFIS
+
+ *****************************************************************************/
+
+
+#include "systemc.h"
+
+void check_time( const sc_time& t, sc_time_unit tu, const std::string & str )
+{
+ sc_time_tuple tp = t;
+
+ std::cout << t.to_string() << ", value=" << t.value() << std::endl;
+ std::cout << " ";
+ if( tp.has_value() )
+ std::cout << "t.value=" << tp.value();
+ else
+ std::cout << "t.double=" << tp.to_double();
+ std::cout << ", t.unit=" << tp.unit_symbol()
+ << std::endl;
+
+ sc_assert( tp.has_value() );
+ sc_assert( t.to_string() == str );
+ sc_assert( tp.to_string() == t.to_string() );
+ sc_assert( tp.unit() == tu );
+
+ sc_time u = sc_time::from_string( str.c_str() );
+ sc_assert( t == u );
+ sc_assert( u == tp );
+ sc_assert( tp.unit() == sc_time_tuple(u).unit() );
+
+ u = sc_time( tp.to_double(), tp.unit_symbol() );
+ sc_assert( t == u );
+ sc_assert( u == tp );
+ sc_assert( tp.unit() == sc_time_tuple(u).unit() );
+}
+
+int sc_main( int, char*[] )
+{
+ sc_report_handler::set_actions( SC_ID_SET_TIME_RESOLUTION_, SC_DO_NOTHING );
+ sc_report_handler::set_actions( SC_ID_TIME_CONVERSION_FAILED_, SC_DISPLAY );
+
+ unsigned resolutions[] = { 100, 10, 1 };
+ sc_time_unit resunit = SC_FS;
+ unsigned* res = resolutions;
+
+ while( true )
+ {
+ std::cout << "\nResolution = " << sc_get_time_resolution() << std::endl;
+
+ check_time( sc_time( 10, SC_NS), SC_NS, "10 ns" );
+ check_time( sc_time( 100, SC_NS), SC_NS, "100 ns" );
+ check_time( sc_time(1000, SC_NS), SC_US, "1 us" );
+ check_time( sc_time( 0.1, SC_US), SC_NS, "100 ns" );
+ check_time( sc_time( 1, SC_US), SC_US, "1 us" );
+ check_time( sc_time( 10, SC_US), SC_US, "10 us" );
+ check_time( sc_time( 100, SC_US), SC_US, "100 us" );
+ check_time( sc_time(1000, SC_US), SC_MS, "1 ms" );
+ check_time( sc_time( 100, SC_SEC), SC_SEC, "100 s" );
+
+ // exit loop before final resolution update
+ if (res == resolutions + (sizeof(resolutions)/sizeof(*resolutions)))
+ break;
+
+ sc_set_time_resolution( *res, resunit );
+ res++;
+ }
+
+ cout << "\nProgram completed" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_ver/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_ver/test01/golden/test01.log
new file mode 100644
index 000000000..edb2082ee
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_ver/test01/golden/test01.log
@@ -0,0 +1,3 @@
+SystemC Simulation
+
+Info: sc_api_version: in sc_main
diff --git a/src/systemc/tests/systemc/kernel/sc_ver/test01/main.cpp b/src/systemc/tests/systemc/kernel/sc_ver/test01/main.cpp
new file mode 100644
index 000000000..31191736a
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_ver/test01/main.cpp
@@ -0,0 +1,38 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.cpp -- Test consistency check of SC_DEFAULT_WRITER_POLICY setting
+ (see test-unchecked.cpp)
+
+ Original Author: Philipp A. Hartmann, OFFIS, 2013-11-05
+
+*****************************************************************************/
+
+#ifndef SC_DEFAULT_WRITER_POLICY
+# define SC_DEFAULT_WRITER_POLICY SC_MANY_WRITERS
+#endif
+#include <systemc>
+
+int sc_main(int,char*[])
+{
+ SC_REPORT_INFO( "sc_api_version", "in sc_main" );
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_ver/test01/test-unchecked.cpp b/src/systemc/tests/systemc/kernel/sc_ver/test01/test-unchecked.cpp
new file mode 100644
index 000000000..e9e3b4a59
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_ver/test01/test-unchecked.cpp
@@ -0,0 +1,33 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test-unchecked.cpp -- force SC_DEFAULT_WRITER_POLICY to SC_MANY_WRITERS
+ (for consistency checking)
+
+ Original Author: Philipp A. Hartmann, OFFIS, 2013-11-05
+
+*****************************************************************************/
+
+#ifdef SC_DEFAULT_WRITER_POLICY
+# undef SC_DEFAULT_WRITER_POLICY
+#endif
+#define SC_DEFAULT_WRITER_POLICY SC_MANY_WRITERS
+#include <systemc>
diff --git a/src/systemc/tests/systemc/kernel/sc_ver/test01/test01.f b/src/systemc/tests/systemc/kernel/sc_ver/test01/test01.f
new file mode 100644
index 000000000..215a2ebff
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_ver/test01/test01.f
@@ -0,0 +1,2 @@
+test01/main.cpp
+test01/test-unchecked.cpp