F4.7.1 Pick the Levers

MediumOptimize20 minSymbiYosys · serverReview the topic

Problem

Description

The bench was copied from simulation: a long reset and a slow clock ratio. Bounded runs never reach the second transaction. Fix the bench, not the engine.

A bench copied from simulation holds reset for 8 cycles and runs the prescaler at ratio 4. Choose a reset expression and a ratio inside the data sheet. A bounded run at depth 28 must then reach the second transaction and fail the faulty block.

Pinned interface
PortDirectionBits
clkinput1
rstinput1
goinput1
doneoutput1
stoutput3
tickoutput1
ageoutput4
ratio_ooutput3
Full specification

The block steps once per tick of a prescaler. A tick comes every ratio + 1 cycles. One transaction takes four ticks, and done must only rise as the state becomes 3. A faulty version of the block raises done early in its second transaction.

The bench has two settings. reset is an expression on age, the number of cycles since the start: the bench holds rst high while it is true. ratio is a constant for the prescaler.

This data sheet is stricter than the bench in F4.7. It asks for reset during at least 3 cycles and allows ratios from 2 to 7. The block logic only moves on ticks, so the ratio does not change what it does, only when.

Submit JSON with both settings. With them, a bounded run at depth 28 must prove the good block, reach its second done, and fail the faulty block. Settings outside the data sheet are rejected.

The good block and the two bench settings. The judge fills the two marked places with your expressions.
module top(input clk, input rst, input go, output reg done=0, output reg [2:0] st=0, output reg tick=0, output reg [3:0] age=0, output [2:0] ratio_o);
  reg [2:0] pre=0;
  reg first=1;
  assign ratio_o = /* ratio */;                       // bench setting: the clock ratio
  always @(posedge clk) begin
    age <= age == 4'd15 ? 4'd15 : age + 4'd1;
    if (rst) begin pre <= 0; tick <= 0; st <= 0; done <= 0; first <= 1; end
    else begin
      pre  <= pre == ratio_o ? 3'd0 : pre + 3'd1;
      tick <= pre == ratio_o;
      done <= 0;
      if (tick) begin
        if (st == 3'd0) begin if (go) st <= 3'd1; end
        else if (st == 3'd3) begin st <= 3'd0; first <= 0; end
        else st <= st + 3'd1;
        done <= st == 3'd2;
      end
    end
    if (/* reset */) begin assume(rst); end else begin assume(!rst); end   // bench setting: the reset sequence
  end
endmodule

Execution ruleMeaning
InterfaceUse the pinned port names, directions and bit widths shown above. Observed state and tracker outputs are not environment inputs.
SamplingOne positive edge of clk; binary values. Non-overlapping implication observes the next sample. Reset and initialization follow the source and contract above.
SubmissionSubmit expressions using the starter’s format. The checks apply to this stated model and scope.
How this is gradedThe reference obligations, independent reachability checks and fault checks must all succeed. An unresolved proof or resource limit is inconclusive and is never a rated miss.

Measured Counterexample

FAIL · bmc · depth 28 · smtbmc yices · 3162 ms

This measured failing run uses the published interface. Follow the sampled violation back to the preceding inputs and state. The worked solution below explains the required behaviour and the failure mechanisms.

Recorded solver trace
01234567891011121314151617181920212223clkfreerstfreegodonest3'b0003'b0013'b0103'b0113'b0003'b0013'b010tickage4'b00004'b00014'b00104'b00114'b01004'b01014'b01104'b01114'b10004'b10014'b10104'b10114'b11004'b11014'b11104'b1111ratio_o3'b010sampled violation
Scroll horizontally ↔

Samples from the measured run. Free input lanes are shaded; the terminal VCD record is omitted.

Sample 22: done=1, st=2, ratio_o=2. Previous sample: tick=1, st=1. done rises as the state becomes 2, so the second transaction finishes one tick early. The run reaches this sample only because the reset and the ratio leave enough of the bound.

Examples

Counting the Bound

reset for 8 cycles, ratio 4, a fault six ticks after reset.
8 + 6 x 5 = 38 cycles. A run at depth 28 stops before it.

The same six ticks cost fewer cycles with a shorter reset and a smaller ratio.

Requirements

  • Use the published ports and widths. The checker and the DUT variants are owned by the judge.
  • Do not add assumptions unless the statement explicitly asks for one. A passing assertion without a reachable trigger is insufficient.

Hints

Hint 1

Count the cycles from the start to the second done: the reset, then six ticks.

Hint 2

A lever has a legal range. Read the data sheet line again before you pick the smallest value.

Hint 3

Use the lever table of the "Clocks and resets as levers" section in F4.7 for the method. Its bench allows a 2-cycle reset and ratio 1; this data sheet does not.

Single clock, binary values, synchronous reset. The judge checks the pinned interface, reachability and the declared proof or bound. UNKNOWN, resource limits and timeouts remain inconclusive.

INCONCLUSIVE never counts as acceptance or a rated miss. Run previews the same checks that Submit uses.

More problems on this topic

Report a problem with this page

Worked solution

Opening the solution ends an unsolved rated attempt. Solving it first costs nothing.

Your Submission (JSON)

SymbiYosys · server

Recent Submissions