112855Sgabeblack@google.com#include <systemc> 212855Sgabeblack@google.comusing namespace sc_core; 312855Sgabeblack@google.comusing namespace sc_dt; 412855Sgabeblack@google.comusing std::cout; 512855Sgabeblack@google.comusing std::endl; 612855Sgabeblack@google.com 712855Sgabeblack@google.com// 20) sc_report_handler::stop_after(SC_FATAL,-1) should NOT call sc_stop on 1st fatal error 812855Sgabeblack@google.com 912855Sgabeblack@google.comstatic bool global_flag_1 = false; 1012855Sgabeblack@google.comstatic bool global_flag_2 = false; 1112855Sgabeblack@google.comstatic bool global_flag_3 = false; 1212855Sgabeblack@google.com 1312855Sgabeblack@google.comSC_MODULE(M) 1412855Sgabeblack@google.com{ 1512855Sgabeblack@google.com SC_CTOR(M) 1612855Sgabeblack@google.com { 1712855Sgabeblack@google.com SC_THREAD(T); 1812855Sgabeblack@google.com } 1912855Sgabeblack@google.com void T() 2012855Sgabeblack@google.com { 2112855Sgabeblack@google.com SC_REPORT_FATAL("/JA", "A bad thing has happened"); 2212855Sgabeblack@google.com wait(1, SC_NS); 2312855Sgabeblack@google.com sc_assert(sc_report_handler::get_count(SC_FATAL) == 1); 2412855Sgabeblack@google.com global_flag_1 = true; 2512855Sgabeblack@google.com 2612855Sgabeblack@google.com sc_report_handler::stop_after(SC_FATAL, 0); 2712855Sgabeblack@google.com SC_REPORT_FATAL("/JA", "A bad thing has happened"); 2812855Sgabeblack@google.com wait(1, SC_NS); 2912855Sgabeblack@google.com sc_assert(sc_report_handler::get_count(SC_FATAL) == 2); 3012855Sgabeblack@google.com global_flag_2 = true; 3112855Sgabeblack@google.com 3212855Sgabeblack@google.com sc_report_handler::stop_after(SC_FATAL, -1); 3312855Sgabeblack@google.com SC_REPORT_FATAL("/JA", "A bad thing has happened"); 3412855Sgabeblack@google.com wait(1, SC_NS); 3512855Sgabeblack@google.com sc_assert(sc_report_handler::get_count(SC_FATAL) == 3); 3612855Sgabeblack@google.com global_flag_3 = true; 3712855Sgabeblack@google.com } 3812855Sgabeblack@google.com}; 3912855Sgabeblack@google.com 4012855Sgabeblack@google.comstruct Top: sc_module 4112855Sgabeblack@google.com{ 4212855Sgabeblack@google.com M *m; 4312855Sgabeblack@google.com Top(sc_module_name) 4412855Sgabeblack@google.com { 4512855Sgabeblack@google.com m = new M("m"); 4612855Sgabeblack@google.com } 4712855Sgabeblack@google.com}; 4812855Sgabeblack@google.com 4912855Sgabeblack@google.comint sc_main(int argc, char* argv[]) 5012855Sgabeblack@google.com{ 5112855Sgabeblack@google.com cout << "Should be silent except for 3 fatal errors..." << endl; 5212855Sgabeblack@google.com 5312855Sgabeblack@google.com sc_report_handler::set_actions(SC_FATAL, SC_DISPLAY); 5412855Sgabeblack@google.com 5512855Sgabeblack@google.com Top top("top"); 5612855Sgabeblack@google.com sc_start(); 5712855Sgabeblack@google.com 5812855Sgabeblack@google.com sc_assert(global_flag_1); 5912855Sgabeblack@google.com sc_assert(global_flag_2); 6012855Sgabeblack@google.com sc_assert(global_flag_3); 6112855Sgabeblack@google.com sc_assert(sc_report_handler::get_count(SC_INFO) == 0); 6212855Sgabeblack@google.com sc_assert(sc_report_handler::get_count(SC_WARNING) == 0); 6312855Sgabeblack@google.com sc_assert(sc_report_handler::get_count(SC_ERROR) == 0); 6412855Sgabeblack@google.com sc_assert(sc_report_handler::get_count(SC_FATAL) == 3); 6512855Sgabeblack@google.com 6612855Sgabeblack@google.com cout << endl << "Success" << endl; 6712855Sgabeblack@google.com return 0; 6812855Sgabeblack@google.com} 69