Debugging Iteration Limit error in VHDL Modelsim

38,340

Solution 1

This error usually indicates that ModelSim is stuck in an infinite loop. In VHDL, this can happen when a signal is placed in the sensitivity list and this signal is changed in the process. The signal changes, triggering the process, which changes the signal, which again triggers the process and the cycle continues.

The following is a simple example of a process that causes an infinite loop:

PROCESS (count)

BEGIN

count <= not count;

END PROCESS;

Solution 2

If your iteration limit is reached, that means the system hasn't stabilized. Most likely it is something like:

a <= b;

--- and then later...

b <= a;

Solution 3

I just had a similar problem.

the way I fixed it was just to increase delays in the testbench. I changed my delay from 100ps to 1ns and it was fixed! because the latency of the FOR LOOP is more than within the range of PicoSeconds.

Solution 4

One problem most people have with VHDL or any other HDL languages is that they do not understand that this is not a sequential code. EVERYTHING you have inside a process happens in parallel. The example from Ahmed is a good one:

PROCESS (count)

BEGIN

count <= not count;

END PROCESS;

An HDL simulator tries to set the value of the count to "not count" after each simulation tick, and the change will trigger another tick since the value of the count is changed and it keeps going on until it either crashes or gives you the above problem.

For an HDL to work properly you must use delays, either in form of a clock or if it is not for synthesis, to use an actual valued delay.

By changing the above code to

PROCESS (count)
BEGIN
   count <= not count after 1 ns;
END PROCESS;

The simulation will work and the count will toggle every 1 ns.

Share:
38,340
Admin
Author by

Admin

Updated on April 05, 2020

Comments

  • Admin
    Admin about 4 years

    I'm writing VHDL code for a d-flip-flop on Modelsim and I get an error when I try to simulate it:

    Error: (vsim-3601) Iteration limit reached at time 400 ps.

    I'm not sure what it means, but I've looked through much of my source code for errors to no success. Can anyone guess what the problem might be?

  • Paul S
    Paul S about 12 years
    I think your simplified example is too simple to cause the problem. More like a <= someFuntionOf(b,c,d,e); b <= someOtherFunctionOf(a,f,g,h)...... but yes, sounds like the OP has a feedback loop in their code.
  • Harry
    Harry almost 5 years
    This can be a big problem if your simulator timing resolution is greater than or equal to your clock period (search modelsim.ini for "Resolution"). In my case, my modelsim.ini had "Resolution = ns", so even my 1 ns clock was too fast, causing it to get stuck forever, incrementing delta cycles but never progressing past 0 ns.