Design at most 3 flip-flops that reach all 8 of their states within two clock cycles.
Explore reachable states numbers its iterations from 0: iteration 0 holds the initial states, and iteration k every state reached within k clock cycles. The fixpoint is the first iteration whose image adds no new state, one after the last iteration that added one. A design whose farthest state lies k clock cycles from the initial state has its fixpoint at iteration k + 1.
A 4-bit one-hot ring starts at 0001, and while en is 1 each clock moves its single 1 one place: 0010, 0100, 1000, then 0001 again.
en
Each iteration adds one state, the next in the ring: iteration 3 adds 1000, the farthest state, 3 clock cycles from the start.
Iteration 4 adds nothing, so the fixpoint is at iteration 4, with 4 reachable states of the 16 codes.
With one new state per iteration, the fixpoint comes as late as the number of states allows.
Write a design with at most 3 flip-flops that reaches all 8 of their states, with its fixpoint at iteration 3: every state is reached within two clock cycles of the initial state.
A Verilog module with a clock input clk, at most 3 flip-flops with initial values in their declaration, and any inputs you need; reg [1:0] r = 2'd0; declares a 2-bit register that starts at 0. Press Build to convert it with Yosys; reachability then runs to its fixpoint, as Run to the fixpoint does in Explore reachable states.
clk
reg [1:0] r = 2'd0;
At most 3 flip-flops, with initial values.
Exactly 8 reachable states.
The fixpoint at iteration 3, as Explore reachable states counts iterations.
Press Build: the conditions then show the flip-flops, the reachable states and the fixpoint's iteration.
Count how many new states each iteration of your design can add, as the example counts the ring's: to have all 8 states by iteration 2, the first two images together must add 7.
Kata 7.4 of Binary Decision Diagrams with CUDD on formal.org. The site checks the answer when you press Check answer; sign in to keep your progress.