// ************************************************************************** //
//                                                                            //
//    eses                   eses                                             //
//   eses                     eses                                            //
//  eses    eseses  esesese    eses   Embedded Systems Group                  //
//  ese    ese  ese ese         ese                                           //
//  ese    eseseses eseseses    ese   Department of Computer Science          //
//  eses   eses          ese   eses                                           //
//   eses   eseses  eseseses  eses    University of Kaiserslautern            //
//    eses                   eses                                             //
//                                                                            //
// ************************************************************************** //
// The following program shows that there are statements that can be executed //
// more than once within a cycle: If the control rests at location w1 and i   //
// holds, we first execute "emit a".                                          //
// However, the control does not reach location w2 due to the abortion. Hence,//
//  the abortion takes place and the loop's body is immediately restarted.    //
// Since i holds, we skip the first conditional statement and execute "emit a"//
//  a second time. After this, the control flow reaches location w2.          //
// ************************************************************************** //

module Schizo09(event ?i,!a) {
   loop {
      weak abort {
         if(!i) w1: pause;
         emit(a);
         if(i) w2: pause;
      } when(i);
   }
} drivenby {
    i=false;
    pause;
    i=false;
    pause;
    i=true;
    pause;
}