summaryrefslogtreecommitdiff
path: root/src/vhdl/canon.adb
diff options
context:
space:
mode:
authorTristan Gingold2015-01-07 08:07:42 +0100
committerTristan Gingold2015-01-07 08:07:42 +0100
commit99443212bf78a5d36b693abab225a160a92d097a (patch)
tree9191d2419b376bd45737e3b23e9b95967c017560 /src/vhdl/canon.adb
parent3aaf2679a61b4d8bd61c7cccd5ca0ec1f1606de5 (diff)
downloadghdl-99443212bf78a5d36b693abab225a160a92d097a.tar.gz
ghdl-99443212bf78a5d36b693abab225a160a92d097a.tar.bz2
ghdl-99443212bf78a5d36b693abab225a160a92d097a.zip
Handle vhdl08 if generate statements
Diffstat (limited to 'src/vhdl/canon.adb')
-rw-r--r--src/vhdl/canon.adb23
1 files changed, 21 insertions, 2 deletions
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;