diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-10-25 19:12:52 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-10-25 19:12:52 +0200 |
commit | 228ecae333b834be930b06ea2569de79fd70b5fe (patch) | |
tree | b953d61621b71ae4a2dbc610fabd9dc13c2b3ac6 | |
parent | 889b76e9f1ada504202797118c2dfaf574093843 (diff) | |
download | ghdl-228ecae333b834be930b06ea2569de79fd70b5fe.tar.gz ghdl-228ecae333b834be930b06ea2569de79fd70b5fe.tar.bz2 ghdl-228ecae333b834be930b06ea2569de79fd70b5fe.zip |
vhdl-canon: extract canon_concurrent_label.
-rw-r--r-- | src/vhdl/vhdl-canon.adb | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/src/vhdl/vhdl-canon.adb b/src/vhdl/vhdl-canon.adb index 46e982915..e34731f41 100644 --- a/src/vhdl/vhdl-canon.adb +++ b/src/vhdl/vhdl-canon.adb @@ -1898,6 +1898,30 @@ package body Vhdl.Canon is return Proc; end Canon_Concurrent_Assertion_Statement; + procedure Canon_Concurrent_Label (Stmt : Iir; Proc_Num : in out Natural) is + begin + -- Add a label if required. + if Canon_Flag_Add_Labels then + case Get_Kind (Stmt) is + when Iir_Kind_Psl_Declaration + | Iir_Kind_Psl_Endpoint_Declaration => + null; + when others => + if Get_Label (Stmt) = Null_Identifier then + declare + Str : String := Natural'Image (Proc_Num); + begin + -- Note: the label starts with a capitalized letter, + -- to avoid any clash with user's identifiers. + Str (1) := 'P'; + Set_Label (Stmt, Name_Table.Get_Identifier (Str)); + end; + Proc_Num := Proc_Num + 1; + end if; + end case; + end if; + end Canon_Concurrent_Label; + procedure Canon_Concurrent_Stmts (Top : Iir_Design_Unit; Parent : Iir) is -- Current element in the chain of concurrent statements. @@ -1925,26 +1949,7 @@ package body Vhdl.Canon is Prev_El := Null_Iir; El := Get_Concurrent_Statement_Chain (Parent); while El /= Null_Iir loop - -- Add a label if required. - if Canon_Flag_Add_Labels then - case Get_Kind (El) is - when Iir_Kind_Psl_Declaration - | Iir_Kind_Psl_Endpoint_Declaration => - null; - when others => - if Get_Label (El) = Null_Identifier then - declare - Str : String := Natural'Image (Proc_Num); - begin - -- Note: the label starts with a capitalized letter, - -- to avoid any clash with user's identifiers. - Str (1) := 'P'; - Set_Label (El, Name_Table.Get_Identifier (Str)); - end; - Proc_Num := Proc_Num + 1; - end if; - end case; - end if; + Canon_Concurrent_Label (El, Proc_Num); case Get_Kind (El) is when Iir_Kind_Concurrent_Simple_Signal_Assignment => |