diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-06-12 16:46:07 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-06-12 16:46:07 +0200 |
commit | e669d8cc3cdcdb2da21519421a454a4dcab6bc53 (patch) | |
tree | a40502dc8b11b07c642d8c468d7a291b94abf7e5 /src | |
parent | 91c892934daa16cd2b1ba65331346f691d98fd69 (diff) | |
download | ghdl-e669d8cc3cdcdb2da21519421a454a4dcab6bc53.tar.gz ghdl-e669d8cc3cdcdb2da21519421a454a4dcab6bc53.tar.bz2 ghdl-e669d8cc3cdcdb2da21519421a454a4dcab6bc53.zip |
synth-vhdl_insts: handle actual conversion function. Fix #2090
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/synth-vhdl_insts.adb | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/src/synth/synth-vhdl_insts.adb b/src/synth/synth-vhdl_insts.adb index 24190055b..002a387af 100644 --- a/src/synth/synth-vhdl_insts.adb +++ b/src/synth/synth-vhdl_insts.adb @@ -631,6 +631,34 @@ package body Synth.Vhdl_Insts is end if; end Interning_Get; + function Synth_Single_Input_Assoc (Syn_Inst : Synth_Instance_Acc; + Inter_Typ : Type_Acc; + Act_Inst : Synth_Instance_Acc; + Actual : Node; + Assoc : Node) return Valtyp + is + Ctxt : constant Context_Acc := Get_Build (Syn_Inst); + Conv : Node; + Act : Valtyp; + begin + if Get_Kind (Assoc) = Iir_Kind_Association_Element_By_Name then + Conv := Get_Actual_Conversion (Assoc); + else + Conv := Null_Node; + end if; + if Conv /= Null_Node then + pragma Assert (Get_Kind (Conv) = Iir_Kind_Function_Call); + pragma Assert (Act_Inst = Syn_Inst); + -- This is an abuse, but it works like a user operator. + Act := Synth_User_Operator (Syn_Inst, Actual, Null_Node, Conv); + else + Act := Synth_Expression_With_Type (Act_Inst, Actual, Inter_Typ); + end if; + + Act := Synth_Subtype_Conversion (Ctxt, Act, Inter_Typ, False, Assoc); + return Act; + end Synth_Single_Input_Assoc; + procedure Synth_Individual_Prefix (Syn_Inst : Synth_Instance_Acc; Inter_Inst : Synth_Instance_Acc; Formal : Node; @@ -755,7 +783,8 @@ package body Synth.Vhdl_Insts is (Syn_Inst, Inter_Inst, Get_Formal (Iassoc), Off, Typ); -- 2. synth expression - V := Synth_Expression_With_Type (Syn_Inst, Get_Actual (Iassoc), Typ); + V := Synth_Single_Input_Assoc + (Syn_Inst, Typ, Syn_Inst, Get_Actual (Iassoc), Iassoc); -- 3. save in a table Value_Offset_Tables.Append (Els, (Off, V)); @@ -791,28 +820,25 @@ package body Synth.Vhdl_Insts is return Net is Ctxt : constant Context_Acc := Get_Build (Syn_Inst); - Actual : Node; - Act_Inst : Synth_Instance_Acc; - Act : Valtyp; + Res : Valtyp; begin case Iir_Kinds_Association_Element_Parameters (Get_Kind (Assoc)) is when Iir_Kind_Association_Element_Open => - Actual := Get_Default_Value (Inter); - Act_Inst := Inter_Inst; + Res := Synth_Single_Input_Assoc + (Syn_Inst, Inter_Typ, Inter_Inst, + Get_Default_Value (Inter), Assoc); when Iir_Kind_Association_Element_By_Expression | Iir_Kind_Association_Element_By_Name => - Actual := Get_Actual (Assoc); - Act_Inst := Syn_Inst; + Res := Synth_Single_Input_Assoc + (Syn_Inst, Inter_Typ, Syn_Inst, Get_Actual (Assoc), Assoc); when Iir_Kind_Association_Element_By_Individual => return Synth_Individual_Input_Assoc (Syn_Inst, Assoc, Inter_Inst); end case; - Act := Synth_Expression_With_Type (Act_Inst, Actual, Inter_Typ); - Act := Synth_Subtype_Conversion (Ctxt, Act, Inter_Typ, False, Assoc); - if Act = No_Valtyp then + if Res = No_Valtyp then return No_Net; end if; - return Get_Net (Ctxt, Act); + return Get_Net (Ctxt, Res); end Synth_Input_Assoc; procedure Synth_Individual_Output_Assoc (Outp : Net; |