FTN66,Y,J,E 
*************************************************************** 
* (C) COPYRIGHT HEWLETT-PACKARD COMPANY 1980.  ALL RIGHTS     * 
* RESERVED.  NO PART OF THIS PROGRAM MAY BE PHOTOCOPIED, RE-  * 
* REPRODUCED, OR TRANSLATED TO ANOTHER PROGRAM LANGUAGE WITH- * 
* OUT THE PRIOR WRITTEN CONSENT OF HEWLETT-PACKARD COMPANY.   * 
*************************************************************** 
*  NAME:   HPUTL                      * 
*  SOURCE: 92091-18023                * 
*  RELOC:  92091-16023                * 
*  PGMR:   C. GEBER                   * 
*************************************** 
$PAGE 
$EMA /BLANK/
$CDS ON 
      SUBROUTINE ACGRP(KNTR,LOC,LOUTPT,NPOINT,NUMOUT) 
     + ,92091-16021 REV.5000 <890418.1141>
      IMPLICIT REAL*8 (A-H,O-Z) 
      COMMON /BLANK/ VALUE(64)
      INTEGER NODPLC(64)
      COMPLEX CVALUE(32),CVAL 
      EQUIVALENCE (NODPLC(1),VALUE(1),CVALUE(1))
C 
C     AC ANALYSES BINARY FILE OUTPUT
C 
C     INITIALIZE STORAGE POINTERS 
C 
      CALL GETM4(JTAB,0)
      CALL GETM4(JTYPE,0) 
      CALL GETM8(LOCX,0)
      CALL GETM8(LOCY,0)
C 
C     OUTPUT HEADER RECORD FOR BINARY FILE
C 
      CALL SETGRP(LOC,JTAB,JTYPE) 
C 
C     IF NO OUTPUT VARIABLES, ALL DONE
C 
      IF (KNTR.EQ.0) GO TO 100
C 
C     INCREASE STORAGE ALLOCATION 
C 
      NTOTAL = 8 * ((NPOINT+7)/8) 
      CALL EXTMEM(LOCX,NTOTAL)
      CALL EXTMEM(LOCY,NTOTAL)
C 
C     FILL X-VALUE BUFFER AND WRITE TO BINARY FILE
C 
      LOUT = LOUTPT 
      DO 10 I=1,NPOINT
          VALUE(LOCX+I) = DBLE(REAL(CVALUE(LOUT+1)))
          LOUT = LOUT + NUMOUT
   10 CONTINUE
      DO 20 I=1,NTOTAL,8
          WRITE(7) (VALUE(LOCX+J),J=I,I+7)
   20 CONTINUE
$PAGE 
C 
C     LOOP THROUGH ALL OUTPUT VARIABLES 
C 
      DO 30 K=1,KNTR
          LOUT  = LOUTPT
          ISEQ  = NODPLC(JTAB+K)
          ISEQ  = NODPLC(ISEQ+4)
          DO 40 I=1,NPOINT
              CVAL  = CVALUE(LOUT+ISEQ) 
              KTYPE = NODPLC(JTYPE+K) 
              CALL MAGPHS(CVAL,XMAG,XPHS) 
              GO TO (51,51,53,54,55,56),KTYPE 
   51             YVAR = XMAG 
                  GO TO 60
   53             YVAR = DBLE(REAL(CVAL)) 
                  GO TO 60
   54             YVAR = DBLE(AIMAG(CVAL))
                  GO TO 60
   55             YVAR = XPHS 
                  GO TO 60
   56             YVAR = 20.0D0*DLOG10(XMAG)
   60             VALUE(LOCY+I) = YVAR
                  LOUT = LOUT + NUMOUT
   40     CONTINUE
          DO 70 I=1,NTOTAL,8
              WRITE (7) (VALUE(LOCY+J),J=I,I+7) 
   70     CONTINUE
   30 CONTINUE
C 
C     UPDATE POINTER RECORD 
C 
      READ(7,REC=1) IFLAG,NREC
      NREC = NREC + 1 + KNTR + (1+KNTR)*(NTOTAL/8)
      WRITE(7,REC=1) IFLAG,NREC 
C 
C     RELEASE STORAGE 
C 
  100 CALL CLRMEM(JTAB) 
      CALL CLRMEM(JTYPE)
      CALL CLRMEM(LOCX) 
      CALL CLRMEM(LOCY) 
      RETURN
      END 
      SUBROUTINE CODEXC 
     + ,92091-16021 REV.5000 <890418.1141>
