A3.2.2 Hold the Address Until Accepted

EasyFixVerilator · serverReview the topic

Fix a hold rule written with throughout over a fixed delay, so it holds the request until the accept, whenever it comes.

Hardware context: A read request whose address must hold until it is accepted. Hold a request until its accept edge, whatever the wait.

A read request raises arvalid with an address on araddr. If it is not accepted at once, arvalid stays high and araddr stays the same up to and including the edge where arready is 1.

The rule below assumes the accept always comes one edge after the request. Fix it so that it holds until the accept, at any distance.

Signals in the Timeline

SignalWidthRole
clk1stimulus, the same for every design
arvalid1stimulus, the same for every design
arready1stimulus, the same for every design
araddr8stimulus, the same for every design
your errors32your checker's error count
Full specification
The rule to fix
module addr_hold (
  input  logic       clk,
  input  logic       arvalid, arready,
  input  logic [7:0] araddr,
  output int         errors
);
  // False alarms when the accept comes early, and missed bugs when it comes late.
  held: assert property (@(posedge clk) $rose(arvalid) && !arready |=> (arvalid && $stable(araddr)) throughout ##1 arready) else errors++;
endmodule

The program shown here gives the sampled value of each signal at each rising edge, with araddr in hex:

Edge1234567891011121314
arvalid01100111101100
arready00100000100000
araddr0040400000505050500060600000

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

Examples

Example 1

One Bad Request
Input
Program: 3 requests
Output
errors = 1

The requests at edges 2 and 6 wait 1 and 3 edges and hold. The one at 11 drops before any accept.

Example 2

A Quick Accept Is Fine
Input
Program: 3 requests
Output
errors = 0

The request at edge 2 is accepted at 3 with the address held.

Example 3

A Slow Accept Is Fine Too
Input
Program: 3 requests
Output
errors = 1

The request at edge 6 holds its address through 7 and 8 and is accepted at 9. Only the drop at 13 fails.

Constraints and Contract

  • Keep one concurrent assertion that counts failures in errors.
  • Hold up to and including the accept edge.
  • Do not change the ports.

Hints

Hint 1

How long after the request can the accept come?

Hint 2

until stops checking at the accept edge; until_with checks that edge too.

Hint 3

The hold starts at the edge after the request: at the request edge, $stable compares with the old idle address.

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.

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

One Bad Request

Input
Program: 3 requests
Expected output
errors = 1

The requests at edges 2 and 6 wait 1 and 3 edges and hold. The one at 11 drops before any accept.

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

Verilator · server