MODULE SunPwrSt
TITLE 'Sun power controller state pal, Jim Gasbarro, December 5, 1988'

U01 DEVICE 'P16R8';

nJump, nReset PIN 2, 3;
nS0, nS1, nS2, nS3, nS4, nS5, nS6 PIN 19, 18, 17, 16, 15, 14, 13;

IdleEven = ^h01;
StartEven = ^h10;
IdleOdd = ^h57;
StartOdd = ^h2A;
HdrOdd = ^h59;
ResetState = ^h00;

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

EQUATIONS

!nS0 := nJump & !nS1 & nReset #
!nJump & (St == IdleOdd) & nReset #
!nJump & (St == StartOdd) & nReset;

!nS1 := nJump & !nS2 & nReset #
!nJump & (St == HdrOdd) & nReset;

!nS2 := nJump & !nS3 & nReset #
!nJump & (St == HdrOdd) & nReset #
!nJump & (St == IdleOdd) & nReset #
!nJump & (St == StartOdd) & nReset;

!nS3 := nJump & (!nS4 $ !nS0) & nReset;

!nS4 := nJump & !nS5 & nReset #
!nJump & (St == IdleOdd) & nReset #
!nJump & (St == StartOdd) & nReset;

!nS5 := nJump & !nS6 & nReset #
!nJump & (St == HdrOdd) & nReset #
!nJump & (St == IdleOdd) & nReset #
!nJump & (St == StartOdd) & nReset;

!nS6 := nJump & !nS0 & nReset #
!nJump & (St == ResetState) & nReset #
!nJump & (St == IdleEven) & nReset #
!nJump & (St == StartEven) & nReset #
!nJump & (St == IdleOdd) & nReset #
!nJump & (St == StartOdd) & nReset;

END SunPwrSt