30 likes | 141 Views
State Machine Homework Solution. oPUSH=0. sWAIT1. /iBLK. iBLK. sPASS2. sPUSH1. oPUSH=0. S0. oPUSH=1. iBLK. iEXT. sWAIT2. sRET1. iRET /iBLK. oPUSH=0. oPUSH=0. Big State Machine Example. sBLKIDLE. iBLKIN. vBLKNUM>=6. vBLKNUM=0. sBLKWAIT. sBLKGO.
E N D
State Machine Homework Solution oPUSH=0 sWAIT1 /iBLK iBLK sPASS2 sPUSH1 oPUSH=0 S0 oPUSH=1 iBLK iEXT sWAIT2 sRET1 iRET/iBLK oPUSH=0 oPUSH=0
Big State Machine Example sBLKIDLE iBLKIN vBLKNUM>=6 vBLKNUM=0 sBLKWAIT sBLKGO load BLKTBL[BLKNUM] into vCURRBLK increment vBLKNUM vSLOTNUM = 0 /iBLKIN vSLOTNUM>=4 vBLKNUM<6 vSLOTNUM<4 sCUTDONE sSLOTINCR sSLOTCHK cCUTRET load vCURRBLK, shift right by vSLOTNUM, store into vCURRSLOT /vCURRSLOT.0 increment vSLOTNUM vCURRSLOT.0 cCUTEXT sCUTGO sSLOTPWAIT sSLOTPOS output position oPOSSTART=1 oCUT=1 cPOSDN /cPOSDN
Big State Machine Example sBLKIDLE iBLKIN vBLKNUM=0 load BLKTBL[BLKNUM] into vCURRBLK increment vBLKNUM vSLOTNUM = 0 sBLKGO sBLKWAIT /iBLKIN sBLKGO2 vSLOTNUM>=4 vBLKNUM>=6 vSLOTNUM<4 sCUTDONE sSLOTINCR sSLOTCHK cCUTRET vBLKNUM<6 load vCURRBLK, shift right by vSLOTNUM, store into vCURRSLOT /vCURRSLOT.0 increment vSLOTNUM sCUTGO sSLOTPOS vCURRSLOT.0 cCUTEXT cPOSDN oCUT=1 output position