priority_bug.cpp revision 12855:588919e0e4aa
1#include <systemc> 2 3using namespace sc_core; 4using std::cout; 5using std::endl; 6 7struct M4: sc_module 8{ 9 M4(sc_module_name _name) 10 { 11 SC_THREAD(calling); 12 SC_THREAD(target); 13 t = sc_get_current_process_handle(); 14 } 15 16 sc_process_handle t; 17 sc_event ev; 18 int count; 19 20 void calling() 21 { 22 23 t.sync_reset_on(); 24 wait(10, SC_NS); 25 26 t.suspend(); 27 wait(10, SC_NS); 28 29 t.disable(); 30 wait(10, SC_NS); 31 32 t.enable(); 33 ev.notify(); 34 wait(10, SC_NS); // !!!!!! target is RESET WHILE STILL SUSPENDED !!!!!! 35 36 sc_stop(); 37 } 38 39 void target() 40 { 41 cout << "Target called/reset at " << sc_time_stamp() << endl; 42 count = 0; 43 for (;;) 44 { 45 wait(ev); 46 cout << "Target awoke at " << sc_time_stamp() << " count = " << count << endl; 47 ++count; 48 } 49 } 50 51 SC_HAS_PROCESS(M4); 52}; 53 54int sc_main(int argc, char* argv[]) 55{ 56 M4 m("m"); 57 58 sc_core::sc_allow_process_control_corners = true; 59 sc_start(); 60 61 return 0; 62} 63 64