
module S
{
    input c : boolean;
    input d : boolean;
    output m : boolean;
    output b : boolean;

    var timeout : boolean;

    init {
        timeout := false;
    }

    next {
        if timeout then
            m' = m;
            b' = b;
            timeout' = false;
        else
            m' = !m;
            b' = b;
            timeout' = true;
        endif
    }
}

module R
{
    input c : boolean;
    input d : boolean;
    input m : boolean;
    input b : boolean;

    output c : boolean;
    output d : boolean;

    init {}

    next {
        c' = c;
        d' = m;
    }
}

module main
{
    instance s : S(c, d, m, b);
    instance r : R(c, d, m, b);

    init {}

    next {
        next(s);
        next(r);
    }
}
