I am trying to declare a 1MB memory model using an array in Verilog in ModelSim using the code below. I also need to have the address 0x80020000 within the address space.
parameter MEM_START = 32'h7FFA_0000;
parameter MEM_END = 32'h800A_0000;
reg [7:0] MEMORY [MEM_START:MEM_END];
The above code compiles fine but it gives the following error when I try to simulate it:
# Loading project.memoryModule
# ** Fatal: (vsim-3419) Array with element size 2 and index range 2147090432 downto -2146828288 is too large.
# Time: 0 ns Iteration: 0 Instance: Project/memoryModule.v
# FATAL ERROR while loading design
# Error loading design
However, if I initialize the memory indices from 7FEF_FFFF to 7FFF_FFFF, which should also be 1 MB, everything is fine and I can see the allocated memory in the simulation. If I modify the range from 7FEF_FFFF to 8000_0000, I now get an internal data size overflow during compilation. Why does the end range of the memory appear as -2146828288 (FFFF FFFF 800A 0000) in the error (2's complement)?
All the examples I've seen online show smaller memories, i.e. 256 words so reg [7:0] MEMORY [0:255]) so I'm not sure if there is a problem in my logic or if the issue is related to the HW on my machine. I'm using the 32 bit version of Modelsim & have 4 GB of RAM.