A3.5.4 Abort the Read on Error

MediumImplementVerilator · serverReview the topic

Write one read rule in which a flush cancels the waiting read and an error fails it, both at the clock edge.

Hardware context: A read port with a flush and an error line. Cancel or fail a waiting read with the synchronous abort operators.

A read (rd) is answered by rvalid 1 to 3 edges later. While the read waits, a flush cancels it: no failure. An err while it waits fails it at the edge where err is seen.

Write one concurrent assertion with sync_accept_on and sync_reject_on, and count its failures. An err or a flush while no read waits is legal.

Signals in the Timeline

SignalWidthRole
clk1stimulus, the same for every design
rd1stimulus, the same for every design
rvalid1stimulus, the same for every design
flush1stimulus, the same for every design
err1stimulus, the same for every design
your errors32your checker's error count
Full specification
The ports (keep them)
module read_abort (
  input  logic clk,
  input  logic rd,       // a read request
  input  logic rvalid,   // the read data
  input  logic flush,    // cancels the waiting read
  input  logic err,      // fails the waiting read
  output int   errors
);
  // answered: after rd, rvalid within 1 to 3 edges. While the read waits, flush cancels it (no failure)
  //           and err fails it at the edge where err is seen.
endmodule

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

Edge123456789101112131415
rd010010010001000
rvalid001000100000000
flush000000001000000
err000001000010000

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

Examples

Example 1

Two Bad Reads
Input
Program: 4 reads
Output
errors = 2

Reads start at edges 2, 5, 8 and 12. One is failed by an error, one is never answered.

Example 2

The Error Comes First
Input
Program: 4 reads
Output
errors = 1

The read from edge 5 sees err at 6.

Example 3

The Late Failure
Input
Program: 4 reads
Output
errors = 1

The read from edge 12 has no rvalid in its window.

Constraints and Contract

  • Use sync_accept_on (flush) and sync_reject_on (err) in one concurrent assertion.
  • Count failures in errors.
  • Do not change the ports.

Hints

Hint 1

Where must the aborts go, so that a flush or an err with no read waiting changes nothing?

Hint 2

Which abort gives a pass, and which a failure?

Hint 3

Would disable iff (err) fail the read, or only switch the check off?

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 both sync_ aborts.

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

Two Bad Reads

Input
Program: 4 reads
Expected output
errors = 2

Reads start at edges 2, 5, 8 and 12. One is failed by an error, one is never answered.

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

Verilator · server