r/FPGA•
__BlueSkull__

DPRAM won't infer in normal or write-through mode

I have a dual port memory that does NOT support read-before-write mode, so to get it to work, it needs to be in either normal mode or write-through mode.

It will be used as RAM for code and data storage, so both IROM and DRAM. Thus, it needs one read-only port, and one read/write port. The following code is used to declare and use it:

reg [31:0] ram [DEPTH-1:0]; // DEPTH is memory depth in 4 bytes
always @ (posedge clk)
begin
  if(rst)
  begin
    iout<=32'h0;
    dout<=32'h0;
  end
  else
  begin
    iout<=ram[iaddr[DEPTH-1:2]];
    dout<=wen?din:ram[daddr[DEPTH-1:2]];
    if(wen) ram[daddr[DEPTH-1:2]]<=din;
  end
end

It synthesizes well, but the generated vg file shows the inferred RAM to be read-before-write mode, which is not supported by the chip, so PNR fails.

What I want to know is, did I miss anything? I mean, I can always just decouple IROM and DRAM, and considering my use case is deeply embedded, I will not be running a JIT or anything, so execution from DRAM is not needed in the first place. This is more of a curiosity thing as I'm baffled -- where did I read before write to the RAM, I just can't see it.

Posted Jan 27, 2026, 11:38 AM UTC

25
Loading comments…