diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-10-10 18:52:01 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-10-10 18:52:01 +0200 |
commit | 4144afe6e495e7893e08b5e1f84acdfa8c983dc0 (patch) | |
tree | 8016fe4c15e0c107517ff941bbe9d49b9308cf8e /src/synth | |
parent | 1f333abb370b3cbf8809d2949eb33deccd97b076 (diff) | |
download | ghdl-4144afe6e495e7893e08b5e1f84acdfa8c983dc0.tar.gz ghdl-4144afe6e495e7893e08b5e1f84acdfa8c983dc0.tar.bz2 ghdl-4144afe6e495e7893e08b5e1f84acdfa8c983dc0.zip |
synth: remove synth-types
Diffstat (limited to 'src/synth')
-rw-r--r-- | src/synth/synth-expr.adb | 23 | ||||
-rw-r--r-- | src/synth/synth-oper.adb | 3 | ||||
-rw-r--r-- | src/synth/synth-types.adb | 50 | ||||
-rw-r--r-- | src/synth/synth-types.ads | 28 |
4 files changed, 13 insertions, 91 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index 564ce3420..cd840b97a 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -34,7 +34,6 @@ with Vhdl.Annotations; use Vhdl.Annotations; with Netlists.Gates; use Netlists.Gates; with Netlists.Builders; use Netlists.Builders; -with Synth.Types; use Synth.Types; with Synth.Errors; use Synth.Errors; with Synth.Environment; with Synth.Decls; @@ -1330,34 +1329,36 @@ package body Synth.Expr is is Expr : constant Node := Get_Expression (Conv); Conv_Type : constant Node := Get_Type (Conv); + Conv_Typ : constant Type_Acc := Get_Value_Type (Syn_Inst, Conv_Type); Val : Value_Acc; begin Val := Synth_Expression_With_Basetype (Syn_Inst, Expr); case Get_Kind (Conv_Type) is when Iir_Kind_Integer_Subtype_Definition => if Val.Typ.Kind = Type_Float then - return Create_Value_Discrete - (Int64 (Val.Fp), Get_Value_Type (Syn_Inst, Conv_Type)); + return Create_Value_Discrete (Int64 (Val.Fp), Conv_Typ); else Error_Msg_Synth (+Conv, "unhandled type conversion (to int)"); return null; end if; when Iir_Kind_Floating_Subtype_Definition => if Is_Const (Val) then - return Create_Value_Float - (Fp64 (Val.Scal), Get_Value_Type (Syn_Inst, Conv_Type)); + return Create_Value_Float (Fp64 (Val.Scal), Conv_Typ); else Error_Msg_Synth (+Conv, "unhandled type conversion (to float)"); return null; end if; when Iir_Kind_Array_Type_Definition | Iir_Kind_Array_Subtype_Definition => - if Is_Vector_Type (Conv_Type) then - return Val; - else - Error_Msg_Synth (+Conv, "unhandled type conversion (to array)"); - return Val; - end if; + case Conv_Typ.Kind is + when Type_Vector + | Type_Unbounded_Vector => + return Val; + when others => + Error_Msg_Synth + (+Conv, "unhandled type conversion (to array)"); + return Val; + end case; when others => Error_Msg_Synth (+Conv, "unhandled type conversion"); return null; diff --git a/src/synth/synth-oper.adb b/src/synth/synth-oper.adb index 5828ce0f2..bdea830f1 100644 --- a/src/synth/synth-oper.adb +++ b/src/synth/synth-oper.adb @@ -33,7 +33,6 @@ with Netlists.Gates; use Netlists.Gates; with Netlists.Builders; use Netlists.Builders; with Synth.Errors; use Synth.Errors; -with Synth.Types; use Synth.Types; with Synth.Stmts; use Synth.Stmts; with Synth.Expr; use Synth.Expr; with Synth.Source; @@ -485,7 +484,7 @@ package body Synth.Oper is when Iir_Predefined_Array_Greater => -- TODO: check size, non-vector. -- TODO: that's certainly not the correct operator. - if Is_Vector_Type (Left_Type) then + if Left.Typ.Kind = Type_Vector then return Synth_Compare (Id_Ugt); else raise Internal_Error; diff --git a/src/synth/synth-types.adb b/src/synth/synth-types.adb deleted file mode 100644 index df1712ac2..000000000 --- a/src/synth/synth-types.adb +++ /dev/null @@ -1,50 +0,0 @@ --- Types synthesis. --- Copyright (C) 2017 Tristan Gingold --- --- This file is part of GHDL. --- --- This program 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 of the License, or --- (at your option) any later version. --- --- This program 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 this program; if not, write to the Free Software --- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, --- MA 02110-1301, USA. - -with Vhdl.Std_Package; -with Vhdl.Ieee.Std_Logic_1164; -with Vhdl.Utils; use Vhdl.Utils; - -package body Synth.Types is - function Is_Bit_Type (Atype : Node) return Boolean - is - Btype : Node; - begin - if Atype = Vhdl.Ieee.Std_Logic_1164.Std_Ulogic_Type - or else Atype = Vhdl.Ieee.Std_Logic_1164.Std_Logic_Type - or else Atype = Vhdl.Std_Package.Boolean_Type_Definition - or else Atype = Vhdl.Std_Package.Bit_Type_Definition - then - return True; - end if; - Btype := Get_Base_Type (Atype); - if Btype = Atype then - return False; - else - return Is_Bit_Type (Btype); - end if; - end Is_Bit_Type; - - function Is_Vector_Type (Atype : Node) return Boolean is - begin - return Is_Bit_Type (Get_Element_Subtype (Atype)) - and then Get_Nbr_Dimensions (Atype) = 1; - end Is_Vector_Type; -end Synth.Types; diff --git a/src/synth/synth-types.ads b/src/synth/synth-types.ads deleted file mode 100644 index 0212ad609..000000000 --- a/src/synth/synth-types.ads +++ /dev/null @@ -1,28 +0,0 @@ --- Types synthesis. --- Copyright (C) 2017 Tristan Gingold --- --- This file is part of GHDL. --- --- This program 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 of the License, or --- (at your option) any later version. --- --- This program 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 this program; if not, write to the Free Software --- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, --- MA 02110-1301, USA. - -with Vhdl.Nodes; use Vhdl.Nodes; - -package Synth.Types is - -- All known enumeration type that are translated to a single bit. - function Is_Bit_Type (Atype : Node) return Boolean; - - function Is_Vector_Type (Atype : Node) return Boolean; -end Synth.Types; |