From jose@Synopsys.COM Sat Apr  1 18:25:58 1995
Return-Path: <jose@Synopsys.COM>
Received: from chronos.synopsys.com by vhdl.vhdl.org (4.1/SMI-4.1/BARRNet)
	id AA09296; Sat, 1 Apr 95 18:25:57 PST
Received: from atropos.synopsys.com by chronos.synopsys.com with SMTP id AA18458
  (5.65c/IDA-1.4.4 for <jose@vhdl.org>); Sat, 1 Apr 1995 18:20:25 -0800
Received: from clotho.synopsys.com (clotho.synopsys.com [146.225.64.24]) by atropos.synopsys.com (8.6.9/8.6.9) with ESMTP id SAA22205 for <jose@vhdl.org>; Sat, 1 Apr 1995 18:20:24 -0800
Received: from gaea.synopsys.com (gaea.synopsys.com [146.225.64.200])
  by clotho.synopsys.com (8.6.9/8.6.9) with SMTP id SAA28366
  for <jose@clotho.synopsys.com>; Sat, 1 Apr 1995 18:20:22 -0800
Received: from jose.synopsys.com by gaea.synopsys.com with SMTP id AA01646
  (5.65c/IDA-1.4.4 for <jose@mailhost.synopsys.com>); Sat, 1 Apr 1995 18:20:16 -0800
From: Jose Torres <jose@Synopsys.COM>
Received: (jose@localhost) by jose.synopsys.com (8.6.9/8.6.5) id SAA23188 for jose; Sat, 1 Apr 1995 18:20:14 -0800
Date: Sat, 1 Apr 1995 18:20:14 -0800
Message-Id: <199504020220.SAA23188@jose.synopsys.com>
To: jose@Synopsys.COM
Subject: minutes 1.25.94
Status: RO


The Math Package Study Subgroup (Par 1076.2)

From:		Jose Torres
To:		Interested Parties
Date:  		January 25, 1994
Subject:  	1/27/94 meeting

SUMMARY

	This meeting was to take place at Tempe (DASC meetings following SHDL 
Conference) from 8:00 a.m. until 12:00 am.  Due to schedule conflicts for the
active members of this working group, the meeting has been cancelled.

	In lieu of the meeting, here is a status report on the progress
achieved since the last meeting report. 

STATUS REPORT

1. Coordination with analog working group. 
	Some initial feedback started arriving from members of this team.
	A request was sent to Jean-Michel Berge for specific requirements
	from the analog group.
	If a new floating point type with higher precision than REAL is 
	created as part of the AHDL effort, then the current proposed solution
	for this requirement is to develop 2 equivalent math packages: one for 
	each floating point type. 

2. Requests for Additional Functionality and Feedback
	Feedback has been arriving on the package, both in terms of correctness
	of the proposed package body and completeness.  Comments regarding
	the proposed functions are being reviewed and incorporated when no
	conflicts are found.  Otherwise, they are being deferred for further 
	analysis.
	Proposals for additional functionality are being collected and
	classified for their inclusion in either this package or a 
	separate package.

3. Developing a test bench.
	Chuck Swart got permission from Mentor Graphics to release the
	template used in their test suite as starting point for the test
	bench.
	Jose Torres got some funding from Synopsys to develop a prototype 
	of the test bench for the math package.

	We expect that a prototype for the test bench will be available by
	mid-January.   We will need volunteers to help on extending the
	test bench for completeness.  If you are interested please let Jose
	(jose@synopsys.com) know.

6. Balloting

	John Hines was asked to get the process ballot constituency process
	rolling.  The idea is to start with the list used for VHDL-1992.
	Jose Torres was assigned the action item to create a deflector for
	the group and to open an account to post the latest version of
	the package.  This action has been started and the account and
	deflector will be ready by the 2nd week of December 1993.

7. FOREIGN attributes

	The issue about the use of FOREIGN attributes is still open.
	The current suggestion is to use the FOREIGN attribute to describe the 
	particular function and that complying vendors would then have to 
	recognize particular strings to be compliant. For example, the SRAND 
	function might have FOREIGN attribute "MATH_SRAND".
	
8.  Miscellaneous

	Some of the functions in the package do not have checks for the
	input values.  In general, it was recognized that some cleaning is
	needed on the current proposal, and should be done as part of
	the process of creating the test bench.

	Several subprograms have variables declared which should really be
	constants, since their values are not changed within the subprogram.
	One example of this is in the CEILING function

		"variable large: real := 1073741824.0;"

	should more accurately be

		"constant large: ..."

