Followed-By: #-# and #=#
Say that a scenario must happen and be followed by a property, with #-# and #=#, the partners of |-> and |=>.
You Will Be Able To
- Write a rule where the left side must happen, with
#-#or#=#. - Tell followed-by from implication on the same trace.
- Use followed-by in assumptions and covers, and know its duality with implication.
- Lesson
- A3.7
- Time
- 20 min
- Runs on
- Verilator
- Check
- 5 questions
A rule says "every packet start carries a header, then beats until the last one". Written as sop && hdr |=> ..., a packet with no header is never checked.
Implication
sop && hdr |=> beat until_with last
No header: vacuous success.
Followed-by
sop |-> (hdr #=# (beat until_with last))
No header: failure.
Followed-by makes the left side an obligation. This lesson shows both forms and where each fits.
Overlapped Followed-By: #-#
s #-# p holds when s matches and p holds from the edge where s ends (IEEE 1800-2023 16.12.9). If s does not match, the property fails.
| Left side | s |-> p | s #-# p |
|---|---|---|
| matches, p holds | pass | pass |
| matches, p fails | fail | fail |
| does not match | vacuous success | fail |
The only difference is the last row.
Non-Overlapped Followed-By: #=#
s #=# p starts p one edge after s ends, like |=>. The left side must still match.
Edges 1 to 15. Packet 1 is good. Packet 2 has no header. Packet 3 drops a beat before its last one.
Followed-by is strong (16.12.9): with a Boolean p, s #=# p means strong(s ##1 p). An attempt that the end of the run cuts short is false. The bare sequence s ##1 p is weak, so the same attempt does not fail.
| Case | Standard (16.12.9) | Verilator 5.052 (measured) |
|---|---|---|
req #=# ack at every edge; one attempt fails on ack while the next fails on req, at the same edge | two failures at that edge | one failure reported |
#-# at every edge, same trace | one failure per failing attempt | one failure per failing attempt |
a multi-cycle sequence before the operator: a ##1 b #=# c | legal | rejected ("sequence expression as antecedent of followed-by") |
start |-> (cfg #=# run) with start at the last edge | false: run never comes | no failure reported |
Measured by tools/probes/sva-w1a/followed-by.mjs. On 5.052, keep a Boolean before #=# and space its attempts, as the packet rule does.
Followed-By Is the Dual of Implication
Followed-by is implication turned inside out: s #-# p means not (s |-> not p), and s #=# p means not (s |=> not p) (16.12.9).
- Property
- Structure
- Negate the consequent
"If s, then never p."
- Negate the whole rule
It fails when s does not happen, or when p fails: that is followed-by.
Read the diagram as text
- s |-> p: if s, then p
- s |-> not p: if s, then never p
- not (s |-> not p): s happens and p holds
- s #-# p: the same rule
- s |-> p → s |-> not p: negate p
- s |-> not p → not (s |-> not p): negate all
- not (s |-> not p) → s #-# p: equals
A vacuous implication becomes a failing followed-by.
Followed-By in Assumptions and Covers
In an assumption, followed-by states a bench promise that a scenario will happen: "every start comes with a config". In a cover, s #=# p counts the runs where s happens and p follows.
Try It
Packet 1 has a header and its beats run until last at 35: both rules pass.
Packet 2 starts at 55 with no header. must fails there. if_hdr never starts an attempt, so it reports nothing.
Change must to use #-# and predict when beat must start.
must=1 if_hdr=0Check Yourself
Common Mistakes
Wrong Use an implication when the left side must happen.
A missing left side makes the implication vacuous, so the bug passes.
Fix Use followed-by, which fails when the left side does not match.
sop && hdr |=> beat until_with lastsop |-> (hdr #=# (beat until_with last))Wrong Assert s #=# p on every edge.
It then fails on every edge where s is absent.
Fix Put it behind the event that makes s due, such as sop |-> (...).
Wrong Mix up #-# and #=#.
They differ by one edge, exactly like |-> and |=>.
Fix Use #-# for "from the same edge", #=# for "from the next edge".
Remember
s #-# pands #=# pneed s to match;|->and|=>succeed vacuously without it.#-#starts p where s ends;#=#one edge later.- Followed-by is the dual of implication:
s #-# pisnot (s |-> not p). - Followed-by fits assumptions and covers: a scenario that must happen, or one to count.