Skip to content
Tutorials Center
My learning

Topics

Lesson 19 of 37 ยท Concurrent and Sequential Code

Delta Cycles and Simulation Time

Understand how VHDL simulation works: simulation time, delta cycles, signal update phases, race-free clock-domain behavior, inertial and transport delays and glitches.

VHDL describes parallel hardware, but your computer runs one instruction at a time. The simulator bridges that gap with a precise algorithm built around simulation time and delta cycles. Understanding it explains why signal assignments are delayed, why a clock gated by logic can cause odd results, and why zero-delay simulation is still deterministic.

Two kinds of time

  • Simulation time is the virtual time shown in the waveform: 0 ns, 10 ns, 20 ns...
  • Delta cycles are infinitesimal steps that happen within one simulation time, in order. Time stays at 10 ns while several deltas pass.

A signal assignment without a delay, y <= a;, schedules the update for the next delta at the same simulation time. A delayed assignment, y <= a after 5 ns;, schedules it for a later time.

The simulation cycle

At each step, the simulator:

  1. Advances to the earliest time with a scheduled event (or the next delta at the current time).
  2. Update phase: applies all scheduled signal values for that time/delta. Signals whose value changed have an event.
  3. Evaluation phase: every process sensitive to a signal with an event (or whose wait condition is satisfied) executes, until it suspends. Concurrent assignments are treated as processes.
  4. New assignments from those processes are scheduled for the next delta.
  5. If any events were scheduled for the next delta, repeat at the same time; otherwise move to the next time.

The simulation cycle

Advance To the next event time
Update Apply scheduled signal values
Evaluate Run the woken processes
Next delta Repeat until stable

Signals change between evaluations, never during them.

1 / 2

This is why processes always read old signal values: the update phase is finished before any process runs, and new values are written only for the next delta.

An example in deltas

VHDL
a <= '1' after 10 ns;          -- testbench stimulus
b <= not a;                    -- concurrent statement 1
c <= a and b;                  -- concurrent statement 2

At 10 ns, delta 0: a becomes '1' and both statements wake. Delta 1: b is scheduled to change to '0' and c is scheduled with the old b ('1'), so c becomes '1'. Delta 2: b is '0', which wakes c's statement again; c becomes '0'. This brief '1' on c is a glitch (a hazard), invisible on a waveform at the nanosecond scale but real in the delta timeline, and real in hardware as well, if gate delays differ.

The C stand-in below implements the same algorithm for these three statements. The log prints the time and delta number of every signal change.

C Stand-in (C): delta cycles for b <= not a; c <= a and b

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

Delta cycles and clocks

Delta cycles make clocked designs deterministic. Suppose the clock goes '1' at delta 0. All clocked processes wake in the same evaluation phase and see the same old values; their outputs update together in the next delta. Registers behave like real flip-flops.

The trouble starts if you derive a clock through a signal assignment: clk2 <= clk; makes clk2 change one delta after clk. A register clocked by clk2 then samples data from a register clocked by clk after that data has already changed, so it sees the new value. Real hardware would have a small skew; in simulation it is a delta skew, and results can differ between simulation and silicon. The remedy is to avoid gated or re-assigned clocks, use clock-enable signals instead, and never pass a clock through a concurrent assignment in the middle of a design.

Inertial and transport delay

A delay in a signal assignment has two models:

VHDL
y <= a after 5 ns;                      -- inertial (default)
y <= transport a after 5 ns;            -- transport
y <= reject 2 ns inertial a after 5 ns; -- pulse rejection threshold of 2 ns

Inertial delay models a gate that cannot pass pulses shorter than its delay: short pulses are swallowed. Transport delay models an ideal wire that passes everything, delayed. The C stand-in feeds a pulse of 3 ns to a 5 ns delay element in both ways.

C Stand-in (C): inertial vs transport delay

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

Synthesis ignores after clauses. Delays in your code exist for simulation models and testbenches; real delays come from the chip and are checked by static timing analysis. Never rely on after to make hardware work.

Why it matters

  • Always keep clock signals as direct signals from the top level; do not gate them in logic.
  • Do not use delays in synthesizable code.
  • When a waveform shows values changing "at the same time" but behaving as if in order, delta cycles are the reason. Most simulators can display delta steps.
  • If a simulation never finishes at one time (infinite delta loop, for example two statements a <= not b; b <= a; that oscillate), the simulator stops with an iteration-limit error.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is a delta cycle?

    Delta cycles order events that occur at the same simulation time, without advancing it.
  2. 2. Why do processes in a simulation see old signal values?

    Processes evaluate against the values from the update phase; their own assignments only take effect in the next delta.
  3. 3. Which delay model swallows pulses shorter than the delay?

    Inertial delay models real gates and rejects short pulses; transport passes every pulse.
  4. 4. Why is clk2 <= clk; dangerous for derived clocks?

    The delta delay causes a simulation-only skew between the two clocks that may not match real hardware.

Summary

  • Simulation advances in time steps, and within each time in delta cycles.
  • Each cycle: update signals, run woken processes, schedule new values for the next delta.
  • Processes read old values; this makes clocked designs behave like real flip-flops.
  • Avoid derived or gated clocks; use clock enables.
  • Inertial delay rejects short pulses; transport delay does not; synthesis ignores after.

Next: Finite State Machines: Moore and Mealy