UCRL-51940 FLOATING-POINT PACKAGE FOR INTEL 8008 AND 8080 MICROPROCESSORS Michael D. Maples October 24, 1975 Prepared for U.S. Energy Research& Development Administration under contract No. W-7405-Eng-48 I_AV~=IENCE I_IVEFIMORE I.ABOFIATOFIY University ol Calilomia ~ Livermore ~ NOTICE .sponsored by tht: United $~ates G~ven~menl.Neilhe~ the United States nor the United ~tates I’:n,~rgy of their employees,IIOr lilly of their eorltl’ilctclrs~ warranty~ express t~r implied, or asstltlleS ~t]y legld liability or responsihilit y fnr the accuracy, apparatus, product or ])rc)eess disclosed, represents that its rise would IIt~l illl’r liege privlttely-owned rights." Printed in the United States of America Avai.] able from National Technical. information Service U.S. Department of Commerce 5285 Port Royal Road Springfield, Virginia 22151 Price: Printed Copy $ *; Microfiche $2.25 NTIS ""Pages _Sellin_.g Price 1-50 $4.00 51-150 $5.45 151-325 $7.60 326-500 $10.60 501.-1000 $13.60 DISCI.AlMBR This documeut was prepared as an account of work sponsored by an agency of the United States Gnvernment.Neither the United States Governmentnor the University of California nor any of their employees,makes any warranty, express or implied, or assumesany legal liability or responsibility for the accuracy, complete.aess, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use wouldnot infrioge privately ownedrights. Refarenceherein to any specific commercialproduct, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation,or favoring by the United States Govermnentor the University of California. The views and opinions of attthors expressed herein do not necessarily state or reflect those of the United States Goveromentor the University of California, and shall not be used for advertising or product endorsementpurposes. This report has been reproduced directly from the best available copy. Available to DOEand DOlt contractors from the Office of Scientific aud TechnicalInformation 1’.O. I~ox 62, OakRidge, TN3783~ Prices available from (615) 576-8401,FIB 626-8401 Availableto the public from the National Technical Informalion Service U.S. Department of Commerce 5285 Port RoyalRd., Springfield, VA22161 Workperformed under fl~e auspices of the U.S. Departlnent of Energyby l.awrence LivermoreNational ! .aboratot3, under Contract W-7405-ENG-48. Distribution Category UC-32 LAWRENCE LIVERMORE LABORATORY Universityof Califomia.."Livermore,Ca/#ornia 94550 UCRL-51940 FLOATING-POINT PACKAGE FOR INTEL 8008 AND 8080 MICROPROCESSORS Michael D. Maples MS. Date: October 24, 1975 Contents Abstract Introc]uc tion ............................... 1 Selection and Use of Operations ..................... 2 Ac knowledgmen t s ............................. 7 Appendi’~. Source Listing of Float:iug-Po[nt Package .......... A-I -iii- FLOATING-I’OINT PACKAGEFOR INTEL 8008 AND 8080 MICROPROCESSORS Abstract The Lawrence Livermore the mathematical operations -- add, I,aboratory has used a scientific- subtract, multiply, divide, and notation mathematics package that square root -- range from 3 to 77 ms. performs floating-point arithmetic Instructions for using the floating- with Intel 8008 and 8080 micro- point package and a source listing processors. The execution times for of it are included. Introduction For the last two years, Lawrence microcomputers, but this need not be Livermore Laboratory has used a necessary. The appropriate ODT calls scientific-notation mathematics (6 or 7) in the I/0 routines can package (f].oating-point package) with easily be placed by assembly language the Intel 8008 and 8080 micropro- equivalents. cessors.* This package allows addition, subtraction, multiplication, Table i. Worst-case execution times division, and square root operations. for the 8080 microprocessor using a 0.5-~s clock with Table i shows the execution times the package in programmable for these operations. The program read-only memory (PROM). listing of the complete 8080 floating- point package is in the Appendix. Execution times The package uses some I/O calls from Operation (ms) an octal debug routine (ODT) that has become a standard part of all inhouse Add 3 *Reference to a company or product Subtract 3 name does not imply approval or Multiply recommendation of the product by the 7 University of California or the Divide 8 U.S. Energy Research & Development Square root Administration to the exclusion of 77 others that may be suitable. -i- The floating-point package uses experiments with accuracy require- 24 bits of mantissa for approximately ments of one part per hundred 7-1/2 digits of accuracy in thousand. expressing numeric data. Obviously, this decreases rapidly when complex The package also indicates under- iterative computations are used. flows and overflows by placing zeros Nevertheless, the package is function- in the mantissa and a I00 (octal) ing quite satisfactorily in many the exponent word. Selection and Use of Operations All registers described in this intermediate steps are to be ¢al- paper point to four-word internal culated. Then do a call to the INPUT mathematical storage areas unless routine that does the appropriate otherwise stated. Also, before per- conversion (see Table 2). forming any mathematical operation, The resulting floating-point number all needed operands must be placed in has three 8-bit words of mantissa and the same random access memory (RAM) a fourth word that contains 6 bits of along with any needed scratch areas exponent, 1 bit for mantissa sign, (i.e., all must reside in the same and 1 bit for exponent sign (see page of ILAM). Fig. i). Negative mantissa are The first problem is how to get indicated only by the sign bit as the the decimal numbers into the correct mantissa itself is in sign-magnitude format for use in the floating-point form. But the negative exponents are package. The routine INPUT performs in twos complement form. the conversion for all teletypewriter input. Also, it easily adapts to If an addition (LADD) is wanted, converting any BCD numeric inputs place the pointer to one addend in from either digital pane], meters the L-register, the pointer to the (DPM) or thumbwheel switches. To use other addend in the B-register, and a INPUT, set the L-register to point pointer in the C-register. The at the location in RAM ~ere the C-register points to a four-word result of the conversion is to be scratch area used during the addition placed and set the C-register to point process. The result is pointed to by to another location in RAM where the L-register (see Table 3). -2- Table 2. Program for using INPUT routine. The scratch area is ].7 (octal) bytes long but the converted number is only 4 bytes long. Program Comments MVI II, SCRPG ;Set H to match scratch page (RAM). MVI L, STWD ;Store floating-point number starting ;at STWD. MVI C, SCR ;Scratch area. CALL INPUT Most The subtraction (LSUB) routine STWD s~gn~ficant is very similar to the addition word routine. The L-register holds the STWD " 1 ~ pointer to the minuend and the Least B-register holds the pointer to the I’1 I i I [ J j significantsubtrahend. The C-register once again word 765432 10 is used as a four-word scratch area, STWD~31’II I I I l lJ and the result is placed in the area pointed to by the L-register, ~~Exponenl" sign~ I = negative destroying the previous data residing Mantissa sign~ 1 = negatiSe there (see Table 4). If a multiplication (LMUL) wanted, again use the L-, B-~ and C-registers. The pointer for the multiplicand resides in the L-register, Fig. i. Floating-point word format. This format all.ows repre- the pointer for the multiplier in the sentation of numbers from B-register and the pointer to the ±6.46235 * 10-27 to ±4.61168 * ].018. result in the C-register (see Table 5). -3- Table 3. Assembly language setup for addition. Program Comments ~I H, SCRPG ;Set H to scratch page (I~M). MVI L, ADDI ;Pointer four-word addend and final ;result. MVI B, ADD2 ;Pointer 2nd four-word addend. MVI C, SLR ;Four-word scratch area. Call LADD ;Turn control over to addition ;routines. Table 4. Assembly language setup for subtraction. Program Comments ~I H, SCRPG ;Set H to match scratch page (RAM). ~I L, SUB1 ;Pointer to four-word minuend and ;final result. MVI B, SUB2 ;Pointer to four-word subtrahend. MVl C, SCR ;Four-word scratch area. Call LSUB ;Turn control over to subtraction ;routines. -4- Table 5. Assembly language setup for multiplication. Program Comments :~IV~.H, SCRPG ;Scratch page pointer (RAM). MVI L, MLCAN ;Pointer to multplicant. ,~FVI B, Mlplr ;Pointer to multiplier. MVI C, Rslt ;Pointer to result. CALL LMUL ;Turn control over to multiply ;routine. Division (LDIV) like multiplica- number pointed to in the L-register tion uses the C-register to hold the to its ASCII equivalent and types it pointer to the result (quotient). out on the teletypewriter. This The L-register pointer refers to routine uses a 17 octal-word scratch dividend and the B-register pointer area pointed to by the C-register refers to the divisor (see Table 6). (see Table 8). The final data The square root routine (DSQRT) printed in scientific notation. The uses the L-register to point to the output routine like the INPUT routine number to be converted, the B-register is easily modified to output its data to point to the final converted to an internal (memory) register for number, and the C-register to point display on an LED display. to a 16 octal-word scratch area (see Table 7). Table 9 gives a simple program The final routine is the output that allows the user to check out routine (CVRT).
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages46 Page
-
File Size-