FVO — Formal Verification Online
Lesson 14.5 · Handshakes and Credit-Based Flow Control

Formal properties for a credit link

Here is a complete property set for a credit-based link, grouped by what each property protects.

PropertyProtects againstForm
No overdraft: send only with a creditSender ignoring its countertx_take |-> credits != 0
Credit ceilingDuplicated credits (double return)credits <= DEPTH
No overflowData arriving at a full bufferlink_vld |-> rx_count < DEPTH
ConservationLost or created credits anywheresum of all locations == DEPTH
No deadlockAll credits lostnot (no credits and nothing in flight and buffer empty)
Work conservingSender stalling with credits in handtx_valid && credits != 0 |-> tx_take
Liveness (optional)Starvationtx_valid |-> s_eventually tx_take, with a fairness assumption on the consumer
core credit properties
// credits on the forward link and on the return path are one bit each here
wire [7:0] total = 8'(credits) + 8'(link_vld) + 8'(rx_count) + 8'(cred_ret);

a_conserve:     assert property (total == 8'(DEPTH));
a_no_overdraft: assert property (tx_take |-> credits != '0);
a_credit_max:   assert property (credits <= CW'(DEPTH));
a_no_overflow:  assert property (link_vld |-> rx_count < CW'(DEPTH));

Deeper links: model the pipeline

With a link of several pipeline stages, "data in flight" is a count, not one bit. Write it as auxiliary code: a counter that goes up when the sender sends and down when data arrives at the receiver (and the same for returning credits). The conservation property keeps the same shape.

Liveness needs fairness

"The sender eventually sends" is only true if the receiver's consumer eventually pops. Without that, the tool shows a trivial counterexample: the consumer simply never reads. State the environment promise explicitly:

liveness with fairness
am_consumer_fair: assume property (rx_valid |-> s_eventually rx_pop);
a_tx_progress:    assert property (tx_valid |-> s_eventually tx_take);

Data integrity

Credit logic is about space. Check data separately with the tracked-item technique from Chapter 6: choose one arbitrary sent item, count the items in front of it across the link and the buffer, and check that it pops out unchanged and in order.

Discussion

No comments yet.

Was this page helpful?

Tip: select any text on the page before clicking Report and it will be quoted in your report.