Notebook 25: SMV Step Simulator
Step through three SMV models from the lecture notes one transition at a time: the flip-flop, the modulo-4 counter, and the five-digit mechanical counter with carry and reset.
SMV Step Simulator
Chapter 7 introduces SMV by simulating small models one next() step at a time. This notebook is a hands-on version of that same simulation loop for the three running examples of the chapter: the flip-flop, the modulo-4 counter, and the five-digit mechanical counter with carry propagation and a reset input.
Each click computes next(v) from the current valuation of every variable, exactly as the ASSIGN block specifies—there is no lookahead and no hidden state beyond what’s shown.
Current state
Trace
What to try
- Flip-flop and modulo-4 counter are both fully deterministic—every click has exactly one possible outcome, matching
ex:flipflopandsec:smv-mod4in the chapter. - Mechanical counter, no reset. Click
Stepnine times and watchd0climb from0to9; on the tenth click,d0wraps to0andcarry_outbecomes true for one step, which is exactly what pushesd1from0to1. This is the carry-propagation logic fromsec:mech-countermade visible one digit at a time. - Push reset mid-count. Tick “push
reseton next step” after a few increments, then clickStep—every digit snaps back to0in a single transition, exactly asIVAR resetis modelled: an environment input, unconstrained until the moment you choose its value.
[!TIP] Read the full chapter in the PDF
For the
ASSIGN/casesemantics behind every step here, see Chapter 7, §“The SMV Modelling Language” and §“Modules: Hierarchical Modelling”.
Download the Full Lecture Notes (PDF)