I'm new to FPGAs. I've been doing some simple tests and I found an issue I don't fully understand.
I have a 50MHz clock source.
I have a signal defined as:
SIGNAL ledCounter : integer range 0 to 25000000 := 0;
When the ledCounter reaches 25,000,000 I toggle an LED and reset the counter. This works great directly on the FPGA.
IF (rising_edge(CLK)) THEN
ledCounter <= ledCounter + 1;
IF (ledCounter = 25000000) THEN
ledCounter <= 0;
toggle <= not toggle;
LED(0) <= toggle;
END IF;
END IF;
When running inside ModelSim I get an error when the counter reaches 25000000. For it to run in the simulator I have to define the range as:
SIGNAL ledCounter : integer range 0 to 25000001 := 0;
Does anyone have any insight into why this is happening? The code runs on the FPGA well but won't run in the simulator without the above modification.
EDIT: The modelsim error is nondescriptive: Cannot continue because of fatal error. HDL call sequence. Stopped at C:/Users/robert/Documents/fpga/testsim/test.vhd 20 Process line__17