aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/elab-vhdl_expr.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-12-27 08:53:00 +0100
committerTristan Gingold <tgingold@free.fr>2022-12-31 13:54:49 +0100
commitb7a9e4b9b5ac2c195da6f3549dd06b5c6e999a0f (patch)
treeab341f364e81544b1445d262708df16300198aa8 /src/synth/elab-vhdl_expr.adb
parentd6343a0bf74d25973c5ed170b8e037b42bd08a7f (diff)
downloadghdl-b7a9e4b9b5ac2c195da6f3549dd06b5c6e999a0f.tar.gz
ghdl-b7a9e4b9b5ac2c195da6f3549dd06b5c6e999a0f.tar.bz2
ghdl-b7a9e4b9b5ac2c195da6f3549dd06b5c6e999a0f.zip
synth: add statement in context, adjust path/instance name attributes
Diffstat (limited to 'src/synth/elab-vhdl_expr.adb')
-rw-r--r--src/synth/elab-vhdl_expr.adb47
1 files changed, 33 insertions, 14 deletions
diff --git a/src/synth/elab-vhdl_expr.adb b/src/synth/elab-vhdl_expr.adb
index d9ad9f27d..86b2e5d24 100644
--- a/src/synth/elab-vhdl_expr.adb
+++ b/src/synth/elab-vhdl_expr.adb
@@ -469,7 +469,7 @@ package body Elab.Vhdl_Expr is
Get_Path_Instance_Name_Suffix (Attr);
Instance, Parent : Synth_Instance_Acc;
Rstr : Rstring;
- Label : Node;
+ Label, Stmt : Node;
begin
if Name.Path_Instance = Null_Iir then
return String_To_Memtyp (Name.Suffix, Str_Typ);
@@ -484,6 +484,7 @@ package body Elab.Vhdl_Expr is
Parent := null;
end if;
Label := Get_Source_Scope (Instance);
+ Stmt := Get_Statement_Scope (Instance);
case Get_Kind (Label) is
when Iir_Kind_Entity_Declaration =>
@@ -508,27 +509,45 @@ package body Elab.Vhdl_Expr is
when Iir_Kind_Block_Statement =>
Prepend (Rstr, Image (Get_Label (Label)));
Prepend (Rstr, ':');
- when Iir_Kind_Iterator_Declaration =>
+ when Iir_Kind_Generate_Statement_Body =>
declare
- Val : Valtyp;
+ Gen : constant Node := Get_Parent (Label);
begin
- Val := Get_Value (Instance, Label);
- Prepend (Rstr, ')');
- Prepend (Rstr,
- Synth_Image_Attribute_Str (Val, Get_Type (Label)));
- Prepend (Rstr, '(');
+ case Iir_Kinds_Generate_Statement (Get_Kind (Gen)) is
+ when Iir_Kind_For_Generate_Statement =>
+ declare
+ It : constant Node :=
+ Get_Parameter_Specification (Gen);
+ Val : Valtyp;
+ begin
+ Val := Get_Value (Instance, It);
+ Prepend (Rstr, ')');
+ Prepend
+ (Rstr,
+ Synth_Image_Attribute_Str (Val, Get_Type (It)));
+ Prepend (Rstr, '(');
+ end;
+
+ -- Skip the for generate instance.
+ Parent := Get_Instance_Parent (Parent);
+
+ when Iir_Kind_If_Generate_Statement
+ | Iir_Kind_Case_Generate_Statement =>
+ null;
+ end case;
+
+ Prepend (Rstr, Image (Get_Label (Gen)));
+ Prepend (Rstr, ':');
end;
- when Iir_Kind_Generate_Statement_Body =>
- Prepend (Rstr, Image (Get_Label (Get_Parent (Label))));
- Prepend (Rstr, ':');
- when Iir_Kind_Component_Instantiation_Statement =>
+
+ when Iir_Kind_Component_Declaration =>
if Is_Instance then
Prepend (Rstr, '@');
end if;
- Prepend (Rstr, Image (Get_Label (Label)));
+ Prepend (Rstr, Image (Get_Label (Stmt)));
Prepend (Rstr, ':');
when others =>
- Error_Kind ("Execute_Path_Instance_Name_Attribute",
+ Error_Kind ("Exec_Path_Instance_Name_Attribute",
Label);
end case;
Instance := Parent;