Future Global-Clock Functions

Read the value of the next global tick with $future_gclk, $rising_gclk, $falling_gclk, $steady_gclk and $changing_gclk, and know where they are illegal.

You Will Be Able To

  • Predict the five future functions on a trace, and when the action block runs.
  • Write a rule that is decided at the tick before a change.
  • Name the places where a future function is illegal.
  • Tell the standard's behaviour from what Verilator 5.052 prints.
Lesson
A6.4
Time
25 min
Runs on
Verilator
Check
5 questions

A rule from a clock-gating spec: sig may change only together with a falling edge of clk. Written with the past functions, it is checked one global tick after the change. The future functions state it at the tick before the change, which reads closer to the spec.

Reading one tick ahead
0123global tick (ns)15253545sig sampled$future_gclk(sig)10?$changing_gclk(sig)101?sig will change at the next tickand again
Scroll horizontally ↔

At each tick, a future function reads the sample of the next global tick. At the last tick of a run there is no next tick yet.

$future_gclk: The Value at the Next Global Tick

$future_gclk(v) is the sampled value of v at the next global tick. The other four future functions are built on it.

The attempt is still decided at its own tick, as if the future value were known. The tool can only know it one tick later, so the action block waits for the next global tick.

One Failing Attempt of `inc |-> $future_gclk(cnt) == cnt + 1`The attempt starts and fails at 25. Its action block runs at the next global tick, 35.
  • Clock / reset
  • Step
  • Data
  • Control
call: who calls whom
One failing attempt of `inc |-> $future_gclk(cnt) == cnt + 1`The attempt starts and fails at 25. Its action block runs at the next global tick, 35. clock reset tick 15 inc = 1, cnt = 1:passes at 25 clock reset tick 25 inc = 1, cnt = 2 clock reset tick 35 cnt = 2 (expected 3) step action block runs at 35 reads the futuresampleverdict known
  1. clock reset tick 15inc = 1, cnt = 1: passes at 25
  2. clock reset tick 25inc = 1, cnt = 2
    • reads the future sample → tick 35
  3. clock reset tick 35cnt = 2 (expected 3)
    • verdict known → action block
  4. step action blockruns at 35
  1. The attempt before

    The attempt at 15 sees 1 now and 2 at 25. It passes.

  2. The attempt

    At 25 the attempt sees inc high and cnt at 2. It needs the sample of cnt at 35.

  3. The future sample

    At 35 cnt is still 2, not 3. The attempt that started at 25 fails, and its failure time is 25.

  4. The action block

    The action block runs at 35, so $time in it prints 35.

Read the diagram as text
  • tick 15: inc = 1, cnt = 1: passes at 25
  • tick 25: inc = 1, cnt = 2
  • tick 35: cnt = 2 (expected 3)
  • action block: runs at 35
  • tick 25 → tick 35: reads the future sample
  • tick 35 → action block: verdict known

IEEE 1800-2023 16.9.4. With a future function, the action block runs at the global tick after the attempt.

$rising_gclk: Bit 0 Will Go to 1

$rising_gclk(v) is true when bit 0 of v changes to 1 at the next global tick. It is $rose moved one tick earlier.

Use it when a condition must hold at the tick before a rise. For example, "a request may rise only while the block is not busy" checks busy before the rise.

Past form

assert property (@($global_clock)
  $rose(req) |-> !$past(busy));

Waits for the tick that sees the rise, then looks back at busy.

Future form

assert property (@($global_clock)
  $rising_gclk(req) |-> !busy);

Decided at the tick before the rise. busy is read at its own tick.

$falling_gclk: Bit 0 Will Go to 0

$falling_gclk(v) is true when bit 0 of v changes to 0 at the next global tick. Like $fell, it ignores every other bit.

$steady_gclk: The Same Value at the Next Tick

$steady_gclk(v) is true when the sampled value of v at the next global tick equals the value now. The standard compares the whole expression, every bit.

Standard (IEEE 1800-2023 16.9.4)

// data goes from 4 to 6
$steady_gclk(data)    // false
$changing_gclk(data)  // true

The whole value is compared. 4 and 6 differ.

Verilator 5.052 (measured)

// data goes from 4 to 6
$steady_gclk(data)    // true
$changing_gclk(data)  // false

Only bit 0 is compared, and bit 0 stays 0. Use these two functions on one-bit signals here.

$changing_gclk: The Value Will Change

$changing_gclk(v) is !$steady_gclk(v). It makes a natural trigger: "if sig is about to change, clk is about to fall".

Where a Future Function Is Illegal

A future function may appear only inside a sequence or property expression of a concurrent assertion. Two more rules: no nesting, and no assertion that also has a sequence match item.

