From 121b6579b633d814e27980e1c48c46582276885e Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 24 Jul 2019 08:29:35 +0200 Subject: synth: fix bad ordering in case statement. --- src/synth/synth-stmts.adb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb index d4a677f63..315944e37 100644 --- a/src/synth/synth-stmts.adb +++ b/src/synth/synth-stmts.adb @@ -498,6 +498,7 @@ package body Synth.Stmts is -- Handle SEL bits by 2, so group case_element by 4. for I in 1 .. Natural (Wd / 2) loop + -- Extract 2 bits from the selector. Sub_Sel := Build_Extract (Build_Context, Sel, Width (2 * (I - 1)), 2); Mask := Shift_Left (not 0, Natural (2 * I)); @@ -672,7 +673,7 @@ package body Synth.Stmts is case Get_Kind (Choice) is when Iir_Kind_Choice_By_Expression => Choice_Idx := Choice_Idx + 1; - Annex_Arr (Choice_Idx) := Int32 (Alt_Idx); + Annex_Arr (Choice_Idx) := Int32 (Choice_Idx); declare Choice_Expr : constant Node := Get_Choice_Expression (Choice); @@ -830,7 +831,7 @@ package body Synth.Stmts is case Get_Kind (Choice) is when Iir_Kind_Choice_By_Expression => Choice_Idx := Choice_Idx + 1; - Annex_Arr (Choice_Idx) := Int32 (Alt_Idx); + Annex_Arr (Choice_Idx) := Int32 (Choice_Idx); declare Choice_Expr : constant Node := Get_Choice_Expression (Choice); -- cgit v1.2.3