/* =======================================
   Same Traffic light FSA

   ... I added a circuit translate the
       FSA state (00, 01, 10, 11) to
       the "lights" of a stop light
   ======================================== */
Switch da clk '0' ZERO;
Switch ba error '1' ONE;

Not cc q1 q1_bar;
And cc q0 q1_bar and1;
Or  cc error and1 or1;
Dff bd-dd ZERO or1 clk ZERO q1 ;

Not cg q0 q0_bar;
And cg q1_bar q0_bar and2;
Or  cg error and2 or2;
Dff bh-dh ZERO or2 clk ZERO q0 ;

Probe ad q1;
Probe ah q0;

/*
   "Translation" circuit....

    FSA State   Traffic light

       q1 q0 | Red  Orange Green
       ------+------------------
        0  0 |  0     0      1
        0  1 |  0     1      0
        1  0 |  1     0      0
        1  1 |  1     1      1

                Red    is same as q1
                Orange is same as q0
                Green  needs a cicuit...
*/
Xor   cj q1 q0 help;
Not   cj help helpx;

Probe al q1;     /* Red    light */
Probe bl q0;     /* Orange light */
Probe cl helpx;  /* Green  light */
