diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-04-28 07:29:39 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-04-28 07:29:39 +0200 |
commit | 480b62181dd3e7d9e598de5672e1aa471d9355f9 (patch) | |
tree | f448cab146c4ed51849ca81bd37a89396c1e8fe2 /src/synth/netlists-memories.adb | |
parent | 1dd9c36d3bd138a9cfe37983514e32664e91a4d8 (diff) | |
download | ghdl-480b62181dd3e7d9e598de5672e1aa471d9355f9.tar.gz ghdl-480b62181dd3e7d9e598de5672e1aa471d9355f9.tar.bz2 ghdl-480b62181dd3e7d9e598de5672e1aa471d9355f9.zip |
netlists-memories: detect simple loop. Fix #2043
Diffstat (limited to 'src/synth/netlists-memories.adb')
-rw-r--r-- | src/synth/netlists-memories.adb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/synth/netlists-memories.adb b/src/synth/netlists-memories.adb index 062a73a94..55bcf0ba4 100644 --- a/src/synth/netlists-memories.adb +++ b/src/synth/netlists-memories.adb @@ -1185,11 +1185,17 @@ package body Netlists.Memories is -- It is OK to have mux2, provided it is connected to -- a dyn_extract. declare + Mux_Out : constant Net := Get_Output (Pinst, 0); Sub_Status : Get_Next_Status; Sub_Res : Instance; begin - Get_Next_Non_Extract - (Get_Output (Pinst, 0), Sub_Status, Sub_Res); + if Mux_Out = O then + -- Avoid simple infinite recursion + Status := Status_None; + Res := No_Instance; + return; + end if; + Get_Next_Non_Extract (Mux_Out, Sub_Status, Sub_Res); -- Expect Dyn_Extract, so no next. if Sub_Status /= Status_None then Status := Status_Multiple; @@ -2392,7 +2398,8 @@ package body Netlists.Memories is Instance_Tables.Init (Mems, 16); - -- Extract memories (isignal/signal/const) from dyn gates. + -- Extract memories from dyn gates: + -- get the isignal/signal/const gate at the origin of the dyn gate. for I in Instance_Tables.First .. Instance_Tables.Last (Dyns) loop Inst := Dyns.Table (I); if not Get_Mark_Flag (Inst) then |