aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/sem_stmts.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2015-01-07 08:07:42 +0100
committerTristan Gingold <tgingold@free.fr>2015-01-07 08:07:42 +0100
commit99443212bf78a5d36b693abab225a160a92d097a (patch)
tree9191d2419b376bd45737e3b23e9b95967c017560 /src/vhdl/sem_stmts.adb
parent3aaf2679a61b4d8bd61c7cccd5ca0ec1f1606de5 (diff)
downloadghdl-99443212bf78a5d36b693abab225a160a92d097a.tar.gz
ghdl-99443212bf78a5d36b693abab225a160a92d097a.tar.bz2
ghdl-99443212bf78a5d36b693abab225a160a92d097a.zip
Handle vhdl08 if generate statements
Diffstat (limited to 'src/vhdl/sem_stmts.adb')
-rw-r--r--src/vhdl/sem_stmts.adb41
1 files changed, 27 insertions, 14 deletions
diff --git a/src/vhdl/sem_stmts.adb b/src/vhdl/sem_stmts.adb
index b64e9ac90..ac153f2e6 100644
--- a/src/vhdl/sem_stmts.adb
+++ b/src/vhdl/sem_stmts.adb
@@ -1549,28 +1549,41 @@ package body Sem_Stmts is
procedure Sem_If_Generate_Statement (Stmt : Iir)
is
+ Clause : Iir;
Condition : Iir;
begin
-- LRM93 10.1 Declarative region.
-- 12. A generate statement.
Open_Declarative_Region;
- Condition := Get_Condition (Stmt);
- Condition := Sem_Condition (Condition);
- -- LRM93 9.7
- -- the condition in a generation scheme of the second form must be
- -- a static expression.
- if Condition /= Null_Iir
- and then Get_Expr_Staticness (Condition) < Globally
- then
- Error_Msg_Sem ("condition must be a static expression", Condition);
- else
- Set_Condition (Stmt, Condition);
- end if;
+ Clause := Stmt;
+ while Clause /= Null_Iir loop
+ Condition := Get_Condition (Clause);
+
+ if Condition /= Null_Iir then
+ Condition := Sem_Condition (Condition);
+ -- LRM93 9.7
+ -- the condition in a generation scheme of the second form must be
+ -- a static expression.
+ if Condition /= Null_Iir
+ and then Get_Expr_Staticness (Condition) < Globally
+ then
+ Error_Msg_Sem
+ ("condition must be a static expression", Condition);
+ else
+ Set_Condition (Clause, Condition);
+ end if;
+ else
+ -- No condition for the last 'else' part.
+ pragma Assert (Get_Generate_Else_Clause (Clause) = Null_Iir);
+ null;
+ end if;
- -- In the same declarative region.
- Sem_Generate_Statement_Body (Stmt);
+ -- In the same declarative region.
+ Sem_Generate_Statement_Body (Clause);
+ Clause := Get_Generate_Else_Clause (Clause);
+ end loop;
Close_Declarative_Region;
end Sem_If_Generate_Statement;