A1.2.4 Release Means Low

EasyImplementVerilator · serverReview the topic

Write the release rule of a request/grant pair with $fell: req goes from 1 to 0 right after its grant.

Hardware context: A request/grant pair where the requester must release after its grant. Tell a release (a fall) from a level that was already low.

A requester holds req until it gets gnt. At the next edge it must release the request: req goes from 1 to 0 there.

A request that was already gone before its grant is a bug too: it was withdrawn. Write the rule with $fell and count its failures.

Signals in the Timeline

SignalWidthRole
clk1stimulus, the same for every design
req1stimulus, the same for every design
gnt1stimulus, the same for every design
your errors32your checker's error count
Full specification
The ports (keep them)
module release_rule (
  input  logic clk,
  input  logic req,      // held until the grant
  input  logic gnt,      // a one-edge grant pulse
  output int   errors
);
  // released: after gnt, req falls (goes from 1 to 0) at the next edge.
endmodule

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

Edge123456789101112
req110010011100
gnt010001001000

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

Examples

Example 1

Two Bad Releases
Input
Program: 3 grants
Output
errors = 2

Grants come at edges 2, 6 and 9. Only the first is followed by a fall of req.

Example 2

A Request Withdrawn Before Its Grant
Input
Program: 3 grants
Output
errors = 1

req fell at edge 6, together with the grant, so nothing falls at edge 7: the first failure, at t=65.

Example 3

A Request Held Too Long
Input
Program: 3 grants
Output
errors = 1

The grant at edge 9 sees req still high at edge 10.

Constraints and Contract

  • Use $fell(req) in one concurrent assertion.
  • Count failures in errors.
  • Do not change the ports.

Hints

Hint 1

!req is true whenever req is low. Is that the same as "req went low here"?

Hint 2

The release is due at the edge after the grant.

Hint 3

If req was already low at the grant, there is nothing to release at the next edge.

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 $fell(req).

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 Releases

Input
Program: 3 grants
Expected output
errors = 2

Grants come at edges 2, 6 and 9. Only the first is followed by a fall of req.

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

Verilator · server