I am trying to use an initial block to assign values to a read-only inferred RAM:
module rom (
input clk,
input [5:0] addr,
output reg [15:0] data);
reg [15:0] mem [0:63];
initial begin
mem[0] = 1;
mem[1] = 2;
end
always @(posedge clk)
data <= mem[addr];
endmodule
Yosys gives this warning message:
$ yosys -q -p "synth_ice40 -blif rom.blif" rom.v
Warning: Blocking assignment to memory in line rom.v:9 is handled like a non-blocking assignment.
Warning: Blocking assignment to memory in line rom.v:10 is handled like a non-blocking assignment.
If I ignore the warning (or change the initial assignments to non-blocking), I find experimentally that the RAM doesn't get its correct values until some clock cycles after power-up.
Is it not possible to use an initial block this way? The discussion of issue #50 in the yosys github repo offers an example module mem2reg_with_two_always_blocks
which suggests that it should be. But compiling that module draws the same warning message.