diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-07-20 19:45:28 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-07-20 20:40:59 +0200 |
commit | 643d03ef4d0e479d8ba45b69aa1d5be5be71dbff (patch) | |
tree | e26527a46c258a0b427cf7d9961d219766be37be /src | |
parent | 4aeedde7cb7935df8c4f57494c2675b9e32dd424 (diff) | |
download | ghdl-643d03ef4d0e479d8ba45b69aa1d5be5be71dbff.tar.gz ghdl-643d03ef4d0e479d8ba45b69aa1d5be5be71dbff.tar.bz2 ghdl-643d03ef4d0e479d8ba45b69aa1d5be5be71dbff.zip |
synth-vhdl_expr: add hook for quantities
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/synth-vhdl_expr.adb | 33 | ||||
-rw-r--r-- | src/synth/synth-vhdl_expr.ads | 1 |
2 files changed, 23 insertions, 11 deletions
diff --git a/src/synth/synth-vhdl_expr.adb b/src/synth/synth-vhdl_expr.adb index f4cea4eaf..073d015b2 100644 --- a/src/synth/synth-vhdl_expr.adb +++ b/src/synth/synth-vhdl_expr.adb @@ -684,6 +684,7 @@ package body Synth.Vhdl_Expr is | Iir_Kind_Interface_Constant_Declaration | Iir_Kind_Constant_Declaration | Iir_Kind_Iterator_Declaration + | Iir_Kind_Free_Quantity_Declaration | Iir_Kind_Object_Alias_Declaration | Iir_Kind_Non_Object_Alias_Declaration | Iir_Kind_File_Declaration @@ -1942,18 +1943,28 @@ package body Synth.Vhdl_Expr is Res : Valtyp; begin Res := Synth_Name (Syn_Inst, Expr); - if Res.Val /= null - and then - (Res.Val.Kind = Value_Signal - or else (Res.Val.Kind = Value_Alias - and then Res.Val.A_Obj.Kind = Value_Signal)) - then - if Hook_Signal_Expr /= null then - return Hook_Signal_Expr (Res); + if Res.Val /= null then + if (Res.Val.Kind = Value_Signal + or else (Res.Val.Kind = Value_Alias + and then Res.Val.A_Obj.Kind = Value_Signal)) + then + if Hook_Signal_Expr /= null then + return Hook_Signal_Expr (Res); + end if; + Error_Msg_Synth + (+Expr, "cannot use signal value during elaboration"); + return No_Valtyp; + elsif (Res.Val.Kind = Value_Quantity + or else + (Res.Val.Kind = Value_Alias + and then Res.Val.A_Obj.Kind = Value_Quantity)) + then + if Hook_Quantity_Expr /= null then + return Hook_Quantity_Expr (Res); + end if; + Error_Msg_Synth (+Expr, "cannot use quantity value"); + return No_Valtyp; end if; - Error_Msg_Synth - (+Expr, "cannot use signal value during elaboration"); - return No_Valtyp; end if; if Res.Typ /= null and then Res.Typ.W = 0 and then Res.Val.Kind /= Value_Memory diff --git a/src/synth/synth-vhdl_expr.ads b/src/synth/synth-vhdl_expr.ads index 5eadb879f..55947627b 100644 --- a/src/synth/synth-vhdl_expr.ads +++ b/src/synth/synth-vhdl_expr.ads @@ -77,6 +77,7 @@ package Synth.Vhdl_Expr is -- elaboration). type Hook_Signal_Expr_Acc is access function (Val : Valtyp) return Valtyp; Hook_Signal_Expr : Hook_Signal_Expr_Acc; + Hook_Quantity_Expr : Hook_Signal_Expr_Acc; -- Synthesize EXPR. The expression must be self-constrained. -- If EN is not No_Net, the execution is controlled by EN. This is used |