9. Current Version of The Package.

	Package declaration follows.  For electronic version of
	package body, please send request to jose@synopsys.com

------------------------------------------------------------------------
--
-- This source file may be used and distributed without restriction.
-- No declarations or definitions shall be included in this package. 
-- This package cannot be sold or distributed for profit.
--
--   ****************************************************************
--   *                                                              *
--   *                      W A R N I N G		 	    *
--   *								    *
--   *   This DRAFT version IS NOT endorsed or approved by IEEE     *
--   *								    *
--   ****************************************************************
--
-- Title:    PACKAGE MATH_REAL
--
-- Library:  This package shall be compiled into a library 
--           symbolically named IEEE.
--
-- Purpose:  VHDL declarations for mathematical package MATH_REAL
--	     which contains common real constants, common real
--	     functions, and real trascendental functions.
--
-- Author:   IEEE VHDL Math Package Study Group 
--
-- Notes:
-- 	The package body shall be considered the formal definition of 
-- 	the semantics of this package. Tool developers may choose to implement 
-- 	the package body in the most efficient manner available to them.
--
-- History:
-- 	Version 0.1  (Strawman) Jose A. Torres	6/22/92
-- 	Version 0.2		Jose A. Torres	1/15/93
-- 	Version	0.3		Jose A. Torres	4/13/93
--	Version 0.4		Jose A. Torres	4/19/93
--	Version 0.5		Jose A. Torres	4/20/93 Added RANDOM()
--	Version 0.6		Jose A. Torres	4/23/93 Renamed RANDOM as
--							UNIFORM.  Modified
--							rights banner.
--	Version 0.7		Jose A. Torres	5/28/93 Rev up for compatibility
--							with package body.
-------------------------------------------------------------
Library IEEE;

