diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-01-12 18:45:24 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-01-12 18:45:24 +0100 |
commit | 42ff36a81d8ce42cb2fb3f2edbc628447e58ee92 (patch) | |
tree | 0f300762a7605c0a76e63d87a95a8da7bcaf623b /src/synth | |
parent | 768c62a76be455d299a065e5516fb8b7a917c019 (diff) | |
download | ghdl-42ff36a81d8ce42cb2fb3f2edbc628447e58ee92.tar.gz ghdl-42ff36a81d8ce42cb2fb3f2edbc628447e58ee92.tar.bz2 ghdl-42ff36a81d8ce42cb2fb3f2edbc628447e58ee92.zip |
synth: handle protected functions in conversion functions
Diffstat (limited to 'src/synth')
-rw-r--r-- | src/synth/synth-vhdl_stmts.adb | 19 | ||||
-rw-r--r-- | src/synth/synth-vhdl_stmts.ads | 3 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/synth/synth-vhdl_stmts.adb b/src/synth/synth-vhdl_stmts.adb index 3ae37e2e9..0cd3dc85b 100644 --- a/src/synth/synth-vhdl_stmts.adb +++ b/src/synth/synth-vhdl_stmts.adb @@ -2288,10 +2288,11 @@ package body Synth.Vhdl_Stmts is when Iir_Kind_Function_Call => declare Imp : constant Node := Get_Implementation (Func); + Obj : constant Node := Get_Method_Object (Func); Mt : Memtyp; begin if Get_Implicit_Definition (Imp) = Iir_Predefined_None then - Res := Exec_Resolution_Call (Inst, Imp, Val); + Res := Exec_Resolution_Call (Inst, Imp, Obj, Val); else Mt := Synth.Vhdl_Eval.Eval_Static_Predefined_Function_Call (Inst, Get_Memtyp (Val), Null_Memtyp, Res_Typ, Func); @@ -2802,16 +2803,22 @@ package body Synth.Vhdl_Stmts is end Synth_Procedure_Call; function Exec_Resolution_Call (Syn_Inst : Synth_Instance_Acc; - Func : Node; + Imp : Node; + Obj : Node; Arg : Valtyp) return Valtyp is - Bod : constant Node := Vhdl.Sem_Inst.Get_Subprogram_Body_Origin (Func); - Inter : constant Node := Get_Interface_Declaration_Chain (Func); + Bod : constant Node := Vhdl.Sem_Inst.Get_Subprogram_Body_Origin (Imp); + Inter : constant Node := Get_Interface_Declaration_Chain (Imp); Init : Association_Iterator_Init; Res : Valtyp; Sub_Inst : Synth_Instance_Acc; begin - Sub_Inst := Synth_Subprogram_Call_Instance (Syn_Inst, Func, Bod); + if Obj /= Null_Node then + Sub_Inst := Synth_Protected_Call_Instance (Syn_Inst, Obj, Imp, Bod); + else + Sub_Inst := Synth_Subprogram_Call_Instance (Syn_Inst, Imp, Bod); + end if; + Set_Instance_Const (Sub_Inst, True); Create_Object (Sub_Inst, Inter, Arg); @@ -2819,7 +2826,7 @@ package body Synth.Vhdl_Stmts is Init := Association_Iterator_Build (Inter, Null_Node); Res := Synth_Static_Subprogram_Call - (Syn_Inst, Sub_Inst, Func, Bod, Init, Func); + (Syn_Inst, Sub_Inst, Imp, Bod, Init, Imp); Free_Instance (Sub_Inst); diff --git a/src/synth/synth-vhdl_stmts.ads b/src/synth/synth-vhdl_stmts.ads index 8b1687795..b6cc72fce 100644 --- a/src/synth/synth-vhdl_stmts.ads +++ b/src/synth/synth-vhdl_stmts.ads @@ -155,7 +155,8 @@ package Synth.Vhdl_Stmts is -- For simulation. function Exec_Resolution_Call (Syn_Inst : Synth_Instance_Acc; - Func : Node; + Imp : Node; + Obj : Node; Arg : Valtyp) return Valtyp; -- Return the associated choice from CHOICES chain selected by SEL. |