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/synth-expr.adb | |
parent | 1f333abb370b3cbf8809d2949eb33deccd97b076 (diff) | |
download | ghdl-4144afe6e495e7893e08b5e1f84acdfa8c983dc0.tar.gz ghdl-4144afe6e495e7893e08b5e1f84acdfa8c983dc0.tar.bz2 ghdl-4144afe6e495e7893e08b5e1f84acdfa8c983dc0.zip |
synth: remove synth-types
Diffstat (limited to 'src/synth/synth-expr.adb')
-rw-r--r-- | src/synth/synth-expr.adb | 23 |
1 files changed, 12 insertions, 11 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; |