From bb384c6f0653a3d9494f694d5205b94b7c75899e Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 22 May 2022 21:42:51 +0200 Subject: synth-vhdl_oper: add an hook for rising_edge --- src/synth/synth-vhdl_eval.adb | 8 ++++---- src/synth/synth-vhdl_oper.adb | 4 ++++ src/synth/synth-vhdl_oper.ads | 5 +++++ 3 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/synth') diff --git a/src/synth/synth-vhdl_eval.adb b/src/synth/synth-vhdl_eval.adb index 590ab9900..86502a549 100644 --- a/src/synth/synth-vhdl_eval.adb +++ b/src/synth/synth-vhdl_eval.adb @@ -1050,10 +1050,10 @@ package body Synth.Vhdl_Eval is return Create_Memory_Fp64 (Atan (Read_Fp64 (Param1)), Res_Typ); end; when others => - Error_Msg_Synth - (+Expr, "unhandled (static) function: " - & Iir_Predefined_Functions'Image (Def)); - return Null_Memtyp; + null; end case; + Error_Msg_Synth (+Expr, "unhandled (static) function: " + & Iir_Predefined_Functions'Image (Def)); + return Null_Memtyp; end Eval_Static_Predefined_Function_Call; end Synth.Vhdl_Eval; diff --git a/src/synth/synth-vhdl_oper.adb b/src/synth/synth-vhdl_oper.adb index 9a0415a0e..6f6857418 100644 --- a/src/synth/synth-vhdl_oper.adb +++ b/src/synth/synth-vhdl_oper.adb @@ -1915,6 +1915,10 @@ package body Synth.Vhdl_Oper is case Def is when Iir_Predefined_Ieee_1164_Rising_Edge => + if Hook_Std_Rising_Edge /= null then + return Create_Value_Memtyp + (Hook_Std_Rising_Edge.all (L, Res_Typ)); + end if; declare Edge : Net; begin diff --git a/src/synth/synth-vhdl_oper.ads b/src/synth/synth-vhdl_oper.ads index 3ae73df3d..975244022 100644 --- a/src/synth/synth-vhdl_oper.ads +++ b/src/synth/synth-vhdl_oper.ads @@ -43,4 +43,9 @@ package Synth.Vhdl_Oper is (Syn_Inst : Synth_Instance_Acc; Atype : Iir; Len : Iir_Index32) return Bound_Type; + + type Eval_Predefined_Acc is access + function (Param : Valtyp; Res_Typ : Type_Acc) return Memtyp; + + Hook_Std_Rising_Edge : Eval_Predefined_Acc; end Synth.Vhdl_Oper; -- cgit v1.2.3