diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-09-25 06:35:32 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-09-25 11:43:29 +0200 |
commit | a36fa0b9dd4dc1f3f4c60c1f00a7a883b41dff55 (patch) | |
tree | 38bba51e93c008ea3ec31a5c7410badf9979d6bd /src/synth/synth-vhdl_stmts.adb | |
parent | 2a0e36cd66778ab48fb30e1142ae3adb187e4e46 (diff) | |
download | ghdl-a36fa0b9dd4dc1f3f4c60c1f00a7a883b41dff55.tar.gz ghdl-a36fa0b9dd4dc1f3f4c60c1f00a7a883b41dff55.tar.bz2 ghdl-a36fa0b9dd4dc1f3f4c60c1f00a7a883b41dff55.zip |
synth: handle default expression for IN variables in assocs
Diffstat (limited to 'src/synth/synth-vhdl_stmts.adb')
-rw-r--r-- | src/synth/synth-vhdl_stmts.adb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/synth/synth-vhdl_stmts.adb b/src/synth/synth-vhdl_stmts.adb index 62c4bc777..ac121e292 100644 --- a/src/synth/synth-vhdl_stmts.adb +++ b/src/synth/synth-vhdl_stmts.adb @@ -2003,8 +2003,14 @@ package body Synth.Vhdl_Stmts is Inter_Typ := Get_Subtype_Object (Subprg_Inst, Inter_Type); end if; - if Get_Kind (Inter) = Iir_Kind_Interface_Constant_Declaration then - -- Constants: simply synth the expression + if Get_Kind (Inter) = Iir_Kind_Interface_Constant_Declaration + or else (Get_Kind (Inter) = Iir_Kind_Interface_Variable_Declaration + and then Get_Mode (Inter) = Iir_In_Mode + and then Inter_Typ.Kind < Type_File) + then + -- Constants: simply synth the expression. + -- Same for IN variable interface as the actual may be a default + -- value which is any expression. Val := Synth_Expression_With_Type (Actual_Inst, Actual, Inter_Typ); if Val = No_Valtyp then return Val; @@ -2022,6 +2028,7 @@ package body Synth.Vhdl_Stmts is then Set_Instance_Const (Subprg_Inst, False); end if; + return Val; else -- Actual is a reference. Info := Synth_Target (Caller_Inst, Actual); @@ -2029,8 +2036,7 @@ package body Synth.Vhdl_Stmts is case Iir_Kinds_Interface_Object_Declaration (Get_Kind (Inter)) is when Iir_Kind_Interface_Constant_Declaration => - -- Pass by copy. - return Val; + raise Internal_Error; when Iir_Kind_Interface_Variable_Declaration => -- Always pass by value. if Is_Copyback_Parameter (Inter) then |