diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-06-08 08:02:45 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-06-08 08:02:45 +0200 |
commit | d9304b2876aca4e86f7ee92dbd37943e0e5b1acf (patch) | |
tree | ffe0150c46e7d0697cbded1553944ade911cebb6 /src | |
parent | 2cbd8b03df33d1d0c2201df51ea67206a66c0ce5 (diff) | |
download | ghdl-d9304b2876aca4e86f7ee92dbd37943e0e5b1acf.tar.gz ghdl-d9304b2876aca4e86f7ee92dbd37943e0e5b1acf.tar.bz2 ghdl-d9304b2876aca4e86f7ee92dbd37943e0e5b1acf.zip |
synth-vhdl_expr: add an hook for signal attributes
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/synth-vhdl_expr.adb | 6 | ||||
-rw-r--r-- | src/synth/synth-vhdl_expr.ads | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/synth/synth-vhdl_expr.adb b/src/synth/synth-vhdl_expr.adb index ff44a926d..5b5034986 100644 --- a/src/synth/synth-vhdl_expr.adb +++ b/src/synth/synth-vhdl_expr.adb @@ -2208,6 +2208,12 @@ package body Synth.Vhdl_Expr is when Iir_Kind_Overflow_Literal => Error_Msg_Synth (+Expr, "out of bound expression"); return No_Valtyp; + when Iir_Kind_Event_Attribute => + if Hook_Signal_Attribute /= null then + return Hook_Signal_Attribute (Syn_Inst, Expr); + end if; + Error_Msg_Synth (+Expr, "signal attributes not allowed"); + return No_Valtyp; when others => Error_Kind ("synth_expression_with_type", Expr); end case; diff --git a/src/synth/synth-vhdl_expr.ads b/src/synth/synth-vhdl_expr.ads index 8f1edd5f3..5c81701c1 100644 --- a/src/synth/synth-vhdl_expr.ads +++ b/src/synth/synth-vhdl_expr.ads @@ -90,6 +90,11 @@ package Synth.Vhdl_Expr is Expr : Node; Expr_Type : Type_Acc) return Valtyp; + -- For value signal attribute (like 'Event). + type Hook_Signal_Attribute_Acc is access + function (Syn_Inst : Synth_Instance_Acc; Expr : Node) return Valtyp; + Hook_Signal_Attribute : Hook_Signal_Attribute_Acc; + -- Use base type of EXPR to synthesize EXPR. Useful when the type of -- EXPR is defined by itself or a range. function Synth_Expression_With_Basetype (Syn_Inst : Synth_Instance_Acc; |