aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-01-10 19:33:28 +0100
committerTristan Gingold <tgingold@free.fr>2020-01-10 19:33:28 +0100
commit52f75c4ee97525a3dbd432cde1bfd792922ba5ad (patch)
tree110396642f6aca22ba8d2bfda786591de682d972
parent3a91377e172c469268cdeb14730b8d97af5b0497 (diff)
downloadghdl-52f75c4ee97525a3dbd432cde1bfd792922ba5ad.tar.gz
ghdl-52f75c4ee97525a3dbd432cde1bfd792922ba5ad.tar.bz2
ghdl-52f75c4ee97525a3dbd432cde1bfd792922ba5ad.zip
synth: emit error message in case of 'else' for synchronous code. Fix #1074
-rw-r--r--src/synth/synth-inference.adb20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/synth/synth-inference.adb b/src/synth/synth-inference.adb
index db16147df..2a4af7949 100644
--- a/src/synth/synth-inference.adb
+++ b/src/synth/synth-inference.adb
@@ -302,7 +302,10 @@ package body Synth.Inference is
end case;
end Extract_Clock;
- procedure Check_FF_Else (Els : Net; Prev_Val : Net; Off : Uns32)
+ procedure Check_FF_Else (Els : Net;
+ Prev_Val : Net;
+ Off : Uns32;
+ Loc : Source.Syn_Src)
is
Inst : Instance;
begin
@@ -313,14 +316,11 @@ package body Synth.Inference is
return;
end if;
Inst := Get_Net_Parent (Els);
- if Get_Id (Inst) /= Id_Extract then
- raise Internal_Error;
- end if;
- if Get_Param_Uns32 (Inst, 0) /= Off then
- raise Internal_Error;
- end if;
- if Get_Input_Net (Inst, 0) /= Prev_Val then
- raise Internal_Error;
+ if Get_Id (Inst) /= Id_Extract
+ or else Get_Param_Uns32 (Inst, 0) /= Off
+ or else Get_Input_Net (Inst, 0) /= Prev_Val
+ then
+ Error_Msg_Synth (+Loc, "synchronous code does not expect else part");
end if;
end Check_FF_Else;
@@ -369,7 +369,7 @@ package body Synth.Inference is
begin
Disconnect (Sel);
-- There must be no 'else' part for clock expression.
- Check_FF_Else (Get_Driver (I0), Prev_Val, Off);
+ Check_FF_Else (Get_Driver (I0), Prev_Val, Off, Stmt);
-- Don't try to free driver of I0 as this is Prev_Val or a selection
-- of it.
Disconnect (I0);