diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-08-11 05:49:44 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-08-11 05:49:44 +0200 |
commit | a46b01b05ffe8835d5e16af68e0a5ce441d71c08 (patch) | |
tree | 55dffd3252c10348de0e3509e0e22bb52acd6f8f /src/vhdl/vhdl-canon.adb | |
parent | 184c2eb7f97f412ab6d658271ecacd7b6cae1837 (diff) | |
download | ghdl-a46b01b05ffe8835d5e16af68e0a5ce441d71c08.tar.gz ghdl-a46b01b05ffe8835d5e16af68e0a5ce441d71c08.tar.bz2 ghdl-a46b01b05ffe8835d5e16af68e0a5ce441d71c08.zip |
vhdl: improve reprint of inertial association.
Diffstat (limited to 'src/vhdl/vhdl-canon.adb')
-rw-r--r-- | src/vhdl/vhdl-canon.adb | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/src/vhdl/vhdl-canon.adb b/src/vhdl/vhdl-canon.adb index 6dd40560b..c1cd2d13f 100644 --- a/src/vhdl/vhdl-canon.adb +++ b/src/vhdl/vhdl-canon.adb @@ -232,6 +232,7 @@ package body Vhdl.Canon is when Iir_Kind_Interface_Signal_Declaration | Iir_Kind_Signal_Declaration | Iir_Kind_Guard_Signal_Declaration + | Iir_Kind_Anonymous_Signal_Declaration | Iir_Kinds_Signal_Attribute | Iir_Kind_External_Signal_Name => -- LRM 8.1 @@ -308,7 +309,8 @@ package body Vhdl.Canon is end; when Iir_Kind_Simple_Name - | Iir_Kind_Selected_Name => + | Iir_Kind_Selected_Name + | Iir_Kind_Reference_Name => Canon_Extract_Sensitivity (Get_Named_Entity (Expr), Sensitivity_List, Is_Target); @@ -2799,32 +2801,40 @@ package body Vhdl.Canon is Canon_Expression (Get_Expression (Decl)); end if; -- Create a signal assignment. - declare - Parent : constant Node := Get_Parent (Decl); - Asgn : Iir; - We : Iir; - Name : Iir; - begin - Asgn := Create_Iir - (Iir_Kind_Concurrent_Simple_Signal_Assignment); - Location_Copy (Asgn, Decl); - Set_Parent (Asgn, Parent); - Name := Build_Simple_Name (Decl, Decl); - Set_Type (Name, Get_Type (Decl)); - Set_Target (Asgn, Name); - Set_Delay_Mechanism (Asgn, Iir_Inertial_Delay); - - We := Create_Iir (Iir_Kind_Waveform_Element); - Location_Copy (We, Decl); - Set_We_Value (We, Get_Expression (Decl)); - Set_Expression (Decl, Null_Iir); - - Set_Waveform_Chain (Asgn, We); - - -- Prepend. - Set_Chain (Asgn, Get_Concurrent_Statement_Chain (Parent)); - Set_Concurrent_Statement_Chain (Parent, Asgn); - end; + if Canon_Flag_Associations then + declare + Parent : constant Node := Get_Parent (Decl); + Asgn : Iir; + We : Iir; + Name : Iir; + begin + Asgn := Create_Iir + (Iir_Kind_Concurrent_Simple_Signal_Assignment); + Location_Copy (Asgn, Decl); + Set_Parent (Asgn, Parent); + + Name := Create_Iir (Iir_Kind_Reference_Name); + Location_Copy (Name, Decl); + Set_Referenced_Name (Name, Decl); + Set_Named_Entity (Name, Decl); + Set_Type (Name, Get_Type (Decl)); + Set_Expr_Staticness (Name, None); + + Set_Target (Asgn, Name); + Set_Delay_Mechanism (Asgn, Iir_Inertial_Delay); + + We := Create_Iir (Iir_Kind_Waveform_Element); + Location_Copy (We, Decl); + Set_We_Value (We, Get_Expression (Decl)); + Set_Expression (Decl, Null_Iir); + + Set_Waveform_Chain (Asgn, We); + + -- Prepend. + Set_Chain (Asgn, Get_Concurrent_Statement_Chain (Parent)); + Set_Concurrent_Statement_Chain (Parent, Asgn); + end; + end if; when Iir_Kind_Iterator_Declaration => null; |