diff options
author | Tristan Gingold <gingold@adacore.com> | 2015-12-03 21:04:42 +0100 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2015-12-16 09:35:28 +0100 |
commit | 8d5c9a328a7285c5457bf8fdfcb403b87db1e263 (patch) | |
tree | 8b9898f2f82b1413040472476174e5ea7644064b /libraries/openieee/math_real.vhdl | |
parent | 8cc62e1063ed2ba035e9ca7ed7667c8fca319e6b (diff) | |
download | ghdl-8d5c9a328a7285c5457bf8fdfcb403b87db1e263.tar.gz ghdl-8d5c9a328a7285c5457bf8fdfcb403b87db1e263.tar.bz2 ghdl-8d5c9a328a7285c5457bf8fdfcb403b87db1e263.zip |
openieee: add numeric_std and numeric_bit.
Diffstat (limited to 'libraries/openieee/math_real.vhdl')
-rw-r--r-- | libraries/openieee/math_real.vhdl | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/libraries/openieee/math_real.vhdl b/libraries/openieee/math_real.vhdl new file mode 100644 index 000000000..b2814f534 --- /dev/null +++ b/libraries/openieee/math_real.vhdl @@ -0,0 +1,44 @@ +-- This -*- vhdl -*- file is part of GHDL. +-- IEEE 1076.2 math_real package. +-- Copyright (C) 2015 Tristan Gingold +-- +-- GHDL is free software; you can redistribute it and/or modify it under +-- the terms of the GNU General Public License as published by the Free +-- Software Foundation; either version 2, or (at your option) any later +-- version. +-- +-- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or +-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +-- for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with GCC; see the file COPYING2. If not see +-- <http://www.gnu.org/licenses/>. + +package MATH_REAL is + constant math_pi : real := 3.14159_26535_89793_23846; + function SIGN (X : REAL) return REAL; + + function CEIL (X : REAL) return REAL; + attribute foreign of ceil : function is "VHPIDIRECT ceil"; + + function FLOOR (X : REAL) return REAL; + attribute foreign of floor : function is "VHPIDIRECT floor"; + + function ROUND (X : REAL) return REAL; + attribute foreign of round : function is "VHPIDIRECT round"; + + function TRUNC (X : REAL) return REAL; + attribute foreign of trunc : function is "VHPIDIRECT trunc"; + + procedure UNIFORM (SEED1, SEED2 : inout POSITIVE; X : out REAL); + -- Algorithm from: Pierre L'Ecuyer, CACM June 1988 Volume 31 Number 6 + -- page 747 figure 3. + + function SIN (X : REAL) return REAL; + attribute foreign of SIN : function is "VHPIDIRECT sin"; + + function COS (X : REAL) return REAL; + attribute foreign of COS : function is "VHPIDIRECT cos"; +end MATH_REAL; |