diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-10-29 16:04:10 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-10-29 16:04:10 +0200 |
commit | a5b01b014c91473ec1829d86662f72a5c6199bff (patch) | |
tree | d12ffd716c6026c1cae0bcdc3d711d0fad44b67a /src/synth/synth-vhdl_oper.adb | |
parent | 98f5c0a02f08b912a33923d5383f6d22ff00d3ca (diff) | |
download | ghdl-a5b01b014c91473ec1829d86662f72a5c6199bff.tar.gz ghdl-a5b01b014c91473ec1829d86662f72a5c6199bff.tar.bz2 ghdl-a5b01b014c91473ec1829d86662f72a5c6199bff.zip |
synth: internal refactoring
use memtyp for eval_static_predefined_function_call
Diffstat (limited to 'src/synth/synth-vhdl_oper.adb')
-rw-r--r-- | src/synth/synth-vhdl_oper.adb | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/synth/synth-vhdl_oper.adb b/src/synth/synth-vhdl_oper.adb index dfd4daf76..89b427e55 100644 --- a/src/synth/synth-vhdl_oper.adb +++ b/src/synth/synth-vhdl_oper.adb @@ -35,6 +35,7 @@ with Netlists.Utils; with Elab.Memtype; use Elab.Memtype; with Elab.Vhdl_Types; use Elab.Vhdl_Types; with Elab.Vhdl_Expr; use Elab.Vhdl_Expr; +with Elab.Vhdl_Files; with Synth.Errors; use Synth.Errors; with Synth.Vhdl_Stmts; use Synth.Vhdl_Stmts; @@ -1957,6 +1958,18 @@ package body Synth.Vhdl_Oper is end if; case Def is + when Iir_Predefined_Endfile => + declare + Res : Boolean; + begin + Res := Elab.Vhdl_Files.Endfile (L.Val.File, Expr); + return Create_Value_Memtyp + (Create_Memory_U8 (Boolean'Pos (Res), Boolean_Type)); + exception + when Elab.Vhdl_Files.File_Execution_Error => + return No_Valtyp; + end; + when Iir_Predefined_Integer_Minimum => return Synth_Minmax (Ctxt, L, R, Res_Typ, Id_Slt, Expr); when Iir_Predefined_Integer_Maximum => @@ -2249,25 +2262,27 @@ package body Synth.Vhdl_Oper is if Static then declare - Param1 : Valtyp; - Param2 : Valtyp; + Param : Valtyp; + Param1, Param2 : Memtyp; Res_Typ : Type_Acc; Mt : Memtyp; begin Inter := Inter_Chain; if Inter /= Null_Node then - Param1 := Get_Value (Subprg_Inst, Inter); - Strip_Const (Param1); + Param := Get_Value (Subprg_Inst, Inter); + Strip_Const (Param); + Param1 := Get_Memtyp (Param); Inter := Get_Chain (Inter); else - Param1 := No_Valtyp; + Param1 := Null_Memtyp; end if; if Inter /= Null_Node then - Param2 := Get_Value (Subprg_Inst, Inter); - Strip_Const (Param2); + Param := Get_Value (Subprg_Inst, Inter); + Strip_Const (Param); + Param2 := Get_Memtyp (Param); Inter := Get_Chain (Inter); else - Param2 := No_Valtyp; + Param2 := Null_Memtyp; end if; Res_Typ := Get_Subtype_Object (Subprg_Inst, Get_Type (Imp)); |