OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [eval_fat.ads] - Blame information for rev 706

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT COMPILER COMPONENTS                         --
4
--                                                                          --
5
--                             E V A L _ F A T                              --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--          Copyright (C) 1992-2010, Free Software Foundation, Inc.         --
10
--                                                                          --
11
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
12
-- terms of the  GNU General Public License as published  by the Free Soft- --
13
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
14
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17
-- for  more details.  You should have  received  a copy of the GNU General --
18
-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
19
-- http://www.gnu.org/licenses for a complete copy of the license.          --
20
--                                                                          --
21
-- GNAT was originally developed  by the GNAT team at  New York University. --
22
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
23
--                                                                          --
24
------------------------------------------------------------------------------
25
 
26
--  This package provides for compile-time evaluation of static calls to the
27
--  floating-point attribute functions. It is the compile-time equivalent of
28
--  the System.Fat_Gen runtime package. The coding is quite similar, as are
29
--  the subprogram specs, except that the type is passed as an explicit
30
--  first parameter (and used via ttypes, to obtain the necessary information
31
--  about the characteristics of the type for computing the results.
32
 
33
with Types;  use Types;
34
with Uintp;  use Uintp;
35
with Urealp; use Urealp;
36
 
37
package Eval_Fat is
38
 
39
   subtype UI is Uint;
40
   --  The compile time representation of universal integer
41
 
42
   subtype T is Ureal;
43
   --  The compile time representation of floating-point values
44
 
45
   subtype R is Entity_Id;
46
   --  The compile time representation of the floating-point root type
47
 
48
   --  The following functions perform the operation implied by their name
49
   --  which corresponds to the name of the attribute which they compute.
50
   --  The arguments correspond to the attribute function arguments.
51
 
52
   function Adjacent          (RT : R; X, Towards : T)              return T;
53
 
54
   function Ceiling           (RT : R; X : T)                       return T;
55
 
56
   function Compose           (RT : R; Fraction : T; Exponent : UI) return T;
57
 
58
   function Copy_Sign         (RT : R; Value, Sign : T)             return T;
59
 
60
   function Exponent          (RT : R; X : T)                       return UI;
61
 
62
   function Floor             (RT : R; X : T)                       return T;
63
 
64
   function Fraction          (RT : R; X : T)                       return T;
65
 
66
   function Leading_Part      (RT : R; X : T; Radix_Digits : UI)    return T;
67
 
68
   function Model             (RT : R; X : T)                       return T;
69
 
70
   function Pred              (RT : R; X : T)                       return T;
71
 
72
   function Remainder         (RT : R; X, Y : T)                    return T;
73
 
74
   function Rounding          (RT : R; X : T)                       return T;
75
 
76
   function Scaling           (RT : R; X : T; Adjustment : UI)      return T;
77
 
78
   function Succ              (RT : R; X : T)                       return T;
79
 
80
   function Truncation        (RT : R; X : T)                       return T;
81
 
82
   function Unbiased_Rounding (RT : R; X : T)                       return T;
83
 
84
   --  The following global declarations are used by the Machine attribute
85
 
86
   type Rounding_Mode is (Floor, Ceiling, Round, Round_Even);
87
   for Rounding_Mode use (0, 1, 2, 3);
88
   --  Used to indicate rounding mode for Machine attribute
89
   --  Note that C code in gigi knows that Round_Even is 3
90
 
91
   --  The Machine attribute is special, in that it takes an extra argument
92
   --  indicating the rounding mode, and also an argument Enode that is a
93
   --  node used to post warnings (e.g. if asked to convert a negative zero
94
   --  on a machine for which Signed_Zeros is False).
95
 
96
   function Machine
97
     (RT    : R;
98
      X     : T;
99
      Mode  : Rounding_Mode;
100
      Enode : Node_Id) return T;
101
 
102
end Eval_Fat;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.