Here is how I define the rom
module
module rom(
input wire [31:0] inst_addr_i,
output reg [31:0] inst_o
);
reg [31:0] rom_mem[0:100];
always@(*) begin
inst_o = rom_mem[inst_addr_i>>2];
end
endmodule
Here is the $readmem
in tb.v
initial begin
$readmemh("inst.data",tb.rv_soc_ins.rom_ins.rom_mem);
end
And the inst.data
file is like this, which has 354 rows.
00000d13
00000d93
00000093
00000113
00208f33
00000e93
00200193
This is what I get when executing the vpp
script:
$ vvp a.out
WARNING: tb.v:23: $readmemh(inst.data): Too many words in the file for the requested range [0:100].
VCD info: dumpfile gtk.vcd opened for output.
Although in rom.v
, I have set the rom large enough.
The warning is saying that your file (with 354 rows) is longer than your array (with 101 elements).
The message about VCD is unconnected: it is simply the next message telling you that the file "gtk.vcd" has been opened.