From 7298513634bf4a649a2737afd87e02aced87aee6 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 31 May 2020 09:19:07 +0200 Subject: synth: improve support of true dual port rams. For #1069 --- src/synth/netlists-inference.adb | 2 +- src/synth/netlists-memories.adb | 9 +++++---- src/synth/netlists-memories.ads | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/synth') diff --git a/src/synth/netlists-inference.adb b/src/synth/netlists-inference.adb index 91e095211..d2a749968 100644 --- a/src/synth/netlists-inference.adb +++ b/src/synth/netlists-inference.adb @@ -340,7 +340,7 @@ package body Netlists.Inference is and then Can_Infere_RAM (Data, Prev_Val) then -- Maybe it is a RAM. - Res := Infere_RAM (Ctxt, Data, Clk, Clk_Enable); + Res := Infere_RAM (Ctxt, Data, Els, Clk, Clk_Enable); else if Clk_Enable /= No_Net then -- If there is a condition with the clock, that's an enable which diff --git a/src/synth/netlists-memories.adb b/src/synth/netlists-memories.adb index 233a4e49b..62025eb61 100644 --- a/src/synth/netlists-memories.adb +++ b/src/synth/netlists-memories.adb @@ -2316,19 +2316,20 @@ package body Netlists.Memories is Head := Res; end Reduce_Muxes_Mux2; - function Infere_RAM (Ctxt : Context_Acc; Val : Net; Clk : Net; En : Net) - return Net + function Infere_RAM + (Ctxt : Context_Acc; Val : Net; Tail : Net; Clk : Net; En : Net) + return Net is pragma Assert (Clk /= No_Net); -- pragma Assert (not Is_Connected (Val)); - Tail : Instance; + New_Tail : Instance; Res : Instance; begin -- From VAL, move all the muxes to the dyn_insert. The dyn_insert may -- be transformed to dyn_insert_en. -- At the end, the loop is linear and without muxes. -- Return the new head. - Reduce_Muxes (Ctxt, Clk, En, Val, No_Net, Res, Tail); + Reduce_Muxes (Ctxt, Clk, En, Val, Tail, Res, New_Tail); return Get_Output (Res, 0); end Infere_RAM; diff --git a/src/synth/netlists-memories.ads b/src/synth/netlists-memories.ads index b005996d6..efc25f9e9 100644 --- a/src/synth/netlists-memories.ads +++ b/src/synth/netlists-memories.ads @@ -33,6 +33,7 @@ package Netlists.Memories is function Can_Infere_RAM (Val : Net; Prev_Val : Net) return Boolean; -- Transform VAL to a RAM. - function Infere_RAM (Ctxt : Context_Acc; Val : Net; Clk : Net; En : Net) - return Net; + function Infere_RAM + (Ctxt : Context_Acc; Val : Net; Tail : Net; Clk : Net; En : Net) + return Net; end Netlists.Memories; -- cgit v1.2.3