C 
C     THIS IS A DUMMY ROUTINE FOR ITER8 IN OVERLAY DCTRAN 
C 
      RETURN
      END 
      SUBROUTINE CODGEN 
     + ,92091-16021 REV.5000 <890418.1141>
C 
C     THIS IS A DUMMY ROUTINE FOR ITER8 IN OVERLAY DCTRAN 
C 
      RETURN
      END 
$ALIAS EXEC,NOEMA 
      SUBROUTINE DATIME(ADATE,ATIME)
     + ,92091-16021 REV.5000 <890418.1141>
      IMPLICIT INTEGER*2 (A-Z)
      REAL*8 ADATE,DDATE,ATIME,DTIME
      DIMENSION TIME(5),TABLE(12) 
      EQUIVALENCE (DATE,TIME(5)),(DDATE,IDATE),(DTIME,ITIME)
      DATA TABLE / 31,28,31,30,31,30,31,31,30,31,30,31/ ! modif RM 13/12/88 
C 
C     GET SYSTEM TIME AND JULIAN DATE 
C 
      CALL EXEC(11I,TIME,YEAR)
C 
C     ENCODE TIME INTO ASCII
C 
      ENCODE(8,90,ITIME) TIME(4),TIME(3),TIME(2)
   90 FORMAT(I2,":",I2.2,":",I2.2)
      ATIME = DTIME 
C 
C     ADJUST MONTH TABLE FOR LEAP YEARS 
C 
      IF (MOD(YEAR,4).EQ.0) TABLE(2) = 29 
C 
C     REMOVE CENTURY FROM YEAR
C 
      YEAR = MOD(YEAR,100)
C 
C     CONVERT JULIAN DATE TO MONTH AND DAY
C 
      DO 10 MONTH=1,12
         IF (DATE.LE.TABLE(MONTH)) GO TO 20 
         DATE  = DATE - TABLE(MONTH)
   10 CONTINUE
C 
C     ENCODE DATE INTO ASCII
C 
C  20 ENCODE(8,91,IDATE) MONTH,DATE,YEAR
   20 ENCODE(8,91,IDATE) DATE,MONTH,YEAR  ! French date 
   91 FORMAT(I2,"/",I2.2,"/",I2)
      ADATE = DDATE 
      RETURN
      END 
$EMA /BLANK/
      SUBROUTINE DCTGRP(ITAB,ITYPE,KNTR,LOC,NPOINT) 
     + ,92091-16021 REV.5000 <890418.1141>
      IMPLICIT REAL*8 (A-H,O-Z) 
      COMMON /BLANK/ VALUE(64)
      INTEGER NODPLC(64)
      COMPLEX CVALUE(32)
      EQUIVALENCE (VALUE(1),NODPLC(1),CVALUE(1))
C 
C     DC AND TRANSIENT ANALYSIS BINARY FILE OUTPUT
C 
C     INITIALIZE STORAGE POINTERS 
C 
      CALL GETM4(JTAB,0)
      CALL GETM4(JTYPE,0) 
      CALL GETM8(LOCX,0)
      CALL GETM8(LOCY,0)
C 
C     OUTPUT HEADER RECORD FOR BINARY FILE
C 
      CALL SETGRP(LOC,JTAB,JTYPE) 
C 
C     IF NO OUTPUT VARIABLES, ALL DONE
C 
      IF (KNTR.EQ.0) GO TO 100
C 
C     INCREASE STORAGE ALLOCATION 
C 
      NTOTAL = 8 * ((NPOINT+7)/8) 
      CALL EXTMEM(LOCX,NTOTAL)
      CALL EXTMEM(LOCY,NTOTAL)
C 
C     FILL X-VALUE BUFFER AND WRITE TO BINARY FILE
C 
      NOUT  = KNTR
      KNTR  = 1 
      ITAB  = NODPLC(JTAB+1)
      ITYPE = NODPLC(JTYPE+1) 
      CALL NTRPL8(LOCX,LOCY,NUMPNT) 
      DO 10 I=1,NTOTAL,8
          WRITE(7) (VALUE(LOCX+J),J=I,I+7)
   10 CONTINUE
$PAGE 
C 
C     LOOP THROUGH ALL OUTPUT VARIABLES 
C 
      DO 20 K=1,NOUT
          ITAB  = NODPLC(JTAB+K)
          ITYPE = NODPLC(JTYPE+K) 
          CALL NTRPL8(LOCX,LOCY,NUMPNT) 
          DO 30 I=1,NTOTAL,8
              WRITE(7) (VALUE(LOCY+J),J=I,I+7)
   30     CONTINUE
   20 CONTINUE
