diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-04-26 07:05:29 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-04-26 07:05:29 +0200 |
commit | 3d36abb3be72ade207ec63982098a1f40d59428e (patch) | |
tree | 39a1b61477b2f449f508377f710837a1ff89879a /src | |
parent | e1d25901fe6fab3212377235964e1a7f0fe73010 (diff) | |
download | ghdl-3d36abb3be72ade207ec63982098a1f40d59428e.tar.gz ghdl-3d36abb3be72ade207ec63982098a1f40d59428e.tar.bz2 ghdl-3d36abb3be72ade207ec63982098a1f40d59428e.zip |
synth-static_oper: fully remove dependency on synth_instance
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/synth-static_oper.adb | 31 | ||||
-rw-r--r-- | src/synth/synth-static_oper.ads | 9 | ||||
-rw-r--r-- | src/synth/synth-vhdl_oper.adb | 43 |
3 files changed, 44 insertions, 39 deletions
diff --git a/src/synth/synth-static_oper.adb b/src/synth/synth-static_oper.adb index 0a1545da8..6d07c1087 100644 --- a/src/synth/synth-static_oper.adb +++ b/src/synth/synth-static_oper.adb @@ -23,7 +23,6 @@ with Grt.Types; use Grt.Types; with Vhdl.Ieee.Std_Logic_1164; use Vhdl.Ieee.Std_Logic_1164; -with Elab.Vhdl_Values; use Elab.Vhdl_Values; with Elab.Memtype; use Elab.Memtype; with Elab.Vhdl_Files; with Elab.Vhdl_Expr; use Elab.Vhdl_Expr; @@ -821,36 +820,15 @@ package body Synth.Static_Oper is return To_Int64 (Res); end Eval_Signed_To_Integer; - function Synth_Static_Predefined_Function_Call - (Subprg_Inst : Synth_Instance_Acc; Expr : Node) return Memtyp + function Synth_Static_Predefined_Function_Call (Param1 : Valtyp; + Param2 : Valtyp; + Res_Typ : Type_Acc; + Expr : Node) return Memtyp is Imp : constant Node := Get_Implementation (Expr); Def : constant Iir_Predefined_Functions := Get_Implicit_Definition (Imp); - Inter_Chain : constant Node := Get_Interface_Declaration_Chain (Imp); - Param1 : Valtyp; - Param2 : Valtyp; - Res_Typ : Type_Acc; - Inter : Node; begin - Inter := Inter_Chain; - if Inter /= Null_Node then - Param1 := Get_Value (Subprg_Inst, Inter); - Strip_Const (Param1); - Inter := Get_Chain (Inter); - else - Param1 := No_Valtyp; - end if; - if Inter /= Null_Node then - Param2 := Get_Value (Subprg_Inst, Inter); - Strip_Const (Param2); - Inter := Get_Chain (Inter); - else - Param2 := No_Valtyp; - end if; - - Res_Typ := Get_Subtype_Object (Subprg_Inst, Get_Type (Imp)); - case Def is when Iir_Predefined_Endfile => declare @@ -1044,5 +1022,4 @@ package body Synth.Static_Oper is return Null_Memtyp; end case; end Synth_Static_Predefined_Function_Call; - end Synth.Static_Oper; diff --git a/src/synth/synth-static_oper.ads b/src/synth/synth-static_oper.ads index bb27b1e79..43502c105 100644 --- a/src/synth/synth-static_oper.ads +++ b/src/synth/synth-static_oper.ads @@ -16,8 +16,8 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <gnu.org/licenses>. -with Elab.Vhdl_Context; use Elab.Vhdl_Context; with Elab.Vhdl_Objtypes; use Elab.Vhdl_Objtypes; +with Elab.Vhdl_Values; use Elab.Vhdl_Values; with Vhdl.Nodes; use Vhdl.Nodes; @@ -32,7 +32,8 @@ package Synth.Static_Oper is Oper_Typ : Type_Acc; Expr : Node) return Memtyp; - function Synth_Static_Predefined_Function_Call - (Subprg_Inst : Synth_Instance_Acc; Expr : Node) return Memtyp; - + function Synth_Static_Predefined_Function_Call (Param1 : Valtyp; + Param2 : Valtyp; + Res_Typ : Type_Acc; + Expr : Node) return Memtyp; end Synth.Static_Oper; diff --git a/src/synth/synth-vhdl_oper.adb b/src/synth/synth-vhdl_oper.adb index 7f995cbb2..53387cd6b 100644 --- a/src/synth/synth-vhdl_oper.adb +++ b/src/synth/synth-vhdl_oper.adb @@ -2136,8 +2136,8 @@ package body Synth.Vhdl_Oper is Subprg_Inst : Synth_Instance_Acc; M : Areapools.Mark_Type; Static : Boolean; + Param : Valtyp; Res : Valtyp; - Mt : Memtyp; begin Areapools.Mark (M, Instance_Pool.all); Subprg_Inst := Make_Instance (Syn_Inst, Imp); @@ -2152,7 +2152,8 @@ package body Synth.Vhdl_Oper is Static := True; Inter := Inter_Chain; while Inter /= Null_Node loop - if not Is_Static (Get_Value (Subprg_Inst, Inter).Val) then + Param := Get_Value (Subprg_Inst, Inter); + if not Is_Static (Param.Val) then Static := False; exit; end if; @@ -2160,12 +2161,38 @@ package body Synth.Vhdl_Oper is end loop; if Static then - Mt := Synth_Static_Predefined_Function_Call (Subprg_Inst, Expr); - if Mt /= Null_Memtyp then - Res := Create_Value_Memtyp (Mt); - else - Res := No_Valtyp; - end if; + declare + Param1 : Valtyp; + Param2 : Valtyp; + Res_Typ : Type_Acc; + Mt : Memtyp; + begin + Inter := Inter_Chain; + if Inter /= Null_Node then + Param1 := Get_Value (Subprg_Inst, Inter); + Strip_Const (Param1); + Inter := Get_Chain (Inter); + else + Param1 := No_Valtyp; + end if; + if Inter /= Null_Node then + Param2 := Get_Value (Subprg_Inst, Inter); + Strip_Const (Param2); + Inter := Get_Chain (Inter); + else + Param2 := No_Valtyp; + end if; + + Res_Typ := Get_Subtype_Object (Subprg_Inst, Get_Type (Imp)); + + Mt := Synth_Static_Predefined_Function_Call + (Param1, Param2, Res_Typ, Expr); + if Mt /= Null_Memtyp then + Res := Create_Value_Memtyp (Mt); + else + Res := No_Valtyp; + end if; + end; else Res := Synth_Dynamic_Predefined_Function_Call (Subprg_Inst, Expr); end if; |