A3.2.3 Valid Through the Accept Edge

MediumImplementVerilator · serverReview the topic

Write a strong hold rule with s_until_with: an offered beat stays offered through the edge where it is taken.

Hardware context: A read beat that must stay offered through the edge where it is taken. Use a strong hold that includes the take edge.

A beat is offered when rvalid rises. From that edge, rvalid must stay high up to and including the edge where rready is 1, and that edge must come.

Write one concurrent assertion on the rising edge of clk with s_until_with, and count its failures.

Signals in the Timeline

SignalWidthRole
clk1stimulus, the same for every design
rvalid1stimulus, the same for every design
rready1stimulus, the same for every design
your errors32your checker's error count
Full specification
The ports (keep them)
module valid_hold (
  input  logic clk,
  input  logic rvalid, rready,
  output int   errors
);
  // offered: from the edge where rvalid rises, rvalid holds up to and including the edge where rready is 1,
  //          and that edge must come (a strong rule).
endmodule

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

Edge1234567891011121314
rvalid01100101110000
rready00100010001000

Every beat in these programs is decided before the run ends, so the strength is graded on the source text. The full check also runs a second program that this page does not show.

Examples

Example 1

Two Bad Beats
Input
Program: 3 beats
Output
errors = 2

Beats are offered at edges 2, 6 and 8. Only the first one is held through its take.

Example 2

Taken at the Next Edge
Input
Program: 3 beats
Output
errors = 0

The beat offered at 2 is still there at 3, where rready comes.

Example 3

Dropped at the Take Edge
Input
Program: 3 beats
Output
errors = 2

The beat offered at 6 is gone at 7, the take edge. The one offered at 8 is gone at 11, again the take edge.

Constraints and Contract

  • Use s_until_with in one concurrent assertion.
  • Count failures in errors.
  • Do not change the ports.

Hints

Hint 1

Which until form also checks the edge where rready comes?

Hint 2

Which form also demands that rready comes at all?

Hint 3

Start from the edge where rvalid rises: a beat taken at once is fine.

What the grader checks: Two copies of your rule each watch a fixed program. One is shown here; the other is hidden, with another clock. Graded on each: failures early, later and in total. The rule must use s_until_with.

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 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

Two Bad Beats

Input
Program: 3 beats
Expected output
errors = 2

Beats are offered at edges 2, 6 and 8. Only the first one is held through its take.

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

Verilator · server