UseStandardVerilator 5.052 (measured)
always @(posedge sys) y <= $future_gclk(x);illegal: procedural codecompile error
else $display("%0d", $rising_gclk(x));illegal: action blockcompile error
disable iff ($rising_gclk(x))illegal: not a sequence or property expressionaccepted on the global clock
$future_gclk(y && $rising_gclk(x))illegal: nestedaccepted
(x, note()) |-> $rising_gclk(y)illegal: a sequence match itemaccepted
x |=> $future_gclk(y)legalaccepted
$rising_gclk(a) |-> $falling_gclk(b)legal: two calls, neither inside the otheraccepted

IEEE 1800-2023 16.9.4. The tool column was measured on 2026-11-12 (tools/probes/sva-w1b/departures.mjs).

A sequence match item is the list after a comma inside a sequence: (x, v = d) or (x, note()). The implication |=> is not one, so x |=> $future_gclk(y) is legal.

The past functions have none of these limits. $past_gclk and the others work in procedural code and in action blocks.

Where the Tool and the Standard Part

Verilator 5.052 gets the future functions right in one setting: an assertion clocked by the global clock itself. There, $steady_gclk and $changing_gclk still need one-bit signals. Every example in this lesson stays in that setting.

Standard behaviour: $future_gclk(d) in an assertion on a slow clock
0123clk edge (ns)105090130next global tick155595135d sampled at the edge237$future_gclk(d), standard2367Verilator 5.052 reads237d changes at 52d changes at 92
Scroll horizontally ↔

Standard behaviour, derived by hand from IEEE 1800-2023 16.9.4 (docs/sva-standard-traces, sva-155b). The last row was measured: Verilator 5.052 reads the sample at the assertion's own edge.

CaseStandardVerilator 5.052 (measured)
an assertion on a clock slower than the global clockthe next global tick's sample; the action runs at that tickthe sample at the assertion's own edge; the action runs at once
$steady_gclk or $changing_gclk of a vectorevery bit countsbit 0 only
$future_gclk(d) == d at the first tickno extra reportone extra failure at the first global tick

tools/probes/sva-w1b/departures.mjs measures each row.

Try It

The two rules print at the same times, but they fail in different attempts. The future rule fails at 35 and 105, the ticks before each bad change. Its action waits one tick.

The past rule must compare with a previous tick. At the very first tick it compares with the declared value. The future rule has no such corner. Move sig = 1 to #18 and predict both outputs.

RUNVerilator · simulator service
Edit the code, then run it
Expected: t=45 fut: sig changes with no falling clk t=45 past: sig changed with no falling clk t=115 fut: sig changes with no falling clk t=115 past: sig changed with no falling clk

Check Yourself

Predict the outputWhen go is high, ack must rise at the next global tick. Predict the first line printed.
module tb;
  logic sys = 0;
  always #5 sys = ~sys;                        // global ticks at 5, 15, 25, ...
  global clocking @(posedge sys); endclocking
  logic go = 0, ack = 0;
  rise_next: assert property (@($global_clock) go |-> $rising_gclk(ack))
    else $display("t=%0t ack did not rise", $time);
  initial begin
    #12 go = 1;                                // sampled high at 15
    #10 ack = 1;                               // t=22: sampled high at 25
    #10 ack = 0;                               // t=32: go still high at 25 and 35
    #10 go = 0;                                // t=42
    #20 $finish;
  end
endmodule
Spot the bugThe rule: sig changes only together with a falling edge of clk. The bench makes two legal changes and one illegal one. Which option is wrong?
ConceptAn assertion with $rising_gclk fails in its attempt at 40. The global clock ticks every 10 ns. When does its action block run?
ConceptWhich use of a future function is legal?
Conceptdata is 4 bits wide and goes from 4 to 6 between two global ticks. What does the standard say $steady_gclk(data) returns at the first of those ticks?

Common Mistakes

Wrong Read the time printed by the action block as the time of the failing attempt.

An assertion with a future function runs its action one global tick after the attempt.

Fix Subtract one global tick to find the attempt, or print $past_gclk values to see what it saw.

Wrong Mix a future trigger with a past check in one rule.

They read different ticks, so the rule compares the wrong pair of samples.

Fix Use a future function on both sides, or a past function on both sides.

Before
$changing_gclk(sig) |-> $fell_gclk(clk)
After
$changing_gclk(sig) |-> $falling_gclk(clk)

Wrong Call $rising_gclk in an action block or a disable iff to report what comes next.

Future functions are legal only in sequence and property expressions; some tools still accept these uses.

Fix Report with $past_gclk and $sampled in the action block, which runs at the next tick anyway.

Remember

  • The five future functions read the sample at the next global tick.
  • An attempt is decided at its own tick; its action block runs one global tick later.
  • $rising_gclk and $falling_gclk read bit 0; $steady_gclk and $changing_gclk read the whole value.
  • Future functions belong only in sequence and property expressions, never nested or with match items.
  • On Verilator 5.052, clock such assertions by the global clock and use one-bit signals with steady and changing.

Practice

Report a problem with this page