From 2e50c44a48b74ecb7f5a14e4c4d0181cfa2d7402 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 10 Mar 2020 20:33:49 +0100 Subject: synth-stmts: handle conditional assignment without else --- src/synth/synth-stmts.adb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/synth/synth-stmts.adb') diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb index 1f5230a35..935cc3b8b 100644 --- a/src/synth/synth-stmts.adb +++ b/src/synth/synth-stmts.adb @@ -566,6 +566,7 @@ package body Synth.Stmts is Targ : Target_Info; Cond : Node; Cwf : Node; + Inp : Input; Val, Cond_Val : Value_Acc; First, Last : Net; V : Net; @@ -573,6 +574,7 @@ package body Synth.Stmts is Targ := Synth_Target (Syn_Inst, Get_Target (Stmt)); Last := No_Net; Cwf := Get_Conditional_Waveform_Chain (Stmt); + Cond := Null_Node; while Cwf /= Null_Node loop Val := Synth_Waveform (Syn_Inst, Get_Waveform_Chain (Cwf), Targ.Targ_Type); @@ -587,13 +589,23 @@ package body Synth.Stmts is end if; if Last /= No_Net then - Connect (Get_Input (Get_Net_Parent (Last), 1), V); + Inp := Get_Input (Get_Net_Parent (Last), 1); + Connect (Inp, V); else First := V; end if; Last := V; Cwf := Get_Chain (Cwf); end loop; + if Cond /= Null_Node then + pragma Assert (Last /= No_Net); + Inp := Get_Input (Get_Net_Parent (Last), 1); + if Get_Driver (Inp) = No_Net then + -- No else. + Val := Synth_Read (Syn_Inst, Targ, Stmt); + Connect (Inp, Get_Net (Val)); + end if; + end if; Val := Create_Value_Net (First, Targ.Targ_Type); Synth_Assignment (Syn_Inst, Targ, Val, Stmt); end Synth_Conditional_Signal_Assignment; -- cgit v1.2.3