C C************************************************************************* C SUBROUTINE TEST(LPHASE,LBUF,TITLE,IC,IL,ILE,ISYM,IBUF, C ITYPE,INOO,LFIX) BYTE ISYM(8,20),ISYM1(8,20),IBUF(8,20), C IVECT(20),IVECTP(20),IPAGE,IDASH,L,H,X,C,Z,N0,N1, C IBLANK,COMENT,I6,I8,CLRS,INOO,XORSUM, C ISTATE(20),ISTATT(20),IPIN(20),TITLE(80) LOGICAL LBLANK,LLEFT,LAND,LOR,LSLASH,LEQUAL,LRIGHT,LXOR,LXNOR, C LFIX,LSAME,XORFND,LERR,LPHASE(20),LPHAS1(20),LBUF(20), C LOUT(20),LOUTP(20),LCLOCK,LPTRST,LCTRST,LENABL(20),NREG COMMON LBLANK,LLEFT,LAND,LOR,LSLASH,LEQUAL,LRIGHT,LXOR,LXNOR COMMON /PGE/ IPAGE(80,100) COMMON /FTEST/ IFUNCT,IDESC,IEND DATA IDASH/'-'/,L/'L'/,H/'H'/,X/'X'/,C/'C'/,Z/'Z'/, C N0/'0'/,N1/'1'/, C IBLANK/' '/,COMENT/';'/,I6/'6'/I8/'8'/,CLRS/X'0C'/ IF(IFUNCT.NE.0) GO TO 3 WRITE(1,2) 2 FORMAT(/,' FUNCTION TABLE MUST BE SUPPLIED IN ORDER TO PERFORM', C ' SIMULATION') RETURN 3 WRITE(1,4)CLRS,TITLE 4 FORMAT(' ',A1,' CHECKING THE FUNCTION TABLE',80A1,/) LERR=.FALSE. ITRST=0 IC=0 IL=IFUNCT + 1 CALL INCR(IC,IL,LFIX) DO 10 I=1,19 CALL GETSYM(LPHAS1,ISYM1,I,IC,IL,LFIX) DO 5 J=1,8 5 IBUF(J,1)=ISYM1(J,I) IF(IBUF(8,1).EQ.IDASH) GO TO 12 CALL MATCH(IMATCH,IBUF,ISYM) IF(IMATCH.NE.0) GO TO 7 WRITE(1,6) (IBUF(J,1),J=1,8) 6 FORMAT(/,' FUNCTION TABLE PIN LIST ERROR AT', 8A1) RETURN 7 LOUT(I)=.FALSE. ISTATT(I)=X IVECTP(I)=X IF(ITYPE.NE.6) GO TO 10 IF(IMATCH.EQ.1) ICLOCK=I IF(IMATCH.EQ.11) ITRST=I 10 IPIN(I)=IMATCH 12 IMAX=I-1 NVECT=0 90 NVECT=NVECT+1 IC1=0 IL1=ILE 23 IF(IPAGE(1,IL).NE.COMENT) GO TO 24 IL=IL+1 GO TO 23 24 CONTINUE DO 20 I=1,IMAX IF(IPAGE(IC,IL).EQ.IBLANK) GO TO 21 GO TO 22 21 IC=IC+1 IF(IPAGE(IC,IL).EQ.IBLANK) GO TO 21 22 IVECT(I)=IPAGE(IC,IL) IC=IC+1 20 CONTINUE IL=IL+1 IC=1 IF(IVECT(1).EQ.IDASH) GO TO 95 DO 11 I=1,IMAX IF( IVECT(I).EQ.L.OR.IVECT(I).EQ.H.OR.IVECT(I).EQ.X.OR. C IVECT(I).EQ.Z.OR.IVECT(I).EQ.C) GO TO 11 WRITE(1,8) IVECT(I),NVECT 8 FORMAT(/,' ',A1,' IS NOT AN ALLOWED FUNCTION TABLE ENTRY', C ' IN VECTOR ',I3) RETURN 11 CONTINUE LCLOCK=.FALSE. LCTRST=.TRUE. LPTRST=.TRUE. DO 13 I=1,IMAX 13 LENABL(I)=.TRUE. NREG=.FALSE. DO 15 I=1,20 15 ISTATE(I)=X IF(ITYPE.NE.6) GO TO 25 IF(IVECT(ICLOCK).EQ.C) LCLOCK=.TRUE. LSAME=( ( LPHASE(11)).AND.( LPHAS1(ITRST)).OR. C (.NOT.LPHASE(11)).AND.(.NOT.LPHAS1(ITRST)) ) IF( IVECT(ITRST).EQ.L.AND.(.NOT.LSAME).OR. C IVECT(ITRST).EQ.H.AND.( LSAME) ) LPTRST=.FALSE. IF(LPTRST) GO TO 25 DO 46 I=1,IMAX J=IPIN(I) IF(J.EQ.14.OR.J.EQ.15.OR.J.EQ.16.OR.J.EQ.17) LENABL(I)=.FALSE. IF( INOO.EQ.I6.AND.(J.EQ.13.OR.J.EQ.18) ) LENABL(I)=.FALSE. IF( INOO.EQ.I8.AND.(J.EQ.12.OR.J.EQ.13 C .OR.J.EQ.18.OR.J.EQ.19) ) LENABL(I)=.FALSE. 46 CONTINUE 25 CALL INCR(IC1,IL1,LFIX) 26 CALL GETSYM(LBUF,IBUF,1,IC1,IL1,LFIX) IF(LLEFT) GO TO 29 27 IF(.NOT.LEQUAL) GO TO 26 29 IF(LEQUAL) GO TO 35 NREG=.TRUE. 33 CALL GETSYM(LBUF,IBUF,1,IC1,IL1,LFIX) CALL MATCH(IINP,IBUF,ISYM1) IF(IINP.NE.0) GO TO 32 CALL MATCH(IMATCH,IBUF,ISYM) ILL=IL1 IF( IINP.EQ.0.AND.IMATCH.NE.10.AND.IMATCH.NE.20 ) GO TO 100 IF( IMATCH.EQ.10.AND.(LBUF(1)).OR. C IMATCH.EQ.20.AND.(.NOT.LBUF(1)) ) LCTRST=.FALSE. GO TO 34 32 ITEST=IVECT(IINP) IF( ITEST.EQ.L.AND.( LPHAS1(IINP)).AND.( LBUF(1)) C.OR. ITEST.EQ.H.AND.( LPHAS1(IINP)).AND.(.NOT.LBUF(1)) C.OR. ITEST.EQ.H.AND.(.NOT.LPHAS1(IINP)).AND.( LBUF(1)) C.OR. ITEST.EQ.L.AND.(.NOT.LPHAS1(IINP)).AND.(.NOT.LBUF(1)) C ) LCTRST=.FALSE. IF(ITEST.EQ.X.OR.ITEST.EQ.Z) LCTRST=.FALSE. 34 IF(LAND) GO TO 33 GO TO 27 35 CALL MATCH(IOUTP,IBUF,ISYM1) ILL=IL1 IF(IOUTP.EQ.0) GO TO 100 IF(NREG) LENABL(IOUTP)=LCTRST LOUT(IOUTP)=.TRUE. IF( .NOT.LCTRST ) LOUT(IOUTP)=.FALSE. LCTRST=.TRUE. LOUTP(IOUTP)=LBUF(1) XORSUM=H XORFND=.FALSE. ISUM=L 28 IPROD=H 30 ILL=IL1 CALL GETSYM(LBUF,IBUF,1,IC1,IL1,LFIX) IF( .NOT.LFIX ) GO TO 39 LFIX=.FALSE. CALL FIXTST(LPHAS1,LBUF,IC1,IL1,ISYM,ISYM1,IBUF, C IVECT,IVECTP,ITEST,LCLOCK,NREG,LFIX) IF(IPROD.EQ.H) IPROD=ITEST GO TO 38 39 CALL MATCH(IINP,IBUF,ISYM1) IF(IINP.NE.0) GO TO 45 CALL MATCH(IMATCH,IBUF,ISYM) IF(IMATCH.NE.10) GO TO 100 ITEST=L IINP=19 LPHAS1(19)=.TRUE. GO TO 37 45 ITEST=IVECT(IINP) IF( (.NOT.LCLOCK).OR.(NREG) ) GO TO 37 CALL MATCH(IIFB,IBUF,ISYM) IF( IIFB.EQ.14.OR.IIFB.EQ.15.OR.IIFB.EQ.16.OR.IIFB.EQ.17 ) C ITEST=IVECTP(IINP) IF( (INOO.EQ.I6.OR.INOO.EQ.I8).AND.(IIFB.EQ.13.OR.IIFB.EQ.18) ) C ITEST=IVECTP(IINP) IF( INOO.EQ.I8.AND.(IIFB.EQ.12.OR.IIFB.EQ.19) ) C ITEST=IVECTP(IINP) 37 IF( ITEST.EQ.L.AND.( LPHAS1(IINP)).AND.( LBUF(1)) C.OR. ITEST.EQ.H.AND.( LPHAS1(IINP)).AND.(.NOT.LBUF(1)) C.OR. ITEST.EQ.H.AND.(.NOT.LPHAS1(IINP)).AND.( LBUF(1)) C.OR. ITEST.EQ.L.AND.(.NOT.LPHAS1(IINP)).AND.(.NOT.LBUF(1)) C ) IPROD=L 38 IF(LRIGHT) CALL INCR(IC1,IL1,LFIX) IF(LAND) GO TO 30 IF(ISUM.EQ.L.AND.IPROD.EQ.X) ISUM=X IF( (ISUM.NE.H).AND.IPROD.EQ.H ) ISUM=H IF(.NOT.LXOR) GO TO 31 XORSUM=ISUM XORFND=.TRUE. ISUM=L GO TO 28 31 IF(LOR) GO TO 28 IF(.NOT.XORFND) ISTATT(IOUTP)=ISUM IF( (XORFND).AND.((ISUM.EQ.L.AND.XORSUM.EQ.L).OR. C (ISUM.EQ.H.AND.XORSUM.EQ.H)) ) ISTATT(IOUTP)=L IF( (XORFND).AND.((ISUM.EQ.H.AND.XORSUM.EQ.L).OR. C (ISUM.EQ.L.AND.XORSUM.EQ.H)) ) ISTATT(IOUTP)=H IF( (XORFND).AND. (ISUM.EQ.X.OR. XORSUM.EQ.X) ) ISTATT(IOUTP)=X NREG=.FALSE. IF(IDESC.NE.0.AND.IL1.LT.IFUNCT.AND.IL1.LT.IDESC.OR. C IDESC.EQ.0.AND.IL1.LT.IFUNCT) GO TO 27 DO 50 I=1,IMAX IF( .NOT.LOUT(I) ) GO TO 50 IF( ISTATT(I).EQ.X.AND.IVECT(I).EQ.X ) GO TO 50 LSAME = ( ( LOUTP(I)).AND.( LPHAS1(I)).OR. C (.NOT.LOUTP(I)).AND.(.NOT.LPHAS1(I)) ) IMESS=40 IF(ISTATT(I).EQ.L.AND.IVECT(I).EQ.L.AND.(.NOT.LSAME)) IMESS=41 IF(ISTATT(I).EQ.H.AND.IVECT(I).EQ.H.AND.(.NOT.LSAME)) IMESS=42 IF(ISTATT(I).EQ.L.AND.IVECT(I).EQ.H.AND.( LSAME)) IMESS=42 IF(ISTATT(I).EQ.H.AND.IVECT(I).EQ.L.AND.( LSAME)) IMESS=41 IF( ( LENABL(I)).AND.IVECT(I).EQ.Z ) IMESS=43 IF( (.NOT.LENABL(I)).AND.(LOUT(I)).AND.IVECT(I).NE.Z) IMESS=44 IF(IMESS.NE.40) LERR=.TRUE. IF(IMESS.EQ.41) WRITE(1,41) NVECT,(ISYM1(J,I),J=1,8) 41 FORMAT(/,' FUNCTION TABLE ERROR AT VECTOR',I3,' PIN =',8A1, C ' EXPECT = H ACTUAL = L') IF(IMESS.EQ.42) WRITE(1,42) NVECT,(ISYM1(J,I),J=1,8) 42 FORMAT(/,' FUNCTION TABLE ERROR AT VECTOR',I3,' PIN =',8A1, C ' EXPECT = L ACTUAL = H') IF(IMESS.EQ.43) WRITE(1,43) NVECT,(ISYM1(J,I),J=1,8) 43 FORMAT(/,' FUNCTION TABLE ERROR AT VECTOR',I3,'PIN =',8A1, C /,' EXPECT = OUTPUT ENABLE ACTUAL = Z') IF(IMESS.EQ.44) WRITE(1,44) NVECT,(ISYM1(J,I),J=1,8),IVECT(I) 44 FORMAT(/,' FUNCTION TABLE ERROR AT VECTOR',I3,'PIN =',8A1, C ' EXPECT = Z ACTUAL = ',A1) 50 CONTINUE DO 65 I=1,20 DO 55 J=1,IMAX IF(IPIN(J).NE.I) GO TO 55 IF( IVECT(J).EQ.L.OR.IVECT(J).EQ.H ) GO TO 51 ISTATE(I)=IVECT(J) GO TO 65 51 LSAME=( ( LPHASE(I)).AND.( LPHAS1(J)).OR. C (.NOT.LPHASE(I)).AND.(.NOT.LPHAS1(J)) ) IF( INOO.EQ.N1.AND.(I.EQ.15.OR.I.EQ.16) ) LOUT(J)=.TRUE. IF( (.NOT.LOUT(J)).AND.( LSAME).AND. C IVECT(J).EQ.L ) ISTATE(I)=N0 IF( (.NOT.LOUT(J)).AND.( LSAME).AND. C IVECT(J).EQ.H ) ISTATE(I)=N1 IF( (.NOT.LOUT(J)).AND.(.NOT.LSAME).AND. C IVECT(J).EQ.L ) ISTATE(I)=N1 IF( (.NOT.LOUT(J)).AND.(.NOT.LSAME).AND. C IVECT(J).EQ.H ) ISTATE(I)=N0 IF( ( LOUT(J)).AND.( LSAME).AND. C IVECT(J).EQ.L.AND.( LENABL(J)) ) ISTATE(I)=L IF( ( LOUT(J)).AND.( LSAME).AND. C IVECT(J).EQ.H.AND.( LENABL(J)) ) ISTATE(I)=H IF( ( LOUT(J)).AND.(.NOT.LSAME).AND. C IVECT(J).EQ.L.AND.( LENABL(J)) ) ISTATE(I)=H IF( ( LOUT(J)).AND.(.NOT.LSAME).AND. C IVECT(J).EQ.H.AND.( LENABL(J)) ) ISTATE(I)=L GO TO 65 55 CONTINUE 65 IF( (LCLOCK).AND.IVECT(J).NE.Z ) IVECTP(J)=IVECT(J) ISTATE(10)=X ISTATE(20)=N1 WRITE(1,60) NVECT,(ISTATE(I),I=1,20) 60 FORMAT(' ',I2,' ',20A1) GO TO 90 95 IF(.NOT.LERR) WRITE(1,67) 67 FORMAT(/,' PASS SIMULATION') RETURN 100 ILERR=ILL+4 WRITE(1,101) (IBUF(I,1),I=1,8),ILERR,(IPAGE(I,ILL),I=1,79) 101 FORMAT(/,' ERROR SYMBOL = ',8A1,' IN LINE NUMBER ',I3, C /,' ',80A1,/,' THIS PIN NAME IS NOT DEFINED IN THE', C ' FUNCTION TABLE PIN LIST') RETURN END C C****************************************************************************** C SUBROUTINE FIXTST(LPHAS1,LBUF,IC1,IL1,ISYM,ISYM1,IBUF, C IVECT,IVECTP,ITEST,LCLOCK,NREG,LFIX) BYTE ISYM(8,20),ISYM1(8,20),IBUF(8,20),IVECT(20),IVECTP(20), C IPAGE,L,H,X,Z LOGICAL LBLANK,LLEFT,LAND,LOR,LSLASH,LEQUAL,LRIGHT,LXOR,LXNOR, C LFIX,LPHAS1(20),LBUF(20),LCLOCK,NREG,TOR,TXOR,TXNOR,TAND, C LPHASA,LPHASB COMMON LBLANK,LLEFT,LAND,LOR,LSLASH,LEQUAL,LRIGHT,LXOR,LXNOR COMMON /PGE/ IPAGE(80,100) DATA L/'L'/,H/'H'/,X/'X'/,Z/'Z'/ CALL GETSYM(LBUF,IBUF,1,IC1,IL1,LFIX) CALL MATCH(IINP,IBUF,ISYM1) ITESTA=IVECT(IINP) LPHASA = ( ( LBUF(1)).AND.( LPHAS1(IINP)).OR. C (.NOT.LBUF(1)).AND.(.NOT.LPHAS1(IINP)) ) IF( (.NOT.LCLOCK).OR.(NREG) ) GO TO 5 CALL MATCH(IIFB,IBUF,ISYM) IF( IIFB.EQ.14.OR.IIFB.EQ.15.OR.IIFB.EQ.16.OR.IIFB.EQ.17 ) C ITESTA=IVECTP(IINP) 5 IF( (.NOT.LPHASA).AND.ITESTA.EQ.L ) GO TO 10 IF( (.NOT.LPHASA).AND.ITESTA.EQ.H ) GO TO 15 GO TO 20 10 ITESTA=H GO TO 20 15 ITESTA=L 20 IF( .NOT.LRIGHT ) GO TO 25 ITEST=ITESTA RETURN 25 TOR = (LOR.AND.(.NOT.LXOR)) TXOR = (LXOR) TXNOR = (LXNOR) TAND = (LAND.AND.(.NOT.LXNOR)) CALL GETSYM(LBUF,IBUF,1,IC1,IL1,LFIX) CALL MATCH(IINP,IBUF,ISYM1) ITESTB=IVECT(IINP) LPHASB = ( ( LBUF(1)).AND.( LPHAS1(IINP)).OR. C (.NOT.LBUF(1)).AND.(.NOT.LPHAS1(IINP)) ) IF( (.NOT.LPHASB).AND.ITESTB.EQ.L ) GO TO 30 IF( (.NOT.LPHASB).AND.ITESTB.EQ.H ) GO TO 35 GO TO 40 30 ITESTB=H GO TO 40 35 ITESTB=L 40 ITEST=L IF( (TOR).AND.(ITESTA.EQ.H.OR. ITESTB.EQ.H) ) ITEST=H IF( (TXOR).AND.((ITESTA.EQ.H.AND.ITESTB.NE.H).OR. C (ITESTA.NE.H.AND.ITESTB.EQ.H) )) ITEST=H IF( (TXNOR).AND.((ITESTA.EQ.ITESTB).OR. C (ITESTA.EQ.X.OR.ITESTB.EQ.X) )) ITEST=H IF( (TAND).AND.(ITESTA.NE.L.AND.ITESTB.NE.L) ) ITEST=H IF( (ITESTA.EQ.X.OR.ITESTA.EQ.Z).AND.(ITESTB.EQ.X) ) ITEST=X RETURN END C C*************************************************************************** C