diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-07-15 18:39:57 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-07-15 18:39:57 +0200 |
commit | 4b35c49030a2c4844539be20af3430fe709e9b8e (patch) | |
tree | be02cfe7d415095fc6ed9d7231df05fde7ea86f0 /src/synth/synth-stmts.adb | |
parent | a7ddd4a3ac9e48565dd3a0600358815ecbb5baab (diff) | |
download | ghdl-4b35c49030a2c4844539be20af3430fe709e9b8e.tar.gz ghdl-4b35c49030a2c4844539be20af3430fe709e9b8e.tar.bz2 ghdl-4b35c49030a2c4844539be20af3430fe709e9b8e.zip |
synth: handle choices by range in aggregates.
Diffstat (limited to 'src/synth/synth-stmts.adb')
-rw-r--r-- | src/synth/synth-stmts.adb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb index 056b4a354..8f169a492 100644 --- a/src/synth/synth-stmts.adb +++ b/src/synth/synth-stmts.adb @@ -20,7 +20,6 @@ with Ada.Unchecked_Deallocation; -with Types; use Types; with Grt.Algos; with Areapools; with Vhdl.Errors; use Vhdl.Errors; @@ -899,6 +898,16 @@ package body Synth.Stmts is end case; end In_Range; + procedure Update_Index (Rng : Value_Acc; Idx : in out Int64) is + begin + case Rng.Rng.Dir is + when Iir_To => + Idx := Idx + 1; + when Iir_Downto => + Idx := Idx - 1; + end case; + end Update_Index; + procedure Synth_For_Loop_Statement (Syn_Inst : Synth_Instance_Acc; Stmt : Node) is @@ -920,12 +929,7 @@ package body Synth.Stmts is while In_Range (It_Rng, Val.Scal) loop Synth_Sequential_Statements (Syn_Inst, Stmts); - case It_Rng.Rng.Dir is - when Iir_To => - Val.Scal := Val.Scal + 1; - when Iir_Downto => - Val.Scal := Val.Scal - 1; - end case; + Update_Index (It_Rng, Val.Scal); end loop; Destroy_Object (Syn_Inst, Iterator); if It_Type /= Null_Node then |