diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-12-19 18:31:32 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-12-19 18:31:32 +0100 |
commit | c5b1522aec8cbb90167e0a7d7b04e73d6b96fa21 (patch) | |
tree | 7a3e5e7e5cc77ceefa0f677f004dd5fd419db066 /src/vhdl | |
parent | 0e76825a8170af3be3ee0f5a89c209262828d254 (diff) | |
download | ghdl-c5b1522aec8cbb90167e0a7d7b04e73d6b96fa21.tar.gz ghdl-c5b1522aec8cbb90167e0a7d7b04e73d6b96fa21.tar.bz2 ghdl-c5b1522aec8cbb90167e0a7d7b04e73d6b96fa21.zip |
vhdl-evaluation: handle default value for ieee operators.
Fix #2276
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/vhdl-evaluation.adb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-evaluation.adb b/src/vhdl/vhdl-evaluation.adb index 797f198b1..4c7c2fa49 100644 --- a/src/vhdl/vhdl-evaluation.adb +++ b/src/vhdl/vhdl-evaluation.adb @@ -926,6 +926,10 @@ package body Vhdl.Evaluation is Res := Create_Memory (Typ); Write_Fp64 (Res.Mem, Get_Fp_Value (N)); + when Iir_Kind_Character_Literal => + -- For default values of interfaces. + return Convert_Node_To_Memtyp (Get_Named_Entity (N), Typ); + when others => Error_Kind ("convert_node_to_memtyp", N); end case; @@ -3928,14 +3932,17 @@ package body Vhdl.Evaluation is Imp : constant Iir := Get_Implementation (Expr); Def : constant Iir_Predefined_Functions := Get_Implicit_Definition (Imp); + Inter : Iir; Left, Right : Iir; begin if Def in Iir_Predefined_Concat_Functions then return Eval_Concatenation ((1 => Expr)); end if; + Inter := Get_Interface_Declaration_Chain (Imp); Left := Get_Parameter_Association_Chain (Expr); Right := Get_Chain (Left); + Inter := Get_Chain (Inter); if Def in Iir_Predefined_IEEE_Explicit then -- Note: what about association by name ? @@ -3948,6 +3955,8 @@ package body Vhdl.Evaluation is (Get_Kind (Right) = Iir_Kind_Association_Element_By_Expression); Right := Eval_Static_Expr (Get_Actual (Right)); + elsif Inter /= Null_Node then + Right := Get_Default_Value (Inter); end if; return Eval_Ieee_Operation (Expr, Imp, Left, Right); end if; |