C 
C     UPDATE POINTER RECORD 
C 
      READ(7,REC=1) IFLAG,NREC
      NREC = NREC + 1 + NOUT + (1+NOUT)*(NTOTAL/8)
      WRITE(7,REC=1) IFLAG,NREC 
C 
C     RELEASE STORAGE 
C 
  100 CALL CLRMEM(JTAB) 
      CALL CLRMEM(JTYPE)
      CALL CLRMEM(LOCX) 
      CALL CLRMEM(LOCY) 
      RETURN
      END 
      DOUBLE PRECISION FUNCTION DFLOAT(I) 
     + ,92091-16021 REV.5000 <890418.1141>
      IMPLICIT REAL*8 (A-H,O-Z) 
C 
      DFLOAT = DBLE(FLOAT(I)) 
      RETURN
      END 
      SUBROUTINE ERRSET 
     + ,92091-16021 REV.5000 <890418.1141>
C 
C     THIS IS A DUMMY FUNCTION FOR SIMSP
C 
      RETURN
      END 
$EMA /BLANK/
      SUBROUTINE GRPALL(JELCNT,JUNODE,LOCATE,NUNODS)
     + ,92091-16021 REV.5000 <890418.1141>
      IMPLICIT REAL*8 (A-H,O-Z) 
C 
C     THIS ROUTINE PROCESSES THE "GRAPH ALL" OUTPUT LISTS 
C 
      DIMENSION LOCATE(50),JELCNT(50) 
      COMMON /BLANK/ VALUE(64)
      INTEGER NODPLC(64)
      COMPLEX CVALUE(32)
      EQUIVALENCE (VALUE(1),NODPLC(1),CVALUE(1))
      DATA ABLNK / 1H / 
C 
C  OUTER LOOP FOR ANALYSIS TYPES (DC, TRAN, AC, NOISE, DISTO) 
C 
      DO 1000 I=1,5 
C 
C  LOOK FOR A ".GRAPH" ELEMENT
C 
          ID   = 45 + I 
          NGRP = JELCNT(ID) 
C 
C  IF NONE, TRY NEXT ANALYSIS TYPE
C 
          IF (NGRP.EQ.0) GO TO 1000 
C 
C  LOOK FOR A ".GRAPH ... ALL", INDICATED BY -1 IN VARIABLE COUNT 
C 
          LOCG = LOCATE(ID) 
          DO 20 J=1,NGRP
              IF (NODPLC(LOCG+3).EQ.-1) GO TO 30
              LOCG = NODPLC(LOCG) 
   20     CONTINUE
C 
C  NONE FOUND, TRY NEXT ANAL TYPE 
C 
          GO TO 1000
C 
C  PROCESS ".GRAPH ... ALL" BASED ON ANALYSIS TYPE
C 
   30     GO TO (100,100,100,400,500), I
$PAGE 
C 
C  DC, TRAN, AND AC: CYCLE THROUGH ALL USER NODES (EXCEPT GROUND!)
C 
  100     DO 110 N=2,NUNODS 
              NODE = NODPLC(JUNODE+N) 
C 
C  ADD VOLTAGE OUTPUT VARIABLE TO OUTPUT LIST 
C 
              ID     = 40 + I 
              OUTNAM = ABLNK
              IPOS   = 1
              CALL ALFNUM(NODE,OUTNAM,IPOS) 
              IPOS   = 5
              CALL ALFNUM(0,OUTNAM,IPOS)
              CALL FIND(OUTNAM,ID,LOCO,0) 
              NODPLC(LOCO+2) = N
              NODPLC(LOCO+3) = 1
              NODPLC(LOCO+5) = 0
C 
C  CREATE ".GRAPH" ELEMENT FOR AC ANALYSIS (VDB(N) AND VP(N)) 
C 
              IF (I.EQ.3) THEN
                  ID = 48 
                  CALL FIND(DFLOAT(JELCNT(ID)),ID,LOCG,1) 
                  NODPLC(LOCG+2) = 3
                  NODPLC(LOCG+3) = 2
                  NODPLC(LOCG+4) = LOCO 
                  NODPLC(LOCG+5) = 5
                  NODPLC(LOCG+6) = LOCO 
                  NODPLC(LOCG+7) = 6
