112855Sgabeblack@google.com 212855Sgabeblack@google.com// sc_start with event starvation policy 312855Sgabeblack@google.com 412855Sgabeblack@google.com#include <systemc> 512855Sgabeblack@google.comusing namespace sc_core; 612855Sgabeblack@google.comusing std::cout; 712855Sgabeblack@google.comusing std::endl; 812855Sgabeblack@google.com 912855Sgabeblack@google.comSC_MODULE(Top) 1012855Sgabeblack@google.com{ 1112855Sgabeblack@google.com SC_CTOR(Top) 1212855Sgabeblack@google.com { 1312855Sgabeblack@google.com SC_THREAD(T); 1412855Sgabeblack@google.com } 1512855Sgabeblack@google.com 1612855Sgabeblack@google.com sc_event ev; 1712855Sgabeblack@google.com 1812855Sgabeblack@google.com void T() 1912855Sgabeblack@google.com { 2012855Sgabeblack@google.com ev.notify(150, SC_NS); 2112855Sgabeblack@google.com } 2212855Sgabeblack@google.com}; 2312855Sgabeblack@google.com 2412855Sgabeblack@google.comint sc_main(int argc, char* argv[]) 2512855Sgabeblack@google.com{ 2612855Sgabeblack@google.com Top top("top"); 2712855Sgabeblack@google.com 2812855Sgabeblack@google.com sc_assert( sc_get_status() == SC_ELABORATION ); 2912855Sgabeblack@google.com sc_assert( sc_time_stamp() == SC_ZERO_TIME ); 3012855Sgabeblack@google.com sc_start(100, SC_NS); 3112855Sgabeblack@google.com sc_assert( sc_time_stamp() == sc_time(100, SC_NS) ); 3212855Sgabeblack@google.com 3312855Sgabeblack@google.com sc_start(10, SC_NS, SC_RUN_TO_TIME); 3412855Sgabeblack@google.com sc_assert( sc_time_stamp() == sc_time(110, SC_NS) ); 3512855Sgabeblack@google.com 3612855Sgabeblack@google.com sc_start(10, SC_NS, SC_EXIT_ON_STARVATION); 3712855Sgabeblack@google.com sc_assert( sc_time_stamp() == sc_time(110, SC_NS) ); 3812855Sgabeblack@google.com 3912855Sgabeblack@google.com sc_start(80, SC_NS, SC_EXIT_ON_STARVATION); 4012855Sgabeblack@google.com sc_assert( sc_time_stamp() == sc_time(150, SC_NS) ); // FAILS - time = 200 NS 4112855Sgabeblack@google.com 4212855Sgabeblack@google.com sc_start(); 4312855Sgabeblack@google.com sc_assert( sc_time_stamp() == sc_time(150, SC_NS) ); 4412855Sgabeblack@google.com sc_assert( sc_get_status() == SC_PAUSED ); 4512855Sgabeblack@google.com 4612855Sgabeblack@google.com cout << endl << "Success" << endl; 4712855Sgabeblack@google.com return 0; 4812855Sgabeblack@google.com} 49