Trailing-Edge
-
PDP-10 Archives
-
decus_20tap5_198111
-
decus/20-0150/taus.mac
There is 1 other file named taus.mac in the archive. Click here to see a list.
00100 COMMENT * SIMULA SPECIFICATION;
00200 OPTIONS(/E:FORTRAN,TAUS);
00300 PROCEDURE TAUS(A,R); NAME R; INTEGER ARRAY A; REAL R;
00400 !
00500 USER DOCUMENTATION
00600 ------------------
00700 TAUS IS A SIMULA AND FORTRAN CALLABLE PROCEDURE. IN FORTRAN
00800 IT IS A SUBROUTINE TAUS(A,R) WITH INTEGER A(7) AND INTEGER R.
00900
01000 TAUS GENERATES A NEW WORD OF 36 BITS IN THE TAUSWORTHE
01100 PSEUDO NOISE SEQUENCE: A(P) = A(0) + A(Q1) + ... + A(Qn),MOD 2.
01200 IT PUSHES THE NEW WORD ONTO THE STACK A, DISCARDING WORD 0.
01300 IT CONVERTS THE NEW WORD TO A FLOATING POINT REAL IN THE
01400 OPEN RANGE (-1,+1) AND RETURNS IT VIA PARAMETER R.
01500
01600 USER WILL SET UP A SEED OF 7 WORDS IN A, MORE OR LESS RANDOM.
01700 THE LAST P BITS WILL BE USED IN EACH RECURRENCE. (P =241 FOR
01800 THIS VERSION). THE NEW RANDOM 36 BITS ARE STORED IN A(7).
01900 SEVEN CALLS TO THE PROCEDURE WILL GENERATE A COMPLETELY NEW ARRAY.
02000 THE ARRAY SHOULD NOT SUBSEQUENTLY BE ALTERED UNLESS USER WISHES
02100 TO RESTART AT A NEW POINT IN THE TAUSWORTHE SEQUENCE.
02200 THE SEQUENCE HAS PERIOD 2^241-1 . 241 ADJACENT BITS ARE
02300 LINEARLY INDEPENDENT.
02400
02500 THIS PROCEDURE IS BASED ON THE PRIMITIVE POLYNOMIAL 1+X^19+X^73
02600 X^107+X^139+X^193+X^241 WHICH HAS THE FULL PERIOD FOR ANY
02700 DECIMATION OTHER THAN 22000409 . THE MACRO CODE IS DEC 10/20.
02800 THE ALGORITHM IS BASED ON A 36 BIT WORD: FOR A DIFFERENT
02900 WORD LENGTH RECALCULATE WA, BA & WN.
03000 TO USE WITH FORTRAN COMPILE WITH MACRO. FOR SIMULA COMPILE
03100 ALSO WITH SIMULA TO MAKE AN ATR FILE.
03200
03300 !*;! BEGIN MACRO CODE !*;!
03400
03500 TITLE TAUS
03600 ENTRY TAUS
03700 ;!GEN REG ASSIGNMENT:
03800 PP=16 ;! PARAMETER POINTER FOR PROC CALL
03900 PA=15 ;! POINTER TO WORD 0 OF SEQUENCE
04000 K=14 ;! INDEX AND LOOP COUNTER
04100 SR=12 ;! REG 12+13 IS A LONG SHIFT REGISTER
04200 NEW=11 ;! NEW WORD ACCUMULATOR
04300 IND=10 ;! ARRAY INDEX
04400 PA1=7 ;! PTR FOR PUSHING A
04500 TMP=6
04600 ;!CONSTANTS:
04700
04800 WORDLEN=36 ;!DECsystem-20 WORDLENGTH.
04900 NQ=6 ;! NUMBER TERMS IN RECURRENCE
05000 WN=7 ;! NUMBER OF WORDS IN SEED.
05100 ;! P BIT SEQ. STARTS AT BIT 11 OF WORD 0.
05200 WA: DEC 0,1,3,4,4,6 ;! WORD ADDRESSES
05300 BA: DEC 11,23,5,1,35,17 ;! AND BIT ADDRESSES OF
05400 ;! THE Qs, PLUS P MOD WORDLEN.
05500
05600 TAUS: MOVEI PA,@(PP) ;! FETCH REF A
05700 IOR PA,[(IND)] ;! TO INDEX A BY IND
05800
05900 SETZB NEW,K ;! NEW:=0, FOR K:=0 TO NQ-2 DO
06000 RECUR: MOVE IND, WA(K) ;! WORD ADDRESS TO A INDEX
06100 DMOVE SR, @PA ;! A[WA[K]] TO SHIFT REG.
06200 LSHC SR,@BA(K) ;! SHFTED SEQUENCE X^Qk*A
06300 XOR NEW, SR ;! ADD, MODULO 2
06400 AOS K ;! STEP 1
06500 CAIE K, NQ-1 ;! UNTIL NQ-2
06600 JRST RECUR ;! END RECUR LOOP
06700 LAST: MOVE IND, WA(K) ;! LAST TERM SPECIAL CASE
06800 MOVE SR,@PA ;!
06900 LSH SR,@BA(K) ;! X^Qn*A, ZEROS BEYOND END
07000 XORB NEW,SR
07100 LSH SR,^D-19 ;! FEEDBACK Qn NEW BITS TO NEW WORD
07200 XOR NEW,SR
07300 HRLI PA, K ;! TO INDEX A BY K
07400 MOVE PA1,PA ;! AND PA1
07500 SOS PA1 ;! PNTR TO (PA)-1
07600 MOVEI K,1 ;! FOR K:=1 STEP 2 UNTIL WN DO
07700 PUSH: DMOVE SR,@PA ;! PUSH TWO WORDS AT A TIME
07800 DMOVEM SR,@PA1
07900 ADDI K,2 ;! INDEX PLUS 2
08000 CAIGE K, WN ;! SKIP IF FINISHED
08100 JRST PUSH ;! REPEAT
08200 MOVEI K,WN-1 ;! PLACE NEW WORD ON TOP OF STACK
08300 MOVEM NEW, @PA
08400 FLTR NEW,NEW ;! FLOAT THE INTEGER USING BITS
08500 ;! 0 THRU 27 AND ROUNDING. B0 IS SIGN
08600 FSC NEW, -43 ;! SCALE BY 2^-35
08700 MOVEM NEW, @1(PP);! RETURN VALUE TO R
08800 POPJ 17,0 ;! RETURN
08900 END;
09000
09100
09200