diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-06-28 18:30:30 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-06-28 18:30:30 +0200 |
commit | 48546422b50cdc7847e537fa8aca249d9cbe3677 (patch) | |
tree | b2cfd29193128ee7e1be3b592e38f82a52f74d1d /src/vhdl/vhdl-ieee-math_real.adb | |
parent | 12e5e54325111f11d7bb6283eed7fd4a3760a899 (diff) | |
download | ghdl-48546422b50cdc7847e537fa8aca249d9cbe3677.tar.gz ghdl-48546422b50cdc7847e537fa8aca249d9cbe3677.tar.bz2 ghdl-48546422b50cdc7847e537fa8aca249d9cbe3677.zip |
vhdl: recognize some functions of math_real.
Diffstat (limited to 'src/vhdl/vhdl-ieee-math_real.adb')
-rw-r--r-- | src/vhdl/vhdl-ieee-math_real.adb | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-ieee-math_real.adb b/src/vhdl/vhdl-ieee-math_real.adb new file mode 100644 index 000000000..d62e4c246 --- /dev/null +++ b/src/vhdl/vhdl-ieee-math_real.adb @@ -0,0 +1,58 @@ +-- Nodes recognizer for ieee.math_real. +-- Copyright (C) 2019 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 GHDL; see the file COPYING. If not, write to the Free +-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA +-- 02111-1307, USA. + +with Std_Names; use Std_Names; + +package body Vhdl.Ieee.Math_Real is + procedure Extract_Declarations (Pkg : Iir_Package_Declaration) + is + Decl : Iir; + Predef : Iir_Predefined_Functions; + begin + Math_Real_Pkg := Pkg; + + Decl := Get_Declaration_Chain (Pkg); + + -- Skip a potential copyright constant. + Decl := Skip_Copyright_Notice (Decl); + + -- Skip any declarations but functions. + loop + Decl := Get_Chain (Decl); + exit when Decl = Null_Iir; + + case Get_Kind (Decl) is + when Iir_Kind_Function_Declaration => + Predef := Iir_Predefined_None; + case Get_Identifier (Decl) is + when Name_Ceil => + Predef := Iir_Predefined_Ieee_Math_Real_Ceil; + when Name_Log2 => + Predef := Iir_Predefined_Ieee_Math_Real_Log2; + when others => + null; + end case; + Set_Implicit_Definition (Decl, Predef); + when Iir_Kind_Constant_Declaration => + null; + when others => + null; + end case; + end loop; + end Extract_Declarations; +end Vhdl.Ieee.Math_Real; |