C 
C  CREATE ".GRAPH ELEMENT FOR DC AND TRAN (V(N))
C 
              ELSE
                  ID = 45 + I 
                  CALL FIND(DFLOAT(JELCNT(ID)),ID,LOCG,1) 
                  NODPLC(LOCG+2) = I
                  NODPLC(LOCG+3) = 1
                  NODPLC(LOCG+4) = LOCO 
                  NODPLC(LOCG+5) = 1
              ENDIF 
  110     CONTINUE
C 
C  AC: FINISHED 
C 
          IF (I.EQ.3) GO TO 1000
$PAGE 
C 
C  DC AND TRAN: LOOK FOR INDEPENDENT VOLTAGE SOURCES
C 
          NSRC = JELCNT(9)
C 
C  IF NONE, TRY NEXT ANALYSIS TYPE
C 
          IF (NSRC.EQ.0) GO TO 1000 
C 
C  CYCLE THROUGH ALL SOURCES
C 
          LOCS = LOCATE(9)
          DO 120 N=1,NSRC 
              LOCV = NODPLC(LOCS+1) 
              ANAM = VALUE(LOCV)
C 
C  ADD TO OUTPUT LIST 
C 
              ID = 40 + I 
              CALL FIND(ANAM,ID,LOCO,0) 
              NODPLC(LOCO+2) = LOCS 
              NODPLC(LOCO+5) = 1
C 
C  CREATE ".GRAPH" ELEMENT FOR THIS VARIABLE
C 
              ID = 45 + I 
              CALL FIND(DFLOAT(JELCNT(ID)),ID,LOCG,1) 
              NODPLC(LOCG+2) = I
              NODPLC(LOCG+3) = 1
              NODPLC(LOCG+4) = LOCO 
              NODPLC(LOCG+5) = 1
              LOCS = NODPLC(LOCS) 
  120     CONTINUE
C 
C  DC AND TRAN: FINISHED
C 
          GO TO 1000
$PAGE 
C 
C  NOISE: BUILD OUTPUT VARIABLES FOR ONOISE AND INOISE
C 
  400     ID = 44 
          CALL FIND(DFLOAT(JELCNT(ID)),ID,LOCN1,1)
          NODPLC(LOCN1+5) = 2 
          CALL FIND(DFLOAT(JELCNT(ID)),ID,LOCN2,1)
          NODPLC(LOCN2+5) = 3 
C 
C  CREATE ".GRAPH" ELEMENT FOR THESE VARIABLES (DB AND PH)
C 
          ID = 49 
          CALL FIND(DFLOAT(JELCNT(ID)),ID,LOCG,1) 
          NODPLC(LOCG+2)  = 4 
          NODPLC(LOCG+3)  = 4 
          NODPLC(LOCG+4)  = LOCN1 
          NODPLC(LOCG+5)  = 5 
          NODPLC(LOCG+6)  = LOCN1 
          NODPLC(LOCG+7)  = 6 
          NODPLC(LOCG+8)  = LOCN2 
          NODPLC(LOCG+9)  = 5 
          NODPLC(LOCG+10) = LOCN2 
          NODPLC(LOCG+11) = 6 
C 
C  NOISE: FINISHED
C 
          GO TO 1000
$PAGE 
C 
C  DISTO: CREATE OUTPUT VARIABLES FOR HD2, HD3, DIM2, SIM2, AND DIM3
C 
  500     ID = 45 
          CALL FIND(DFLOAT(JELCNT(ID)),ID,LOCD1,1)
          NODPLC(LOCD1+5) = 4 
          CALL FIND(DFLOAT(JELCNT(ID)),ID,LOCD2,1)
          NODPLC(LOCD2+5) = 5 
          CALL FIND(DFLOAT(JELCNT(ID)),ID,LOCD3,1)
          NODPLC(LOCD3+5) = 6 
          CALL FIND(DFLOAT(JELCNT(ID)),ID,LOCD4,1)
          NODPLC(LOCD4+5) = 7 
          CALL FIND(DFLOAT(JELCNT(ID)),ID,LOCD5,1)
          NODPLC(LOCD5+5) = 8 
C 
C  CREATE ".GRAPH" ELEMENT FOR PHASE VARIABLES
C 
          ID = 50 
          CALL FIND(DFLOAT(JELCNT(ID)),ID,LOCG,1) 
          NODPLC(LOCG+2)  = 5 
          NODPLC(LOCG+3)  = 5 
          NODPLC(LOCG+4)  = LOCD1 
          NODPLC(LOCG+5)  = 5 
          NODPLC(LOCG+6)  = LOCD2 
          NODPLC(LOCG+7)  = 5 
          NODPLC(LOCG+8)  = LOCD3 
          NODPLC(LOCG+9)  = 5 
          NODPLC(LOCG+10) = LOCD4 
          NODPLC(LOCG+11) = 5 
          NODPLC(LOCG+12) = LOCD5 
          NODPLC(LOCG+13) = 5 
