Search code examples
verilogiverilog

Icarus Verilog warning $readmemh: Standard inconsistency, following 1364-2005


I'm trying to read a memory file using $readmemh, but I'm not sure what the correct file format is since I'm seeing a warning.

In my testbench, I have the following:

reg [7:0] progmem [4095:0];

initial begin
    $readmemh("progmem.txt", progmem);
end

And progmem.txt contains:

01
03
ff
00

and so on for a total of 4096 rows. When running the testbench, vvp displays:

$readmemh: Standard inconsistency, following 1364-2005

I have tried looking this up, but I haven't found an explanation as to what that actually means.


Solution

  • Different versions of the IEEE Std 1364 specify how memories are loaded via $readmemh differently.

    1364-1995 states:

    ... the default start address is the left-hand address given in the declaration of the memory. Consecutive words are loaded until either the memory is full ...

    1364-2001 states:

    ... the default start address shall be the lowest address in the memory. Consecutive words shall be loaded until either the highest address in the memory is reached ...

    In your declaration, the left-hand address is 4095, but the lowest address is 0.

    Instead of loading the 1st word (01) into progmem[4095], I believe the warning is telling you that it is loading the 1st word into progmem[0].

    When I change the declaration to the following, the warning disappears for me on iverilog on edaplayground:

    reg [7:0] progmem [0:4095];