A6.4.3 Illegal Future Uses

MediumDebugIcarus · browser samples / server checksReview the topic

Sort nine uses of the future global-clock functions into legal and illegal, by the standard.

Hardware context: A lint review of assertion code that reads one global tick ahead. Keep future-function calls where the standard allows them, even where a tool accepts more.

A lint review found nine lines that use the future global-clock functions. Each sits in a module with a global clocking.

Write answer(q). For each graded line, return 1 if IEEE 1800-2023 allows it, and 0 if it does not.

A tool that compiles a line does not make it legal: some tools accept lines the standard forbids. Questions 0 to 2 are worked examples on other lines.

Signals in the Timeline

SignalWidthRole
question4input of each check
Full specification
qLine (graded)
3sequence s_next; $rising_gclk(go); endsequence a3: assert property (@($global_clock) s_next |-> ready);
4c4: cover sequence (@($global_clock) req ##1 $falling_gclk(req));
5a5: assume property (@($global_clock) $steady_gclk(cfg));
6sequence s_cap; logic [3:0] v; (go, v = d) ##1 (d == v); endsequence a6: assert property (@($global_clock) s_cap |-> $steady_gclk(d));
7let up_next(x) = $rising_gclk(x); a7: assert property (@($global_clock) req |-> ack) else $display("%b", up_next(ack));
8a8: assert property (@($global_clock) $rising_gclk($future_gclk(x)));
9default disable iff ($falling_gclk(rst_n));
10always_comb a10: assert #0 ($changing_gclk(x) || 1'b1);
11a11: assert property (@($global_clock) req ##1 $future_gclk(x) == x);
qLine (worked example)
0a0: assert property (@($global_clock) x |-> y) else $display("%b", $past_gclk(y));
1always @(posedge clk) if ($rose_gclk(x)) n++;
2always @(posedge clk) if ($rising_gclk(x)) n++;

Examples

Example 1

A Past Function in an Action Block
Input
answer(0)
Output
answer = 1

The past functions are ordinary sampled value functions. They work in action blocks.

Example 2

A Past Function in Procedural Code
Input
answer(1)
Output
answer = 1

They also work in procedural code, with the global clock as their reference.

Example 3

A Future Function in Procedural Code
Input
answer(2)
Output
answer = 0

The future functions are limited to sequence and property expressions. Procedural code is not one.

Constraints and Contract

  • Return one value per question from answer(q).
  • Keep the function header.

Hints

Hint 1

A future function may appear only inside a sequence or property expression of a concurrent assertion.

Hint 2

Two more limits: no future function inside another, and no future function in an assertion that has a sequence match item.

Hint 3

A sequence match item is the list after a comma inside a sequence, such as (x, v = d). An implication is not one.

What the grader checks: Twelve constant answers: three worked examples and nine graded lines, keyed from IEEE 1800-2023 16.9.4, not from a tool.

12 checks on Icarus · browser samples / server checks. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.

See all 3 steps and the final capstone

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

A Past Function in an Action Block

Input
answer(0)
Expected output
answer = 1

The past functions are ordinary sampled value functions. They work in action blocks.

Run samples executes all 3 public checks. Check all tests runs 12 checks on the server.

Icarus · browser samples / server checks