C 
C  CREATE ".GRAPH" ELEMENT FOR DB VARIABLES 
C 
          ID = 50 
          CALL FIND(DFLOAT(JELCNT(ID)),ID,LOCG,1) 
          NODPLC(LOCG+2)  = 5 
          NODPLC(LOCG+3)  = 5 
          NODPLC(LOCG+4)  = LOCD1 
          NODPLC(LOCG+5)  = 6 
          NODPLC(LOCG+6)  = LOCD2 
          NODPLC(LOCG+7)  = 6 
          NODPLC(LOCG+8)  = LOCD3 
          NODPLC(LOCG+9)  = 6 
          NODPLC(LOCG+10) = LOCD4 
          NODPLC(LOCG+11) = 6 
          NODPLC(LOCG+12) = LOCD5 
          NODPLC(LOCG+13) = 6 
C 
C  DISTO: FINISHED
C 
 1000 CONTINUE
      RETURN
      END 
$EMA /BLANK/
      SUBROUTINE GRPCRD(ICODE,IFIELD,IERR)
     + ,92091-16021 REV.5000 <890418.1141>
      IMPLICIT REAL*8 (A-H,O-Z) 
      COMMON /BLANK/ VALUE(64)
      INTEGER NODPLC(64)
      COMPLEX CVALUE(32)
      EQUIVALENCE (VALUE(1),NODPLC(1),CVALUE(1))
      DIMENSION AOPT(5) 
      DATA AOPT / 2HDC, 2HTR, 2HAC, 2HNO, 2HDI /
      DATA ABLNK, ALL / 1H , 3HALL /
C 
C     THIS ROUTINE PROCESSES STATMENTS OF THE FORM '.GRAPH XXXX ALL'
C     FOR THE RUNCON PROCESSOR OF THE READIN OVERLAY.  IF NOT OF THIS 
C     FORM, THE ERROR FLAG WILL BE SET AND THE STATEMENT WILL BE
C     PROCESSED BY THE '.PLOT' PROCESSOR IN RUNCON.  NOTE THAT THE
C     DATA STRUCTURE OF THE '.GRAPH' ELEMENT IS IDENTICAL TO THAT OF
C     THE '.PLOT' STATEMENT.  A VARIABLE SPECIFICATION OF 'ALL' WILL
C     CAUSE AN ENTRY IN THE DATA STRUCTURE WHICH WILL BE FLAGGED BY 
C     A VARIABLE COUNT OF -1.  THIS FLAG WILL BE PICKED UP BY THE 
C     "GRPALL" ROUTINE IN THE ERRCHK OVERLAY, CAUSING THE EXPANSION 
C     OF THE GRAPH ELEMENT TO INCLUDE ALL USER NODES. 
C 
C     INITIALIZE ERROR FLAG TO TRUE 
C 
      IERR = 1
C 
C     TEST FOR ILLEGAL 2ND TOKEN
C 
      IF (NODPLC(ICODE+2).NE.1) RETURN
C 
C     DETERMINE ANALYSIS TYPE 
C 
      ANAM = VALUE(IFIELD+2)
      CALL MOVE(ANAM,3,ABLNK,1,6) 
      KTYPE = 0 
      DO 10 I=1,5 
          IF (IXXOR(ANAM,AOPT(I)).EQ.0) KTYPE = I 
   10 CONTINUE
C 
C     CHECK FOR UNKNOWN ANALYSIS TYPE 
C 
      IF (KTYPE.EQ.0) RETURN
$PAGE 
C 
C     CHECK FOR ILLEGAL 3RD TOKEN 
C 
      IF (NODPLC(ICODE+3).NE.1) RETURN
C 
C     CHECK FOR 'ALL' SPECIFICATION 
C 
      ANAM = VALUE(IFIELD+3)
      CALL MOVE(ANAM,4,ABLNK,1,5) 
      IF (IXXOR(ANAM,ALL).NE.0) RETURN
C 
C     ALLOCATE A "GRAPH" LINK-LIST ELEMENT
C 
      ID = 45 + KTYPE 
      CALL FIND(DFLOAT(-1),ID,LOC,0)
      NODPLC(LOC+2) = KTYPE 
