Dual BRAM Fifo

48 views
Skip to first unread message

Rob Holmes

unread,
Mar 19, 2024, 2:49:39 PMMar 19
to FPGAwars: explorando el lado libre
HI All,

I was wondering if anyone had any thoughts on if this is going to be possible or not.

I have a FiFO mapped to a 4k BRAM block which "seems" to be working correctly.

However i need a slightly bigger fifo to use as a line buffer so i was thinking the following. (see image) using multiple BRAMs together to make 1 larger fifo. 

However am i right in thinking its never going to let me share the output (rdata) between both BRAM blocks? 

dualbramfifo.png

Jesus Arias

unread,
Mar 20, 2024, 4:21:00 AMMar 20
to FPGAwars: explorando el lado libre
Hi,
To connect several BRAMs is OK, but you must be aware the SB_RAM40_4K blocks are specific for the Lattice FPGAs, so, I think it would be better to use a generic memory description and to left the synthesis tool to do the actual BRAM mapping, something like:

...
reg [15:0]memory[0:8191];
initial readmemh("initialdata.hex",memory);
reg [15:0]rdata;

always @(posedge rclk) if (re) rdata<=memory[raddr];
always @(posedge wclk) if (we) memory[waddr]<=wdata;
...

Rob Holmes

unread,
Mar 20, 2024, 4:41:54 AMMar 20
to fpga-wars-explora...@googlegroups.com
Thanks for the reply, however if i use generic memory the synthesis tool never seems to infer BRAM, this was the only way i could get the following to show up was to use the primitive (screenshot)..... ill try again.

So if the synthesis tool does what it should i can define an 8k memory block and it will just automatically split it between 2 4k bram instalces? if so that will be awesome!


image.png

--
Has recibido este mensaje porque estás suscrito al grupo "FPGAwars: explorando el lado libre" de Grupos de Google.
Para cancelar la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a fpga-wars-explorando-el...@googlegroups.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/fpga-wars-explorando-el-lado-libre/383ea5d4-1f4a-4f5f-b9a8-07580872f50en%40googlegroups.com.

Rob Holmes

unread,
Mar 20, 2024, 4:51:45 AMMar 20
to fpga-wars-explora...@googlegroups.com
Ignore me, i was probably doing something wrong.... It worked this time. I have a feeling that the BRAM isnt inferred until you actually wire the output somewhere.... which meant i was giving up one step before it got inferred thinking i was doing it wrong!

reg [15:0] memory [0:511];

gives me this :)

image.png


THankyou again for you help and sorry for the mundane questions :)

Rob.

charli va

unread,
Mar 20, 2024, 6:27:35 AMMar 20
to fpga-wars-explora...@googlegroups.com

Hi Rob!! There are no mundane questions!

All learn a lot of each thread of this forum.

Thanks a lot for share your questions, and maintain us informed about your projects!

Jesus Arias

unread,
Mar 20, 2024, 10:22:58 AMMar 20
to FPGAwars: explorando el lado libre
Oh, yes. Yosys does a pretty good job removing all the logic if signals are left unconnected ;)
So, be sure your signals are at least routed to some physical pins before looking at the LC & BRAM counts.
Have a nice day
Reply all
Reply to author
Forward
0 new messages