I have an old VHDL code which I need to run a simulation for with Modelsim. This code "includes" a warp around condition which is of no consequence in real hardware but fails in simulation. I know this should not be written like this as the implementation depends on the synthesis tool, but it was written 20 years ago and I have to deal with it now.... Within a state machine the next state is determined by the value of a signal decreased from a preloaded value downto 0. Unfortunately the decrement line is not within the If then else statement, thus "bitcounter" is decreased also when being zero. The wrapped around value is not used for anything within the code (in one of the "later" states, the signal is preloaded again), thus everything is fine in hardware.
signal definition: Bitcounter : integer range 0 to 11;
problematic code snippet
process(clk) begin if rising_edge(clk) then
case state is when ....
...
when GET_DATA_2 =>
IF (Bitcounter = 0)
THEN
STATE <= LAST_CYCLES_HIGH;
ELSE
STATE <= GET_DATA1;
END IF;
Bitcounter <= Bitcounter-1; ...
Modelsim fails as bitcounter is decremented to -1
Is there any option to compensate this bad code by a simulation command, either by declaring "-1" to be "allowed" (extending the range "on Modelsim side") or supressing this particular error in simulation?
While the easiest way is to change the VHDL code for sure, this will finally end in different configuration data which should be avoided...