1、 The Institute of Electrical and Electronics Engineers, Inc.345 East 47th Street, New York, NY 10017-2394, USACopyright 1997 by the Institute of Electrical and Electronics Engineers, Inc.All rights reserved. Published 1997. Printed in the United States of America.ISBN 1-55937-894-8No part of this pu
2、blication may be reproduced in any form, in an electronic retrieval system or otherwise, without the prior written permission of the publisher.IEEE Std 1076.2-1996IEEE Standard VHDL Mathematical PackagesSponsorDesign Automation Technical Committeeof theIEEE Computer SocietyApproved 19 September 1996
3、IEEE Standards BoardAbstract:The MATH_REAL package declaration, the MATH_COMPLEX package declaration,and the semantics of the standard mathematical definition and conventional meaning of the func-tions that are part of this standard are provided. Ways for users to implement this standard are giv-en
4、in an informative annex. Samples of the MATH_REAL and MATH_COMPLEX package bodiesare provided in an informative annex on diskette as guidelines for implementors to verify their im-plementation of this standard. Implementors may choose to implement the package bodies in themost efficient manner avail
5、able to them.Keywords:IEEE, MATH_COMPLEX, MATH_REAL, VHDL, VHDL model interoperabilityIEEE Standardsdocuments are developed within the IEEE Societies and the Standards Coordinat-ing Committees of the IEEE Standards Board. Members of the committees serve voluntarily andwithout compensation. They are
6、not necessarily members of the Institute. The standards developedwithin IEEE represent a consensus of the broad expertise on the subject within the Institute as wellas those activities outside of IEEE that have expressed an interest in participating in the develop-ment of the standard.Use of an IEEE
7、 Standard is wholly voluntary. The existence of an IEEE Standard does not implythat there are no other ways to produce, test, measure, purchase, market, or provide other goods andservices related to the scope of the IEEE Standard. Furthermore, the viewpoint expressed at thetime a standard is approve
8、d and issued is subject to change brought about through developments inthe state of the art and comments received from users of the standard. Every IEEE Standard is sub-jected to review at least every ve years for revision or reafrmation. When a document is morethan ve years old and has not been rea
9、frmed, it is reasonable to conclude that its contents,although still of some value, do not wholly reect the present state of the art. Users are cautioned tocheck to determine that they have the latest edition of any IEEE Standard.Comments for revision of IEEE Standards are welcome from any intereste
10、d party, regardless ofmembership afliation with IEEE. Suggestions for changes in documents should be in the form of aproposed change of text, together with appropriate supporting comments.Interpretations: Occasionally questions may arise regarding the meaning of portions of standards asthey relate t
11、o specic applications. When the need for interpretations is brought to the attention ofIEEE, the Institute will initiate action to prepare appropriate responses. Since IEEE Standards rep-resent a consensus of all concerned interests, it is important to ensure that any interpretation hasalso received
12、 the concurrence of a balance of interests. For this reason, IEEE and the members of itssocieties and Standards Coordinating Committees are not able to provide an instant response tointerpretation requests except in those cases where the matter has previously received formalconsideration. Comments o
13、n standards and requests for interpretations should be addressed to:Secretary, IEEE Standards Board445 Hoes LaneP.O. Box 1331Piscataway, NJ 08855-1331USAAuthorization to photocopy portions of any individual standard for internal or personal use isgranted by the Institute of Electrical and Electronic
14、s Engineers, Inc., provided that the appropriatefee is paid to Copyright Clearance Center. To arrange for payment of licensing fee, please contactCopyright Clearance Center, Customer Service, 222 Rosewood Drive, Danvers, MA 01923 USA;(508) 750-8400. Permission to photocopy portions of any individual
15、 standard for educational class-room use can also be obtained through the Copyright Clearance Center.Note: Attention is called to the possibility that implementation of this standard mayrequire use of subject matter covered by patent rights. By publication of this standard,no position is taken with
16、respect to the existence or validity of any patent rights inconnection therewith. The IEEE shall not be responsible for identifying patents forwhich a license may be required by an IEEE standard or for conducting inquiries intothe legal validity or scope of those patents that are brought to its atte
17、ntion.iiiIntroduction(This introduction is not a part of IEEE Std 1076.2-1996, IEEE Standard VHDL Mathematical Packages.)This set of packages provides a standard for the declaration of most frequently used real and complex ele-mentary functions required for numerically oriented modeling applications
18、. Use of these packages withtheir defined data types, constants, and functions is intended to provide a mechanism for writing VHDLmodels (compliant with IEEE Std 1076-1993) that are portable and interoperable with other VHDL modelsadhering to this standard. The standard serves a broad class of appli
19、cations with reasonable ease of use andrequires implementations that are of high quality.The work of this committee is the culmination of efforts by several groups with the same goals working overa period of three and a half years. Between 1992 and this date, many individuals made valuable contribut
20、ionsto the development of this standard, and several commercial organizations donated material that was used asa starting point or building block for the nal version of these packages. In addition, the followingsourceswere used for some of the algorithms in the packages: Abramowitz, M. and Stegun,I.
21、, Handbook of Mathematical Functions, 9th ed. New York: DoverPublications, Inc., 1972. Hu, X., Harber, R., and Bass, S., Expanding the range of convergence of the CORDIC algorithm,IEEE Transactions on Computers, vol. 40, no. 1, pp. 1321, 1991. LEcuyer, Pierre, Efcient and Portable Combined Random Nu
22、mber Generators, Communicationsof the ACM, vol. 31, no. 6, pp. 742774, 1988. University of California, Berkeley. C source for natural logarithm function, /system/unix/4.3bsd-reno/lib/libm/common_source/log.c, version 5.10 (Berkeley), 1993. Walther, J. S., A unied algorithm for elementary functions,
23、Proceedings of Spring Joint ComputerConference, pp. 379385, 1971.The following persons were members of the IEEE P1076.2 Working Group:Jose A. Torres,ChairDonald F. Hanson Charles Swart Alex ZamrescuivThe following persons were on the balloting committee:When the IEEE Standards Board approved this st
24、andard on 19 September 1996, it had the followingmembership:Donald C. Loughry,ChairRichard J. Holleman,Vice ChairAndrew G. Salem,Secretary*Member EmeritusAlso included are the following nonvoting IEEE Standards Board liaisons:Satish K. AggarwalAlan H. CooksonChester C. TaylorMary Lynne NielsenIEEE S
25、tandards Project EditorMostapha AboulhamidRobert E. AndersonPeter J. AshendenMike BeaverJean-Michel BergeJ. BhaskerWilliam D. BillowitchDennis B. BrophyRaul CamposanoHarold W. CarterMojy C. ChianErnst ChristenDavid CoelhoAlan CoppolaW. Terry CostonJoanne DeGroatAntonie C. deJagerAllen DeweyMichael A
26、. DukesDouglas D. DunlopWilliam FazakerlyJacques P. FlandroisRichard GriselMichael J. HaneyJames P. HannaWilliam A. HannaDonald F. HansonRandolph E. HarrRich HatcherRobert G. HillmanYee-Wing HsiehYu-I HsiehSylvie HuratMasaharu ImaiMitsuaki IshikawaStephen IvesNavneet Kumar JainChoon B. KimChris King
27、sleyJean LebrunRajeev MadhavanSerge MaginotVictor MartinPaul J. MenchiniGerald T. MichaelJohn T. MontagueChandra MoturuRobert N. NewshutzCurtis ParksGary S. PorterAdam PostulaJan PukiteFred RoseHemant G. RotithorLarry F. SaundersQuentin SchmiererFrancesco SforzaCharles ShelorRaj SinghDavid W. SmithJ
28、. Dennis SoderbergBalsha R. StanisicMichael F. SullivanCharles SwartJose A. TorresAlain VachouxRanganadha R.VemuriVenkat V. VenkataramanRonald WaxmanAlan WhittakerJohn C. WillisMark ZwolinskiGilles A. BarilClyde R. CampJoseph A. CannatelliStephen L. DiamondHarold E. EpsteinDonald C. FleckensteinJay
29、Forster*Donald N. HeirmanBen C. JohnsonE. G. Al KienerJoseph L. Koepnger*Stephen R. LambertLawrence V. McCallL. Bruce McClungMarco W. MigliaroMary Lou PadgettJohn W. PopeJose R. RamosArthur K. ReillyRonald H. ReimerGary S. RobinsonIngo RschJohn S. RyanChee Kiow TanLeonard L. TrippHoward L. WolfmanvC
30、ontentsCLAUSE PAGE1. Overview 11.1 Scope 11.2 Constants, types, and functions provided 11.3 Conformance with this standard 32. References 33. Package declarations 43.1 MATH_REAL . 43.2 MATH_COMPLEX. 15ANNEXAnnex A (informative) Using the MATH_REAL and MATH_COMPLEX packages 34A.1 Predefined data type
31、s, operators, and precision for MATH_REAL 34A.2 Use of constants in MATH_REAL 34A.3 Use and constraints of pseudo-random number generator in MATH_REAL . 34A.4 Precision across different platforms. 34A.5 Handling of overflow/underflow conditions 34A.6 Testbench for the packages 35A.7 Compatibility wi
32、th VHDL analog standard. 35A.8 Overloading side effect35A.9 Synthesizability of functions 35Annex B (informative) Package bodies 361IEEE Standard VHDL Mathematical Packages1. Overview1.1 ScopeThis standard is embodied in the MATH_REAL and MATH_COMPLEX package declarations, and in thesemantics of the
33、 standard mathematical denition and the conventional meaning of the functions that arepart of this standard, along with 1.3. The information in annex A is a guide to users and implementors and isnot a normative part of this standard, but suggests ways in which one might use this set of packages. The
34、information in annex B is provided as a guideline for implementors and is not a normative part of this stan-dard, but suggests ways in which implementors may implement this standard. The functions in this set ofpackages were chosen because of their widespread utility, as well as because they are nee
35、ded to support gen-eral oating-point usage and to build other generic packages.1.2 Constants, types, and functions providedThe following constants of type REAL are provided:MATH_E MATH_LOG_OF_2 MATH_DEG_TO_RADMATH_1_OVER_E MATH_LOG_OF_10 MATH_RAD_TO_DEGMATH_LOG2_OF_EMATH_PI MATH_LOG10_OF_EMATH_2_PIM
36、ATH_1_OVER_PI MATH_SQRT_2MATH_PI_OVER_2 MATH_1_OVER_SQRT_2MATH_PI_OVER_3 MATH_SQRT_PIMATH_PI_OVER_4MATH_3_PI_OVER_2The following functions/procedures of type REAL are provided:IEEEStd 1076.2-1996 IEEE STANDARD VHDL2SIGN(X) EXP(X) SINH(X)CEIL(X) LOG(X) COSH(X)FLOOR(X) LOG2(X) TANH(X)ROUND(X) LOG10(X)
37、TRUNC(X) LOG(X, BASE) ARCSINH(X)“MOD“(X, Y) ARCCOSH(X)SIN(X) ARCTANH(X)REALMAX(X, Y) COS(X)REALMIN(X, Y) TAN(X)UNIFORM(SEED1, SEED2, X)SQRT(X) ARCSIN(X)CBRT(X) ARCCOS(X)“*“(X, Y) ARCTAN(Y)ARCTAN(Y, X)The following types and subtypes are provided:COMPLEX POSITIVE_REALCOMPLEX_POLAR PRINCIPAL_VALUEThe
38、following constants of type COMPLEX are provided:MATH_CBASE_1 MATH_CBASE_J MATH_CZEROThe following type conversion functions for COMPLEX and COMPLEX_POLAR are provided:CMPLX(X, Y) POLAR_TO_COMPLEX(Z)COMPLEX_TO_POLAR(Z) GET_PRINCIPAL_VALUE(X)The following overloaded relational functions for type COMP
39、LEX_POLAR are provided:“=“(L, R) “/=“(L, R)The following functions for type COMPLEX and COMPLEX_POLAR are provided:“ABS“(Z) EXP(Z) SIN(Z)ARG(Z) LOG(Z) COS(Z)LOG2(Z)“-“(Z) LOG10(Z) SINH(Z)CONJ(Z) LOG(Z, BASE) COSH(Z)SQRT(Z)IEEEMATHEMATICAL PACKAGES Std 1076.2-19963The following arithmetic functions f
40、or type COMPLEX and COMPLEX_POLAR are provided:“+“ “*“-“ “/“1.3 Conformance with this standardThe following conformance rules shall apply as they pertain to the use and implementation of this standard:a) The package declarations may be modied to include additional data required by tools, but modi-ca
41、tions shall in no way change the external interfaces or simulation behavior of the description. It ispermissible to add comments and/or attributes to the package declarations, but not to change ordelete any original lines of the approved package declaration.b) The standard mathematical denition and
42、conventional meaning of the mathematical functions thatare part of this standard, together with the MATH_REAL and MATH_COMPLEX package declara-tions, represent the formal semantics of the implementation of the MATH_REAL andMATH_COMPLEX packages. An implementation is provided as a guideline in annex
43、B. Imple-mentors of these packages may choose to simply compile the package bodies provided in annex B,or they may choose to implement the package bodies in the most efcient form available to them.Implementations should conform to the semantics and minimum precision required by this standard.c) The
44、MATH_REAL package shall be built on top of the standard data type and precision require-ments for oating point operations dened in IEEE Std 1076-1993 (STD.STANDARD).d) The minimum precision required is that of IEEE Std 1076-1993. Because of this reason and the factthat the functions are implemented
45、on digital computers with only nite precision, the functions andconstants in this set of packages can, at best, only approximate the corresponding mathematicallydened functions and constants. An implementation is allowed to provide a higher precision thanthe minimum required.e) For some functions, t
46、he implementation shall deliver prescribed results for certain special argu-ments, as dened in the comments for the functions in the function declaration. The purpose is tostrengthen the accuracy requirements at special argument values. Prescribed results take precedenceover maximum relative error r
47、equirements.f) The semantics of the standard require that all the functions in the packages detect and report invalidparameters (out of valid domain) through an assert statement. The domain of valid values is indi-cated in the MATH_REAL and MATH_COMPLEX package declarations. The default value of the
48、severity level shall be Error.g) The semantics of the standard do not require detection of overow or underow. Therefore, detec-tion of underow/overow is optional and implementation dependent.h) If an implementation chooses to provide any extensions beyond the minimum requirements of thisstandard (e.
49、g., precision, overow handling), then it shall document its behavior accordingly.i) The MATH_REAL and MATH_COMPLEX packages shall be compiled into a library symbolicallynamed IEEE.2. ReferencesThis standard shall be used in conjunction with the following publications:IEEE Std 754-1985 (Reaff 1990), IEEE Standard for Binary Floating-Point Arithmetic (ANSI).1IEEE Std 1076-1993, IEEE Standard VHDL Language Reference Manual (ANSI).1IEEE publications are available from the Institute of Electrical and Electronics Engineers, 445 Hoes Lane, P. O.