aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-07-24 08:39:25 +0200
committerTristan Gingold <tgingold@free.fr>2022-07-24 08:39:25 +0200
commite0b9240c683ed70eeabaa7ab8b45069f5dd1ffca (patch)
tree07847b5761572b2650dbfc79edf792a9826de0b4 /src
parent8be816aaeae02d1fe190a39d21260cb9cec29bc5 (diff)
downloadghdl-e0b9240c683ed70eeabaa7ab8b45069f5dd1ffca.tar.gz
ghdl-e0b9240c683ed70eeabaa7ab8b45069f5dd1ffca.tar.bz2
ghdl-e0b9240c683ed70eeabaa7ab8b45069f5dd1ffca.zip
synth: add hook for dot attribute
Diffstat (limited to 'src')
-rw-r--r--src/synth/synth-vhdl_expr.adb12
-rw-r--r--src/synth/synth-vhdl_expr.ads5
-rw-r--r--src/synth/synth-vhdl_stmts.adb7
3 files changed, 17 insertions, 7 deletions
diff --git a/src/synth/synth-vhdl_expr.adb b/src/synth/synth-vhdl_expr.adb
index 073d015b2..e646f6b0b 100644
--- a/src/synth/synth-vhdl_expr.adb
+++ b/src/synth/synth-vhdl_expr.adb
@@ -2220,10 +2220,16 @@ package body Synth.Vhdl_Expr is
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);
+ if Hook_Event_Attribute /= null then
+ return Hook_Event_Attribute (Syn_Inst, Expr);
end if;
- Error_Msg_Synth (+Expr, "signal attributes not allowed");
+ Error_Msg_Synth (+Expr, "event attributes not allowed");
+ return No_Valtyp;
+ when Iir_Kind_Dot_Attribute =>
+ if Hook_Dot_Attribute /= null then
+ return Hook_Dot_Attribute (Syn_Inst, Expr);
+ end if;
+ Error_Msg_Synth (+Expr, "dot attribute not allowed");
return No_Valtyp;
when others =>
Error_Kind ("synth_expression_with_type", Expr);
diff --git a/src/synth/synth-vhdl_expr.ads b/src/synth/synth-vhdl_expr.ads
index 55947627b..90c603280 100644
--- a/src/synth/synth-vhdl_expr.ads
+++ b/src/synth/synth-vhdl_expr.ads
@@ -92,9 +92,10 @@ package Synth.Vhdl_Expr is
Expr_Type : Type_Acc) return Valtyp;
-- For value signal attribute (like 'Event).
- type Hook_Signal_Attribute_Acc is access
+ type Hook_Attribute_Acc is access
function (Syn_Inst : Synth_Instance_Acc; Expr : Node) return Valtyp;
- Hook_Signal_Attribute : Hook_Signal_Attribute_Acc;
+ Hook_Event_Attribute : Hook_Attribute_Acc;
+ Hook_Dot_Attribute : Hook_Attribute_Acc;
-- Use base type of EXPR to synthesize EXPR. Useful when the type of
-- EXPR is defined by itself or a range.
diff --git a/src/synth/synth-vhdl_stmts.adb b/src/synth/synth-vhdl_stmts.adb
index 7d0c0b805..05f6ef8fd 100644
--- a/src/synth/synth-vhdl_stmts.adb
+++ b/src/synth/synth-vhdl_stmts.adb
@@ -118,7 +118,9 @@ package body Synth.Vhdl_Stmts is
| Iir_Kind_File_Declaration
| Iir_Kind_Interface_File_Declaration
| Iir_Kind_Non_Object_Alias_Declaration
- | Iir_Kind_Object_Alias_Declaration =>
+ | Iir_Kind_Object_Alias_Declaration
+ | Iir_Kind_Free_Quantity_Declaration
+ | Iir_Kind_Dot_Attribute =>
declare
Targ : constant Valtyp := Get_Value (Syn_Inst, Pfx);
begin
@@ -344,7 +346,8 @@ package body Synth.Vhdl_Stmts is
| Iir_Kind_Object_Alias_Declaration
| Iir_Kind_Indexed_Name
| Iir_Kind_Slice_Name
- | Iir_Kind_Dereference =>
+ | Iir_Kind_Dereference
+ | Iir_Kind_Dot_Attribute =>
declare
Base : Valtyp;
Typ : Type_Acc;