From 99443212bf78a5d36b693abab225a160a92d097a Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 7 Jan 2015 08:07:42 +0100 Subject: Handle vhdl08 if generate statements --- src/vhdl/canon.adb | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/vhdl/canon.adb') diff --git a/src/vhdl/canon.adb b/src/vhdl/canon.adb index ad80719..c414740 100644 --- a/src/vhdl/canon.adb +++ b/src/vhdl/canon.adb @@ -1662,19 +1662,38 @@ package body Canon is when Iir_Kind_If_Generate_Statement => declare Clause : Iir; + Bod : Iir; Cond : Iir; + Alt_Num : Natural; begin Clause := El; + Alt_Num := 1; while Clause /= Null_Iir loop + Bod := Get_Generate_Statement_Body (Clause); + if Canon_Flag_Add_Labels + and then Get_Alternative_Label (Bod) = Null_Identifier + then + declare + Str : String := Natural'Image (Alt_Num); + begin + -- Note: the label starts with a capitalized + -- letter, to avoid any clash with user's + -- identifiers. + Str (1) := 'B'; + Set_Alternative_Label + (Bod, Name_Table.Get_Identifier (Str)); + end; + end if; + if Canon_Flag_Expressions then Cond := Get_Condition (El); if Cond /= Null_Iir then Canon_Expression (Cond); end if; end if; - Canon_Generate_Statement_Body - (Top, Get_Generate_Statement_Body (Clause)); + Canon_Generate_Statement_Body (Top, Bod); Clause := Get_Generate_Else_Clause (Clause); + Alt_Num := Alt_Num + 1; end loop; end; -- cgit