C 
C     SET VARIABLE COUNT TO -1 TO INDICATE "ALL"
C 
      NODPLC(LOC+3) = -1
C 
C     CLEAR ERROR FLAG AND RETURN 
C 
      IERR = 0
      RETURN
      END 
$EMA /BLANK/
      SUBROUTINE GTMAIN(IFAMWA,MAXMEM)
     + ,92091-16021 REV.5000 <890418.1141>
      COMMON /BLANK/ NODPLC(1)
C 
C     THIS ROUTINE SUPPLIES INITIAL VALUES FOR THE MEMORY-MANAGER 
C                       ROUTINE 'SETMEM'
C 
      MAXMEM = 400000 
      IFAMWA = LOCFF(NODPLC)
      RETURN
      END 
$ALIAS RHPAR,NOEMA
      SUBROUTINE INITIO(APROG)
     + ,92091-16021 REV.5000 <890418.1141>
      IMPLICIT REAL*8 (A-H,O-Z) 
C     DIMENSION APROG(3),HPSPIC(3),IFILE1(5),IFILE2(5),IFILE3(5)
      DIMENSION APROG(3),HPSPIC(3)
      CHARACTER*64 FILE1,FILE2,FILE3
      DATA HPSPIC / 24H  HPSPICE  (2G.5 5000)  /
C 
C     THIS ROUTINE CHANGES THE TITLE PROGRAM NAME TO 'HPSPICE' AND
C     OPENS THE CIRCUIT (5), LISTING (6), AND BINARY (7) FILES. 
C     THE BINARY FILE IS THEN INITIALIZED.
C 
      DO 10 I=1,3 
          APROG(I) = HPSPIC(I)
   10 CONTINUE
C 
C     FETCH RUN-STRING FILE NAMES 
C 
C     CALL RHPAR(1I,IFILE1,20I) 
C     CALL RHPAR(2I,IFILE2,20I) 
C     CALL RHPAR(3I,IFILE3,20I) 
      FILE1=' ' 
      CALL FPARM(FILE1) 
      IJKL=INDEX(FILE1,'.WORK') 
      IF(IJKL.EQ.0) THEN
        STOP '#.WORK !' 
      ELSE
        FILE2=FILE1(1:IJKL)//'LST'
        FILE3=FILE1(1:IJKL)//'BINS' 
      ENDIF 
  
C     WRITE(1,'(2A)') 'UNIT 5:',FILE1 
C     WRITE(1,'(2A)') 'UNIT 6:',FILE2 
C     WRITE(1,'(2A)') 'UNIT 7:',FILE3 
  
C 
C     OPEN ALL FILES
C 
      OPEN(5,FILE=FILE1,ACCESS='SEQUENTIAL')
      OPEN(6,FILE=FILE2,ACCESS='SEQUENTIAL')
      OPEN(7,FILE=FILE3,ACCESS='DIRECT',RECL=64)
C 
C     INITIALIZE BINARY FILE TO: NOGO=1, NREC=2 
C 
      WRITE (7,REC=1) 1,2 
C 
C     FINISHED
C 
      RETURN
      END 
      INTEGER FUNCTION IXXOR(A,B) 
     + ,92091-16021 REV.5000 <890418.1141>
      INTEGER*4 A(2),B(2) 
C 
C     THIS ROUTINE COMPUTES A DOUBLE-PRECISION INTEGER RESULT WHICH IS
C THE RESULT OF EXCLUSIVE-OR*ING THE TWO REAL-VALUED ARGUMENTS A AND B
C TOGETHER. 
C 
      IXXOR = 0 
      DO 10 I=1,2 
         IF (A(I).NE.B(I)) IXXOR = 1
   10 CONTINUE
      RETURN
      END 
$ALIAS LINK1='MOSFET_LINK'
$ALIAS LOAD1='DCTRAN_LOAD'
      SUBROUTINE LINK1
     + ,92091-16021 REV.5000 <890418.1141>
C 
C     THIS ROUTINE IS THE OFF-PATH LINK FOR ROUTINE 'MOSFET'
C 
      CALL MOSFET 
      CALL LOAD1
      RETURN
      END 
$ALIAS LOAD1='DCTRAN_LOAD'
      SUBROUTINE LOAD1
     + ,92091-16021 REV.5000 <890418.1141>
C 
C     THIS ROUTINE IS USED TO RESTORE THE PATH TO OVERLAY 'DCTRAN'
C 
      RETURN
      END 
