aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-vhdl_expr.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-01-11 18:20:53 +0100
committerTristan Gingold <tgingold@free.fr>2023-01-11 18:20:53 +0100
commit9cbd04885b4c21c980c78c1eef1a6608c3728877 (patch)
treea0ad27477ba6b87c75fbe7e16fa5f9fe04c9449c /src/synth/synth-vhdl_expr.adb
parent707e6f42362fa30b5af6090cc68f8e94fe61925a (diff)
downloadghdl-9cbd04885b4c21c980c78c1eef1a6608c3728877.tar.gz
ghdl-9cbd04885b4c21c980c78c1eef1a6608c3728877.tar.bz2
ghdl-9cbd04885b4c21c980c78c1eef1a6608c3728877.zip
synth: handle entity attributes
Diffstat (limited to 'src/synth/synth-vhdl_expr.adb')
-rw-r--r--src/synth/synth-vhdl_expr.adb20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/synth/synth-vhdl_expr.adb b/src/synth/synth-vhdl_expr.adb
index 21bf95b18..ec0cd28bb 100644
--- a/src/synth/synth-vhdl_expr.adb
+++ b/src/synth/synth-vhdl_expr.adb
@@ -759,9 +759,25 @@ package body Synth.Vhdl_Expr is
| Iir_Kind_Object_Alias_Declaration
| Iir_Kind_Non_Object_Alias_Declaration
| Iir_Kind_File_Declaration
- | Iir_Kind_Interface_File_Declaration
- | Iir_Kind_Attribute_Value =>
+ | Iir_Kind_Interface_File_Declaration =>
return Get_Value (Syn_Inst, Name);
+ when Iir_Kind_Attribute_Value =>
+ -- It's a little bit complex for attribute of an entity or
+ -- of an architecture as there might be no instances for them.
+ -- Simply recompute it in that case; the expression is locally
+ -- static.
+ case Get_Kind (Get_Designated_Entity (Name)) is
+ when Iir_Kind_Entity_Declaration
+ | Iir_Kind_Architecture_Body =>
+ declare
+ Spec : constant Node :=
+ Get_Attribute_Specification (Name);
+ begin
+ return Synth_Expression (Syn_Inst, Get_Expression (Spec));
+ end;
+ when others =>
+ return Get_Value (Syn_Inst, Name);
+ end case;
when Iir_Kind_Enumeration_Literal =>
declare
Typ : constant Type_Acc :=