Trailing-Edge
-
PDP-10 Archives
-
decuslib20-01
-
decus/20-0020/fsmsim.eng
There are 2 other files named fsmsim.eng in the archive. Click here to see a list.
100' NAME--FSMSIM
110'
120' DESCRIPTION--SIMULATES THE INPUT/OUTPUT BEHAVIOR OF ANY SPECIFIED
130' FINITE-STATE MEALY MACHINE WITH INITIAL STATE;THE OUTPUT OF
140' CURRENT STATE INFORMATION IS OPTIONAL.
150'
160' SOURCE--THOMAS F. PIATKOWSKI, THAYER SCHOOL OF ENGINEERING.
170'
180' INSTRUCTIONS--THE PROGRAM RUNS IN THE CONVERSATIONAL MODE AND
190' ALL PARAMETERS ARE INPUT IN RESPONSE TO PROGRAM GENERATED
200' QUESTIONS.
210' THE FOLLOWING CONVENTIONS APPLY:
220'
230' A FSM IS A SYSTEM <S,X,Y,FS,FZ> WHERE
240' S = THE STATE SET=(1,2,....,N),1<=N<=100
250' X = THE INPUT ALPHABET=(1,2,.....,P),1<=P<=5
260' Z = THE OUTPUT ALPHABET = ANY SET OF INTEGERS
270' FS, THE NEXT STATE FUNCTION, MAPS S*X INTO S
280' AND FZ, THE CURRENT OUTPUT FUNCTION, MAPS
290' S*X INTO Z
300'
310' FOR FURTHER DETAILS ON FINITE-STATE MACHINES SEE, FOR EXAMPLE:
320' GILL,INTRODUCTION TO THE THEORY OF FINITE-STATE
330' MACHINES, MC GRAW-HILL,1962.
340'
350'
360' * * * * * * * * MAIN PROGRAM * * * * * * * * * *
370'
380 PRINT"SIMULATION OF A FINITE-STATE MACHINE"
390 PRINT
400 PRINT"N,P";
410 INPUT N,P
420 PRINT" "
430 IF N*(101-N)>0 THEN 460
440 PRINT "N ILLEGAL"
450 GO TO 380
460 IF P*(6-P)>0 THEN 490
470 PRINT "P ILLEGAL"
480 GO TO 380
490 PRINT "FS-TABLE"
500 PRINT" I FS(I,J) FOR J=1 TO";P
510 FOR I=1 TO N
520 PRINT I;
530 MAT INPUT V
540 IF NUM=P THEN 570
550 PRINT"INCORRECT NUMBER OF ENTRIES--PLEASE RE-TYPE"
560 GO TO 520
570 FOR K=1 TO P
580 LET F(I,K)=V(K)
590 NEXT K
600 NEXT I
610 PRINT" "
620 PRINT "FZ-TABLE"
630 PRINT" I FZ(I,J) FOR J=1 TO";P
640 FOR I=1 TO N
650 PRINT I;
660 MAT INPUT V
670 IF NUM=P THEN 700
680 PRINT"INCORRECT NUMBER OF ENTRIES--PLEASE RE-TYPE"
690 GO TO 650
700 FOR K=1 TO P
710 LET G(I,K)=V(K)
720 NEXT K
730 NEXT I
740 PRINT" "
750 PRINT"MACHINE TABLES FS,FZ"
760 PRINT" INPUTS"
770 PRINT "STATE";
780 FOR I=1 TO P
790 PRINT TAB(5+10*I);I;
800 NEXT I
810 PRINT" "
820 PRINT" "
830 FOR I=1 TO N
840 PRINT I,
850 FOR J=1 TO P
860 PRINT TAB(5+10*J);F(I,J);TAB(10+10*J);G(I,J);
870 NEXT J
880 PRINT" "
890 NEXT I
900 PRINT" "
910 PRINT "INITIAL STATE";
920 INPUT S1
930 PRINT "STATE SUPRESS";
940 INPUT X$
950 PRINT
960 IF X$="YES" THEN 980
970 PRINT "STATE";
980 PRINT TAB(8);"INPUT OUTPUT (TO EXIT FROM SIMULATION SEQUENCE"
990 PRINT TAB(24);"ENTER INPUT OUT OF RANGE 1 TO " P ")"
1000 IF X$="YES" THEN 1020
1010 PRINT S1;
1020 PRINT TAB(8);
1030 INPUT I
1040 IF I*(P+1-I)>0 THEN 1110
1050 PRINT"ILLEGAL INPUT(0=QUIT,1=NEW INPUT,2=NEW INITIAL STATE,3=NEW M)";
1060 INPUT Y
1070 IF Y=3 THEN 390
1080 IF Y=2 THEN 910
1090 IF Y=1 THEN 1000
1100 STOP
1110 PRINT TAB(15);G(S1,I)
1120 LET S1=F(S1,I)
1130 IF X$="YES" THEN 1020
1140 PRINT S1;
1150 GO TO 1020
1160 END