C$ALIAS GTSCB,NOEMA 
C      SUBROUTINE SECOND(T1)
C     + ,92091-16021 REV.5000 <890418.1141> 
C      IMPLICIT REAL*8 (A-H,O-Z)
C      INTEGER*2 SCB(9),IERR
C      INTEGER*4 TIME 
C      EQUIVALENCE (TIME,SCB(8))
CC
C      CALL GTSCB(SCB,9I,IERR)     !??????????????????????????????????
C      T1 = TIME/100D0
C      RETURN 
C      END
$ALIAS ElapsedTime,NOEMA
      SUBROUTINE SECOND(T1) 
     + ,92091-16021 REV.5000 <890418.1141>
      IMPLICIT REAL*8 (A-H,O-Z)   !   modif RM 28/04/87 
      INTEGER*4 ElapsedTime 
C 
      T1=ElapsedTime()/1.D3 
      RETURN
      END 
$EMA /BLANK/
      SUBROUTINE SETGRP(LOC,JTAB,JTYPE) 
     + ,92091-16021 REV.5000 <890418.1141>
      IMPLICIT REAL*8 (A-H,O-Z) 
C 
C     THIS ROUTINE OUTPUTS THE HEADER RECORDS FOR THE BINARY OUTPUT FILE
C 
      COMMON /TABINF/ IELMNT,ISBCKT,NSBCKT,IUNSAT,NUNSAT,ITEMPS,NUMTEM, 
     1   ISENS,NSENS,IFOUR,NFOUR,IFIELD,ICODE,IDELIM,ICOLUM,INSIZE, 
     2   JUNODE,LSBKPT,NUMBKP,IORDER,JMNODE,IUR,IUC,ILC,ILR,NUMOFF,ISR, 
     3   NMOFFC,ISEQ,ISEQ1,NEQN,NODEVS,NDIAG,ISWAP,IEQUA,MACINS,LVNIM1, 
     4   LX0,LVN,LYNL,LYU,LYL,LX1,LX2,LX3,LX4,LX5,LX6,LX7,LD0,LD1,LTD,
     5   IMYNL,IMVN,LCVN,NSNOD,NSMAT,NSVAL,ICNOD,ICMAT,ICVAL, 
     6   LOUTPT,LPOL,LZER,IRSWPF,IRSWPR,ICSWPF,ICSWPR,IRPT,JCPT,
     7   IROWNO,JCOLNO,NTTBR,NTTAR,LVNTMP 
      COMMON /STATUS/ OMEGA,TIME,DELTA,DELOLD(7),AG(7),VT,XNI,EGFET,
     1   XMU,MODE,MODEDC,ICALC,INITF,METHOD,IORD,MAXORD,NONCON,ITERNO,
     2   ITEMNO,NOSOLV,MODAC,IPIV,IVMFLG,IPOSTP,ISCRCH,IOFILE 
      COMMON /MISCEL/ ATIME,APROG(3),ADATE,ATITLE(10),DEFL,DEFW,DEFAD,
     1  DEFAS,RSTATS(50),IWIDTH,LWIDTH,NOPAGE 
      COMMON /DC/ TCSTAR(2),TCSTOP(2),TCINCR(2),ICVFLG,ITCELM(2),KSSOP, 
     1   KINEL,KIDIN,KOVAR,KIDOUT 
      COMMON /AC/ FSTART,FSTOP,FINCR,SKW2,REFPRL,SPW2,JACFLG,IDFREQ,
     1   INOISE,NOSPRT,NOSOUT,NOSIN,IDIST,IDPRT 
      COMMON /TRAN/ TSTEP,TSTOP,TSTART,DELMAX,TDMAX,FORFRE,JTRFLG 
      COMMON /OUTINF/ XINCR,STRING(15),XSTART,YVAR(8),ITAB(8),ITYPE(8), 
     1   ILOGY(8),NPOINT,NUMOUT,KNTR,NUMDGT 
      COMMON /BLANK/ VALUE(64)
      INTEGER NODPLC(64)
      COMPLEX CVALUE(32)
      EQUIVALENCE (VALUE(1),NODPLC(1),CVALUE(1))
      DATA ABLNK, ATIMEX, AFREQ / 1H , 4HTIME, 4HFREQ / 
