diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-10-19 07:46:44 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-10-19 08:02:58 +0200 |
commit | eb0ae738e7fbf3301b2a492e5fbabca3c3bdda50 (patch) | |
tree | 8f66d33831d60b1b084fe64adb410b1c8744cef7 /src | |
parent | 5cbfa82ebe90ac1016899c9cbecbaf07daa7e588 (diff) | |
download | ghdl-eb0ae738e7fbf3301b2a492e5fbabca3c3bdda50.tar.gz ghdl-eb0ae738e7fbf3301b2a492e5fbabca3c3bdda50.tar.bz2 ghdl-eb0ae738e7fbf3301b2a492e5fbabca3c3bdda50.zip |
synth: handle copyback associations in any order.
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/elab-vhdl_annotations.adb | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/src/synth/elab-vhdl_annotations.adb b/src/synth/elab-vhdl_annotations.adb index 666e24ed4..296b3daff 100644 --- a/src/synth/elab-vhdl_annotations.adb +++ b/src/synth/elab-vhdl_annotations.adb @@ -24,6 +24,8 @@ with Vhdl.Std_Package; with Vhdl.Errors; use Vhdl.Errors; with Vhdl.Utils; use Vhdl.Utils; +with Elab.Vhdl_Utils; + package body Elab.Vhdl_Annotations is procedure Annotate_Declaration_List (Block_Info: Sim_Info_Acc; Decl_Chain: Iir); @@ -715,24 +717,40 @@ package body Elab.Vhdl_Annotations is procedure Annotate_Procedure_Call_Statement (Block_Info : Sim_Info_Acc; Stmt : Iir) is + use Elab.Vhdl_Utils; Call : constant Iir := Get_Procedure_Call (Stmt); Imp : constant Iir := Get_Implementation (Call); - Assoc_Chain : constant Iir := Get_Parameter_Association_Chain (Call); - Inter_Chain : constant Iir := Get_Interface_Declaration_Chain (Imp); + Init : Association_Iterator_Init; + It : Association_Iterator; Assoc : Iir; - Assoc_Inter : Iir; Inter : Iir; begin - Assoc := Assoc_Chain; - Assoc_Inter := Inter_Chain; - while Assoc /= Null_Iir loop - Inter := Get_Association_Interface (Assoc, Assoc_Inter); - if Get_Kind (Assoc) /= Iir_Kind_Association_Element_By_Individual - and then Is_Copyback_Parameter (Inter) - then - Create_Object_Info (Block_Info, Assoc, Kind_Object); + Init := Association_Iterator_Build + (Get_Interface_Declaration_Chain (Imp), + Get_Parameter_Association_Chain (Call)); + + -- Need to use iterators so that associations are processed in the + -- order of the interfaces. + Association_Iterate_Init (It, Init); + Association_Iterate_Next (It, Inter, Assoc); + while Inter /= Null_Node loop + if Assoc /= Null_Node then + if Get_Kind (Assoc) = Iir_Kind_Association_Element_By_Expression + and then Is_Copyback_Parameter (Inter) + then + Create_Object_Info (Block_Info, Assoc, Kind_Object); + end if; + if Get_Kind (Assoc) = Iir_Kind_Association_Element_By_Individual + or else not Get_Whole_Association_Flag (Assoc) + then + -- Annotate each individual associations. + Assoc := Get_Chain (Assoc); + else + Association_Iterate_Next (It, Inter, Assoc); + end if; + else + Association_Iterate_Next (It, Inter, Assoc); end if; - Next_Association_Interface (Assoc, Assoc_Inter); end loop; end Annotate_Procedure_Call_Statement; |