package Communication.CSMA;

module buscontroller(bool ?cycle_begin, ?cycle_end, int ?buscontroller_counter,
                     bool !busy, !cd, !buscontroller_counter_reset) {

    loop {
        bus_idle: await(cycle_begin);
        buscontroller_counter_reset = true;
        abort {
                abort {
                        bus_active: await(26 == buscontroller_counter);
                        busy = true;
                        bus_active_wait: halt;
                }when (cycle_begin);

                if (buscontroller_counter < 26) cd = true;

        }when(cycle_end);
  }
}