$PAGE 
C 
C  SET LIMITS DEPENDING UPON THE ANALYSIS MODE
C 
      IF (MODE-2) 10,20,30
   10 XSTART = TCSTAR(1)
      XSTOP  = TCSTOP(1)
      XINCR  = TCINCR(1)
      NPOINT = ICVFLG 
      ITEMP  = ITCELM(1)
      LOCE   = NODPLC(ITEMP+1)
      ASWEEP = VALUE(LOCE)
C 
C     CALCULATE SECOND-SOURCE VARIABLE IF SPECIFIED 
C 
      ITEMP  = ITCELM(2)
      IF (ITEMP.NE.0) THEN
          LOCE   = NODPLC(ITEMP+1)
          BSWEEP = VALUE(LOCE)
      ELSE
          BSWEEP = ABLNK
      ENDIF 
      GO TO 40
C 
   20 XSTART = TSTART 
      XSTOP  = TSTOP
      XINCR  = TSTEP
      NPOINT = JTRFLG 
      ASWEEP = ATIMEX 
      BSWEEP = ABLNK
C 
C     TRIM NPOINT IF LAST POINT IS OUT-OF-BOUNDS
C 
      XLAST  = XSTART + XINCR * (NPOINT-1)
      IF (XLAST.GT.XSTOP) NPOINT = NPOINT - 1 
      GO TO 40
C 
   30 XSTART = FSTART 
      XSTOP  = FSTOP
      XINCR  = FINCR
      NPOINT = ICALC
      ASWEEP = AFREQ
      BSWEEP = ABLNK
$PAGE 
C 
C     SET NREC = CURRENT FILE RECORD
C 
   40 READ(7,REC=1) IFLAG,NREC
C 
C     POSITION FILE AT NREC+1 
C 
      READ(7,REC=NREC)
C 
C     WRITE THE OUTPUT VARIABLE RECORDS TO THE BINARY FILE
C 
      LOCT = LOC
      N    = 0
   60 IF (LOCT.EQ.0) GO TO 100
      IPNTR = LOCT+4
      KNTR  = NODPLC(LOCT+3)
      IF (KNTR.LT.1) GO TO 80 
      DO 70 I=1,KNTR
          N = N+1 
          CALL EXTMEM(JTAB,1) 
          CALL EXTMEM(JTYPE,1)
          NODPLC(JTAB+N)  = NODPLC(IPNTR) 
          NODPLC(JTYPE+N) = NODPLC(IPNTR+1) 
          IPOS = 1
          STRING(1) = ABLNK 
          STRING(2) = ABLNK 
          CALL OUTNAM(NODPLC(JTAB+N),NODPLC(JTYPE+N),STRING,IPOS) 
          WRITE(7) STRING(1),STRING(2)
          IPNTR = IPNTR + 2 
   70 CONTINUE
   80 LOCT = NODPLC(LOCT) 
      GO TO 60
C 
C     IF NO GRAPH OUTPUTS SPECIFIED, ALL DONE 
C 
  100 KNTR = N
      IF (KNTR.EQ.0) RETURN 
$PAGE 
C 
C     DETERMINE ANALYSIS TYPE FROM WORD 2 
C          OF .GRAPH DATA STRUCTURE 
C 
      IANAL = NODPLC(LOC+2) 
C 
C     GET TEMPERATURE FROM ITEMPS TABLE 
C 
      TEMPR = VALUE(ITEMPS+ITEMNO)
C 
C     WRITE HEADER RECORD 
C 
      WRITE(7,REC=NREC) IANAL,IDFREQ,KNTR,NPOINT,ASWEEP,
     +                  XINCR,XSTART,XSTOP,BSWEEP,TEMPR 
C 
C     POSITION FILE POINTER FOR SUCCEEDING DATA RECORDS 
C 
      READ(7,REC=NREC+KNTR) 
C 
      RETURN
      END 
      SUBROUTINE STOPIO(NOGO,ATIME,ADATE) 
     + ,92091-16021 REV.5000 <890418.1141>
      IMPLICIT REAL*8 (A-H,O-Z) 
      DATA ISMREV / 5000 /
C 
C     THIS ROUTINE UPDATES THE MASTER HEADER IN THE BINARY FILE 
C     AND CLOSES ALL SIMSP FILES. 
C 
      READ (7,REC=1) IDUMMY,NREC
      WRITE(7,REC=1) NOGO,NREC,ATIME,ADATE,ISMREV 
C 
      CLOSE(5,STATUS='KEEP')
      CLOSE(6,STATUS='KEEP')
      CLOSE(7,STATUS='KEEP')
C 
      RETURN
      END 
