示例#1
0
 void second_bystander() // Gets reset by bystander
 {
   for (;;)
   {
     try {
       wait(ev);
     }
     catch (const sc_unwind_exception& ex) {
       cout << "sc_unwind_exception caught by second_bystander" << endl;
       sc_assert( sc_time_stamp() == sc_time(35, SC_NS) );
       sc_assert( ex.is_reset() == true );
       sc_assert( !killing_over );
       sc_assert( v.is_unwinding() ); // sic
       sc_assert( b.is_unwinding() ); // sic
       sc_assert( sc_is_unwinding() );
       
       b3.kill();
       throw ex;
     }
   }
 }
示例#2
0
  void target()
  {
    cout << "Target called/reset at " << sc_time_stamp() << endl;

    for (;;)
    {
      try {
        wait(ev);
        cout << "Target awoke at " << sc_time_stamp() << endl;
      }
      catch (const sc_unwind_exception& ex) {
        cout << "Unwinding at " << sc_time_stamp() << endl;
        sc_assert( t.is_unwinding() );
        sc_assert( sc_is_unwinding() );
        throw ex;
      }
    }
  }
示例#3
0
 void victim()
 {
   try {
     while (true)
     {
       wait(1, SC_NS);
       sc_assert( !sc_is_unwinding() );
     }
   }
   catch (const sc_unwind_exception& ex)
   {
     cout << "sc_unwind_exception caught by victim" << endl;
     sc_assert( sc_time_stamp() == sc_time(35, SC_NS) );
     sc_assert( ex.is_reset() == false );
     sc_assert( !killing_over );
     sc_assert( v.is_unwinding() );
     sc_assert( sc_is_unwinding() );
     
     b.reset();
     throw ex;
   }
 }
示例#4
0
 void ticker()
 {
   for (;;)
   {
     try {
       wait(10, SC_NS);
       ev.notify();
       sc_assert( !sc_is_unwinding() );
     }
     catch (const sc_unwind_exception& ex)
     {
       // ticker process killed by target
       cout << "sc_unwind_exception caught by ticker" << endl;
       sc_assert( !ex.is_reset() );
       sc_assert( count == 1 );
       sc_assert( !killing_over );
       sc_assert( t.is_unwinding() );
       sc_assert( sc_is_unwinding() );
      
       v.kill();
       throw ex;
     }
   }
 }