A3.9.1 Valid for Two Cycles After Start

MediumImplementVerilator · serverReview the topic

Write two window rules with bounded always: valid through the two edges after start, and busy low through a later window.

Hardware context: A transfer engine with a start pulse, a valid window and a quiet period after done. Check every edge of a fixed window with a bounded always.

Write two concurrent assertions on the rising edge of clk, each with a bounded always.

Rule held: valid is 1 at each of the two edges after start. Rule quiet: busy is 0 at each edge from the second to the fourth after done. The first edge after done is not checked.

Signals in the Timeline

SignalWidthRole
clk1stimulus, the same for every design
start1stimulus, the same for every design
valid1stimulus, the same for every design
done1stimulus, the same for every design
busy1stimulus, the same for every design
your valid_errors32stimulus, the same for every design
your busy_errors32stimulus, the same for every design
Full specification
The ports (keep them)
module window_rules (
  input  logic clk,
  input  logic start, valid,      // valid must hold at the two edges after start
  input  logic done, busy,        // busy must stay low from the second to the fourth edge after done
  output int   valid_errors,      // rule held
  output int   busy_errors        // rule quiet
);
  // held:  valid is 1 at each of the two edges after start.
  // quiet: busy is 0 at each edge from the second to the fourth after done.
endmodule

The program shown here gives the sampled value of each signal at each rising edge (at 5, 15, 25, ...):

Edge1234567891011121314
start10001000000000
valid01101100000000
done00000001000000
busy00000001101000

The full check also runs a second program that this page does not show, with another clock and other windows.

Examples

Example 1

A Window Cut Short
Input
Program: 2 starts, 1 done
Output
valid_errors = 1

The start at edge 1 is followed by valid twice. The start at edge 5 is not: valid drops at edge 7.

Example 2

The First Edge After Done Is Free
Input
Program: 2 starts, 1 done
Output
busy_errors = 1

busy at edge 9 is allowed. busy at edge 11 is inside the window.

Example 3

Two Failures in All
Input
Program: 2 starts, 1 done
Output
total = 2

One from each rule.

Constraints and Contract

  • Use a bounded always in each rule.
  • Count failures in valid_errors and busy_errors.
  • Do not change the ports.

Hints

Hint 1

always [m:n] p needs p at every edge of the window, counted from the attempt's edge.

Hint 2

A ranged delay ##[1:2] is satisfied by one edge. Is that the rule?

Hint 3

For quiet, the window starts two edges after done.

What the grader checks: Two copies of your rules each watch a fixed program. One is shown here; the other is hidden, with another clock. Graded on each: the two failure counts. Each rule must use a bounded always.

6 checks on Verilator · server. 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 4 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 Window Cut Short

Input
Program: 2 starts, 1 done
Expected output
valid_errors = 1

The start at edge 1 is followed by valid twice. The start at edge 5 is not: valid drops at edge 7.

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

Verilator · server