Package MATH_REAL is

    -- 
    -- commonly used constants
    --
    constant  MATH_E :   real := 2.71828_18284_59045_23536;  
    						  -- value of e
    constant  MATH_1_E:  real := 0.36787_94411_71442_32160;
  						  -- value of 1/e
    constant  MATH_PI :  real := 3.14159_26535_89793_23846;  
    						  -- value of pi
    constant  MATH_1_PI :  real := 0.31830_98861_83790_67154;  
    						  -- value of 1/pi
    constant  MATH_LOG_OF_2:  real := 0.69314_71805_59945_30942;
    						  -- natural log of 2
    constant  MATH_LOG_OF_10: real := 2.30258_50929_94045_68402;
    						  -- natural log of10
    constant  MATH_LOG2_OF_E:  real := 1.44269_50408_88963_4074;
    						  -- log base 2 of e
    constant  MATH_LOG10_OF_E: real := 0.43429_44819_03251_82765;
    						  -- log base 10 of e
    constant  MATH_SQRT2: real := 1.41421_35623_73095_04880; 
    						  -- sqrt of 2
    constant  MATH_SQRT1_2: real := 0.70710_67811_86547_52440; 
    						  -- sqrt of 1/2
    constant  MATH_SQRT_PI: real := 1.77245_38509_05516_02730; 
    						  -- sqrt of pi
    constant  MATH_DEG_TO_RAD: real := 0.01745_32925_19943_29577;
    			  	-- conversion factor from degree to radian
    constant  MATH_RAD_TO_DEG: real := 57.29577_95130_82320_87685;
    			   	-- conversion factor from radian to degree

    --
    -- attribute for functions whose implementation is foreign (C native)
    --
    attribute FOREIGN : string; -- predefined attribute in VHDL-1992

    --
    -- function declarations
    --
    function SIGN (X: real ) return real;
    	-- returns 1.0 if X > 0.0; 0.0 if X == 0.0; -1.0 if X < 0.0

    function CEIL (X : real ) return real;
    	-- returns smallest integer value (as real) not less than X

    function FLOOR (X : real ) return real;
    	-- returns largest integer value (as real) not greater than X

    function ROUND (X : real ) return real;
    	-- returns integer FLOOR(X + 0.5) if X > 0;
    	-- return integer CEIL(X - 0.5) if X < 0
    
    function FMAX (X, Y : real ) return real;
    	-- returns the algebraically larger of X and Y

    function FMIN (X, Y : real ) return real;
    	-- returns the algebraically smaller of X and Y

    procedure UNIFORM (variable Seed1,Seed2:inout integer; variable X:out real);
	-- returns a pseudo-random number with uniform distribution in the 
	-- interval (0.0, 1.0).
	-- Before the first call to UNIFORM, the seed values (Seed1, Seed2) must
	-- be initialized to values in the range [1, 2147483562] and 
	-- [1, 2147483398] respectively.  The seed values are modified after 
	-- each call to UNIFORM.
	-- This random number generator is portable for 32-bit computers, and
	-- it has period ~2.30584*(10**18) for each set of seed values.
	--
	-- For VHDL-1992, the seeds will be global variables, functions to 
	-- initialize their values (INIT_SEED) will be provided, and the UNIFORM
	-- procedure call will be modified accordingly.  

    function SRAND (seed: in integer ) return integer;
    	--
	-- sets value of seed for sequence of 
    	-- pseudo-random numbers.   
    	-- It uses the foreign native C function srand().
    attribute FOREIGN of SRAND : function is "C_NATIVE"; 

    function RAND return integer;		
    	--
	-- returns an integer pseudo-random number with uniform distribution.
	-- It uses the foreign native C function rand(). 
    	-- Seed for the sequence is initialized with the
    	-- SRAND() function and value of the seed is changed every
        -- time SRAND() is called,  but it is not visible.
    	-- The range of generated values is platform dependent.
    attribute FOREIGN of RAND : function is "C_NATIVE"; 

    function GET_RAND_MAX  return integer;		
    	--
	-- returns the upper bound of the range of the
    	-- pseudo-random numbers generated by  RAND().
    	-- The support for this function is platform dependent, and
	-- it uses foreign native C functions or constants.
	-- It may not be available in some platforms.
    	-- Note: the value of (RAND() / GET_RAND_MAX()) is a
    	--       pseudo-random number distributed between 0 & 1.
    attribute FOREIGN of GET_RAND_MAX : function is "C_NATIVE"; 

    function SQRT (X : real ) return real;
    	-- returns square root of X;  X >= 0

    function CBRT (X : real ) return real;
    	-- returns cube root of X

    function "**" (X : integer; Y : real) return real;
    	-- returns Y power of X ==>  X**Y;
    	-- error if X = 0 and Y <= 0.0
    	-- error if X < 0 and Y does not have an integer value

    function "**" (X : real; Y : real) return real;
    	-- returns Y power of X ==>  X**Y;
    	-- error if X = 0.0 and Y <= 0.0
    	-- error if X < 0.0 and Y does not have an integer value

    function EXP  (X : real ) return real;
    	-- returns e**X; where e = MATH_E

    function LOG (X : real ) return real;
    	-- returns natural logarithm of X; X > 0

    function LOG (BASE: positive; X : real) return real;
    	-- returns logarithm base BASE of X; X > 0

    function  SIN (X : real ) return real;
    	-- returns sin X; X in radians

    function  COS ( X : real ) return real;
    	-- returns cos X; X in radians

    function  TAN (X : real ) return real;
    	-- returns tan X; X in radians
    	-- X /= ((2k+1) * PI/2), where k is an integer

    function  ASIN (X : real ) return real; 
    	-- returns  -PI/2 < asin X < PI/2; | X | <= 1

    function  ACOS (X : real ) return real;
    	-- returns  0 < acos X < PI; | X | <= 1

    function  ATAN (X : real) return real;
    	-- returns  -PI/2 < atan X < PI/2

    function  ATAN2 (X : real; Y : real) return real;
    	-- returns  atan (X/Y); -PI < atan2(X,Y) < PI; Y /= 0.0

    function SINH (X : real) return real;
    	-- hyperbolic sine; returns (e**X - e**(-X))/2

    function  COSH (X : real) return real;
    	-- hyperbolic cosine; returns (e**X + e**(-X))/2

    function  TANH (X : real) return real;
    	-- hyperbolic tangent; -- returns (e**X - e**(-X))/(e**X + e**(-X))
    
    function ASINH (X : real) return real;
    	-- returns ln( X + sqrt( X**2 + 1))

    function ACOSH (X : real) return real;
    	-- returns ln( X + sqrt( X**2 - 1));   X >= 1

    function ATANH (X : real) return real;
    	-- returns (ln( (1 + X)/(1 - X)))/2 ; | X | < 1

end  MATH_REAL;


