IdleEven  = ↑h01;
StartEven = ↑h10;
HdrEven   = ↑h32;
A0State   = ↑h72;
A1State   = ↑h33;
A2State   = ↑h60;
A3State   = ↑h25;
A4State   = ↑h3E;
A5State   = ↑h23;
A6State   = ↑h52;
IdleOdd   = ↑h57;
StartOdd  = ↑h2A;
HdrOdd    = ↑h59;
A7State   = ↑h78;
A8State   = ↑h0E;
CmdState  = ↑h75;
ResetState = ↑h00;

St = [!nS0, !nS1, !nS2, !nS3, !nS4, !nS5, !nS6];

EQUATIONS

nJump = !(
        (St == ResetState) #
        (St == IdleEven) & SerIn #
        (St == StartEven) & SerIn #
        (St == IdleOdd) & SerIn #
        (St == StartOdd) & SerIn #
        (St == HdrOdd) & !SerIn
        );

nCmd = !(St == CmdState);


OnA := !(
       nCmd & !OnA & nForceOn #
       (St == CmdState) & nBadAdr & (!OnA # OnB) & !SerIn & nForceOn #
       (St == CmdState) & (!nBadAdr # (OnA & !OnB)) & !OnA & nForceOn #
       (St == ResetState)
       );

nHdrEven := !(St == HdrEven);

nBad0To7 := !(
             (St == A0State) & (SerIn != A0) #
             (St == A1State) & (SerIn != A1) #
             (St == A2State) & (SerIn != A2) #
             (St == A3State) & (SerIn != A3) #
             (St == A4State) & (SerIn != A4) #
             (St == A5State) & (SerIn != A5) #
             (St == A6State) & (SerIn != A6) #
             (St == A7State) & (SerIn != A7)
             );

nBadAdr := !(
            nHdrEven & !nBadAdr #
            (St == HdrEven) & SerIn #
            !nBad0To7 #
            (St == A8State) & (SerIn != A8)
            );

END SunPwrAd