Digital PDFs
Documents
Guest
Register
Log In
DIGITAL-7-30-A
December 1965
17 pages
Original
0.6MB
view
download
Document:
FltPtPkg
Order Number:
DIGITAL-7-30-A
Revision:
Pages:
17
Original Filename:
http://bitsavers.org/pdf/dec/pdp7/DIGITAL-7-30-A_FltPtPkg.pdf
OCR Text
PDP-7 PROGRAM LIBRARY NUMBER: Digital 7-30-A NPu1lJ!E: Floating Point package AUTHOR: D. Fellows DATE: Revised ABSTRACT: A self-contained Scientific programming Syst·em DEC December 22, 1965 for the PDP-7 with Data and Results to 6 decimal digit accuracy, optionally 9 decimal digit accuracy. Instruction execution is interpretive. Arithmetic is double precision normalized floating pOint. CONTENTS: 1.0 ·General Description of the System 2.0 Command List 3.0 . Subroutine Library 4.0 Operational Description 5.0 Illustrative program PDP 7 LIBRARY Digital-7-30-A page 2 1.0 GENERAL DESCRIPTION OF THE SYSTEM 1.1 The Interpreter The heart of ~, the interpretive instruction processor uses double precision floating point binary arithmetic; data may be carried in one of two ways: - a) Sign plus packed 8 bit exponent plus 27-bit magnitude, requiring two storage words. b) Signed exponent and signed 35-bit magnitude, requiring three words of storage. The decimal precision possible with (a) is approximately 6 digits, with (b) 9 digits. The interpreter is entered by the pseudo-instruction ElM (enter interpretive mode) which initializes the interpretive program counter. Instructions are executed sequen- tially until a transfer of program control or the pseudo-instruction LIM (leave interpretive mode) is encountered. (LIM initiates a return to the machine language program.) The floating accumulator is never implicitly saved and in particular is not preserved when r/o instructions areexecuted. All interpretive instructions except those which select data mode and the three indexing instructions, may be executed with one level of indirect addressing. PDP 7 LI BRARY Digital-7-30-A Page 3 1.2 Input/output All entry of data is through a one-character-per-word buffer. Either teletype or paper tape may be used. Allow- able input is limited to numeric characters but alphanumeric output is permitted. (see the HDG instruction.) 1.3 Iterative Operation A primitive one level form of iterative operation is possible in the interpretive mode (see SIX, EXI). Any se- quence of commands may be executed, iteratively, up to N times (N ~ 81 91). An address modification instruction (ADM) is also provided which, when executed, increments the effective address of the instruction which precedes it in sequence by 2 or 3, depending on the current data mode (see DMD). The program must be re-initialized for a second run, since the instructions themselves are changed (ADM). PDP 7 LIBRARY Digital-7-30-A page 4 2.0 INTERPRETIVE COMMAND LIST 2.1 Mnemonics DAC: Deposit Floating Accumulator p. 6 JMS: Subroutine JMP, Floating p. 5 INP: Initiate Input p. 9 LAC: Load Floating Accumulator p. 6 FCS: Load Floating Accumulator with the Complement p. 6 ADD: Add to the Floating Accumulator FSB: Subtract from the Floating Accumulator FMP: Multiply by the Floating Accumulator FDV: Divide into the Floating Accumulator HDG: Text Output p. 9 CAS: Compare with Floating Accumulator p. 5 JMP: Change Interpretive program Counter p. 5 OUT: Initiate Output p. 9 NUM: Indicates a Numeric Argument p. 8 laD: I/O Device Indicator p. 7 DMD2: Select two Word Data Mode p. 5 DMD3: Select three Word Data Mode p. 5 SIX: start Iteration p. 8 EXI: End Iteration p. 8 ADM: Modify Preceding Address p. 8 PDP 7 LIBRARY Digltal-7-30-A page 5 2.2 Control Transfer Instructions Floating JMS,JMP These instructions are logically the same as the machine language JMS, 3MP. ComEare Accumulator to storage: CAS The CA~ instruction requires an operand address, say A. The logical transfer of control is to PC+1, PC+2, pc+3: where PC is the location of the ~ instruction and the condition of transfer is that the signum of the quantity (C(FLOACC) - C(A)) be -1,0, +1 respectively. allowable. One level of indirect addressing is For example, if the contents of the effective oper- and address were zero, then the following program: CAS A JMP B (A > AC) 3MP C (A= AC) JMP D (A < AC) would execute "JMP B" when the floating accumulator is less than zero: "JMP CIf when C(FLOACC) equals zero: II JMP D" when C(FLOACC) is greater than zero. 2.3 Internal Data Mode Instructions DMD2, DMD3 set the mode for the interpreter with respect to data handling. The appropriate on) should be used before any data is referenced. No operand is used. PDP 7 LIBRARY Digital-7-30-A page 6 Internal Data Mode Instructions cont1d DMD2 designates two word operands. Considering the extended word as bits 0-35, the operand is packed: bit 0 = sign bits 1-8 = two's exponent + 128 bits9-35 = binary fraction (magnitude) Approximate range of data, 10±38. Precision 6 deci- mal digits. DMD3 designates three word operands. Considering the extended word as bits 0-53: bits 0-17 = signed two's exponent bit 18 = sign bits 19-53 = magnitude of binary fraction. Usable range of data, 10±99. Precision 9 decimal digits. 2.4 Data Move Instructions LAC, ~ will load or store respectively in accordance with the current value set by the data mode instruction. FCS loads the floating accumulator with the comple- ment of the effective operand. 2.5 Floating Point Arithmetic Add, subtract, Multiply, Divide are provided. Exponentiation is provided as a library subroutine. PDP 7 LIBRARY 1 Digital-7-30-A page 7 Internal Arithmetic The floating accumulator is a four register accumulator, one register for the sign of the magnitude, one register for the signed exponent in two's complement form and two registers for the positive 35 bit magnitude held as a binary normalized fraction. The floating point accumulator is the same for both two and three word data. The result of an arithmetic operation is normalized and unrounded. The uninitiated should consult the literature for an indication of the inherent pitfalls of this approach to floating point arithmetic. One excellent reference is "Numerical Methods for Scientists and Engineers" by R. W. Hamming; published by McGraw-Hill, 1962. 2.6 Red Tape Instructions rOD indicates the I/O device referred to by an accompanying input or output control instruction. It is not in- terpreted by the interpreter but by the logical section of the I/O subprogram. Presently assigned device numbers are: 1 teletype (keyboard or teleprinter) 2 paper tape (reader or punch) Numbers 3 thru 7 have not been assigned. Reference to an unassigned device will cause 765050 to appear in the AC lights and an irrecoverable halt to occur in the program. number+l00 S ) may be used to control format. IOD+device The occurence of the added (octal) hundred implies that input (or output) consists of (modulo) four-word strings. Note that indirect addressing is not allowed with the IOD instruction. PDP 7 II BRARY Digltal-7-30-A page 8 Floating Point Arithmetic cont'd NUM (numeric valuel This pseudo-instruction is used with the I/O commands and the iterative execution command §!!. When used with INP/OUT it indicates the number of values expected; with SIX, it indicates the number of times the following sequence of instructions is to be executed. Indirect addres- sing is allowable in the first use but not in the second. ADM (address modification) This instruction is used to modify, using a positive increment, the instruction which precedes it in sequence. In the two-word, (three word) data mode the increment is 2, (3). The effective operand address (of the modified instruction) is the address modified. 2.7 Iterative Execution Instructions These instructions take no operand. SIX initiates an iterative operation. It is always followed by a ~ command in the immediate address mode whose argument is the number of passes desired. The next sequential address (i.e., the contents of the floating mode program. counter) is saved for use by the ~ instruction. Only one level of iteration is allowed. EXI reduces by one the counter (number of passes) set by SIX and when it reaches zero falls through to the next instruction in sequence. If the counter is not zero, the program counter is reset and control is transferred to that location (note that all interpretive instructions, including this one, operate in floating mode only). Multiple exits are allowable, that is an iteration initiated by a uc command may have several exit paths. PDP 7 LI BRARY Digital-7-30-A page 9 2.8 I/O Instructions: !!ill! (heading) is meaningful on output only and is used to initiate output of prestored text. (see for reference the assembler document with particular reference to the pseudoinstruction ~.) Formats are predetermined by the particular I/O device selected. The effective address is the loca- tion of the first word of the desired output. sequence is: The program HDG (I) A laD N INP/QUT are used to initiate data transfers only. characters are (for teletype and paper tape) The legal SPACE DASH PERIOD DECIMAL DIGIT /~lus, the +sign .is not legal lor minus sign /decimal point NULL/IDLE' LINE FEED CR /ignored /ignored litem delimiters litem delimiters TAB /0-9 If an illegal character is used "X" is typed and the buffer is cleared. The entire input item must be retyped to enter the num- ber correctly. Input format is flexible, output format rigid. The normal form for both input and output is: ± .DD ••• D ± EE where the DiS are the decimal digits of a (decimally normalized) fraction and the E's represent a two digit decimal exponent. Any meaningful variation of the normal form is valid on input. If the decimal point is omitted, the input value is assumed to be integral; if the sign is omitted, it is assumed to be positive; if the (decimal) exponent is omitted, it is assumed to be zero. (e.g. 767.12-1 ~ 76.712; 76712 ~ 76712 etc). If more than ten digits are input, the PDP 7 LIBRARY Digital-7-30-A page 10 resulting value will not be true. In the two-word mode, a converted 35 bit value is truncated to 27 bits on input, rounded to six digits on output. The effective address is the first pick-up or store address and indexing is in 2 or 3 (storage) word increments in accordance with the current data mode. 3.0 SUBROUTINE LIBRARY subroutines are entered in floating mode with the floating ~ and the argument in the accumulator. They exit in floating mode with the result left in the accumulator. The following functions are an integral part of the ~ package. The non-appearance of a version accurate to only 6 decimal digits indicates that there was no essential temporal or spatial advantage in providing a routine other than that accurate to 9 decimal digits. All of the functions except Q!E (q.v.) require the following program sequence: /argument to floating /accumulator /enter with floating jms LAC (I) A JMS BBB /return to program se/quence XX 3.1 Trigonometric FUnctions. 9 decimal digit accuracy with 6 decimal digits optionally available. Sine/cosine (routine has optional entry, common exit). Expected argument is in radians. The quoted accuracy falls off markedly when the argument is (in absolute value) greater than 21r. Arctangent Call SIN uc (cos). 9 decimal digits with 6 digits optionally PDP available. Result is ± radians. Call ATN. 7 LIBRARY Digital-7-30-A page 11 3.2 Natural Logarithm The routine finds the logarithm to the base e of the absolute value of the argument. Accuracy is 9 decimal digits. To find the logarithm to a different base, multiply the natural log by the log of e to the new base. Call LOG 3.3 Exponential Functions Normal Exponential Functio~ Result is e raised to the argument as a power. 9 de- cimal digit accuracy with 6 decimal digits optionally available. Call EXP. General Exponentiation A compound function of ~ and LOG and hence relatively slow. Accuracy depends on the version of ~ in use. To calculate AtB call: LAC (I) A JMS GXP LAC B /direct addressing expected 3.4 Square Root 9 decimal digit accuracy if the value for which the root was taken was exact. (e.g. 2). In general, the preci- sion of the result will be (necessarily) only one-half the precision of the argument. Call SQR. PDP 7 LIBRARY Digital-7-30-A page 12 4.0 OPERATIONAL DESCRIPTION OF THE SYSTEM 4.1 Input/Output calling sequence /(out(i)a) INP (I) A IOD X ~M Y /(num i b, c(b)=y) lA' (or its contents) is the initial data address. IX' is the device number (1 or 2). items to be processed. 'Y' is the number of If 100 (octal) has been used (101 or 102) with IOD, the data will occur four words per line. (the last line need not.) Each data item must be termina- ted by a tab or (line feed) carriage return. 4.2 Symbolic Tapes 1) A definitions tape, defining for the assembler the special symbols of the system. 2) The ~ system itself in four parts. There are two versions of part IV, one for normal arithmetic, the other for use with machines having an extended arithmetic element. 3) TWo library subroutine tapes with 6 and 9 digit accuracies. 4) A 'PUNDEFI request tape. PDP 7 LIBRARY Digital-7-30-A page 13 4.3 Binary Tapes No address assignment exists on the symbolic tapes. The library version was assembled at 12000 (octal) for use in 8K machines. The system itself (with library) occupies approximately 3000 (decimal) core locations. is supplied. A PUNDEF tape Before assembling a program using disc, load this tape through address 4 immediately after the assembler is loaded. 4.4 Assembling from the symbolic tapes 1) Supply a title tape with the desired address assignment. In lieu of thiS, the system will be assembled at core locations 22 and ff. 2) Assemble together (and in order) a b c d e the title tape the definitions tape disc parts I, II, III ~desired part IV the desired library 3) After punching the binary tape, get a symbol print if you wish. 4) without restoring the assembler (start at 20) assemble the PUNDEF request tape. 4.5 Assembling a Program to be used with Disc Load'the PUNDEF tape binary before assembling, i.e." START 17770 to load assembler, START 4 to load PUNDEF tape then assemble in the normal way. To use, load the using program and the binary Disc and start at the using programs beginning location. are making use of the automatic start binary Disc first. If you through the loader, load the I~7DP ~ I D1g1tal-7-30-A page 14 5.0 ILLUSTRATIVE PROGRAM DISC TEST IPROBLEM TO CALCULATE THETA:EXP(-X) AND SIN (THETA) IFOR X=A(B)C WHERE A IS STARTING VALUE, B IS INCREMENT lAND C IS FI NAL VALUE BAR 2 IENTER INTERPRETIVE MODE BEGIN, ElM IDATA MODE TO 2 WORD DMD2 IINITIAL STORE ADDRESS INP ALPHAIX IFROM TELETYPE IOD 1 13 ITEMS NUM 3 IPRECEDING INSTRUCTIONS READ IN A, S, C, TO ALPHAX, +1, +2 JMS INITAL GAMMA, LAC ALPHAX /SET STARTING VALUE DAC STARTIX I-X FCS STARTX DAC MINUSIX JMS EXP DAC EXPIONX JMS SIN DAC SINIEX JMS STOREX LIM ISZ COUNT ElM LAC STARTX CAS GAMMAX JMP ALPHA JMP BETA JMP BETA ALPHA, LAC ALPHAX ADD BETAX DAC ALPHAX JMP GAMMA BETA, DELTA, HDG MESS IOD 1 LIM LAC COUNT RTL ADD (NUr., DAe DELTA ElM OUT DATA IOD 101 XX JMP BEGIN PDP 7 LIBRARY Dig1tal-7-30-A page 15 INITAL, STOREX, 0 LIM LAC (DAC DATA DAC MODEX DZM COUNT ElM JMP I INITAL a LIM LAC (LAC STARTX DAC INITEX ElM SIX NUM 4 INITEX, XX ADM MODEX, XX ADM ALPHAX, BETAX, GAMMAX, STARTX, MINUSX, EXPONX, EXI JMP I STOREX 0 "" "0 "" " ftJ 0 g " " 15 CHARS /OUTPUT FORMAT MESS, TEXT/ SINEX, fa X -x / EXP(-X) SINE DATA, DATA+1750/ START BEGIN PDP 7 LIBRARY D1g1tal-7-30-A page 16 LINE 5: Bar 2 tells the assembler to assign 2 words to multi- word variables (~). ( Later the program overrides the variable assignment by providing explicit storage, (because the programmer decided to order his variable storage in a definite way). LINE 11: comment '+1, +2', refers to variable storage, not core locations. LINE 12: This program stores four values for each value of 'x' and then transfers the four values to array 'datal. Subroutine 'inital' zeros the item count (for the output routine) and initializes the data storage address. Note the shift from interpretive to machine language and back again. LINE 13: 'gamma' calculates and/or stores x, -x, exp (-x), sin(exp(-x»). LINE 21: 'storex' initializes the pick-up address, which has been ~odified by 'ADM' then transfers the current tabular values to the array 'data'. LINE 30: 'alpha' increments x and continues. LINE 34: 'beta' initiates printout on the teletype. The item count is multiplied by four and set with 'NUM' in the I/O sequence (delta). printout will be four items per line (IOD 101). PDP 7 LIBRARY Dig1tal-7-30-A page 17 The material reproduced below is one run through the program with a=¢, b=1, c=5. Note that the programmer misjudged slightly when he prepared his text message. o. 1. 5. X -X EXP(-X) .000000 00 -.000000 00 .100000 01 -.100000 01 .200000 01 -.200000 01 .300000 01 -.300000 01 .400000 01 -.400000 01 .500000 01 -.500000 01 .100000 01 .367879-00 .135335-00 .497871-01 .183156-01 .673795-02 SINE .841471 00 .359638-00 .134921-00 .497667-01 .183145-01 .673791-02 PDP 7 LIBRARY
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies