diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-11-17 16:15:14 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-11-17 16:15:14 +0100 |
commit | 5c83c8d3fb5cc2304cd5c2e657370c698d90de4e (patch) | |
tree | 42b76eb52fdef935888ee717648b3268a0a9c0fa | |
parent | 99d3462a523a13ca044eec51b11bcff97265b5f6 (diff) | |
download | ghdl-5c83c8d3fb5cc2304cd5c2e657370c698d90de4e.tar.gz ghdl-5c83c8d3fb5cc2304cd5c2e657370c698d90de4e.tar.bz2 ghdl-5c83c8d3fb5cc2304cd5c2e657370c698d90de4e.zip |
synth-stmts: handle return in loop statement.
-rw-r--r-- | src/synth/synth-stmts.adb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb index d7ee4d471..de4bbb7cb 100644 --- a/src/synth/synth-stmts.adb +++ b/src/synth/synth-stmts.adb @@ -1891,6 +1891,7 @@ package body Synth.Stmts is procedure Synth_While_Loop_Statement (C : in out Seq_Context; Stmt : Node) is + Bit0 : constant Net := Get_Inst_Bit0 (C.Inst); Stmts : constant Node := Get_Sequential_Statement_Chain (Stmt); Cond : constant Node := Get_Condition (Stmt); Val : Value_Acc; @@ -1921,14 +1922,22 @@ package body Synth.Stmts is Loop_Control_Update (C); - -- Exit from the loop if W_Exit = 0 + -- Exit from the loop if W_Exit/W_Ret/W_Quit = 0 if Lc.W_Exit /= No_Wire_Id - and then - Get_Current_Value (null, Lc.W_Exit) = Get_Inst_Bit0 (C.Inst) + and then Get_Current_Value (null, Lc.W_Exit) = Bit0 + then + exit; + end if; + if C.W_Ret /= No_Wire_Id + and then Get_Current_Value (null, C.W_Ret) = Bit0 + then + exit; + end if; + if Lc.W_Quit /= No_Wire_Id + and then Get_Current_Value (null, Lc.W_Quit) = Bit0 then exit; end if; - -- FIXME: W_Quit = 0, W_Ret = 0 ?? end loop; Loop_Control_Finish (C); |