Change a counter so that it reaches exactly 5 states.
Reachability starts from the initial states, which the flip-flops' initial values give. At each iteration it adds the image of the states reached so far: the states that one clock cycle reaches from them, for some input. It stops at the fixpoint, when an image adds no new state. The states reached by then are the reachable states; the other codes of the flip-flops never occur.
A Johnson counter has 3 flip-flops q, starting at 000. On each clock it shifts left and feeds the inverted top bit into bit 0: q <= {q[1:0], ~q[2]}.
q
q <= {q[1:0], ~q[2]}
From 000 it goes to 001, 011, 111, 110 and 100, then back to 000. Each iteration adds one new state.
The codes 010 and 101 are never reached: no state on that cycle leads to them.
So the Johnson counter reaches 6 of its 8 codes, with its fixpoint at iteration 6.
The counter in the editor starts at 0 and adds 1 on each clock cycle while en is 1, so it reaches 8 states.
en
Change it so that it reaches exactly 5 states. Give its flip-flops an initial value in their declaration, as the counter does, so that reachability knows where it starts.
A Verilog module with a clock input clk and flip-flops whose initial values are given in their declaration, as output reg [2:0] q = 3'd0 does in the counter. Press Build to convert it with Yosys; reachability then runs to its fixpoint, as Run to the fixpoint does in Explore reachable states.
clk
output reg [2:0] q = 3'd0
A Verilog module with flip-flops.
Exactly 5 reachable states, counted as Explore reachable states counts them.
Press Build: the conditions then show your design's flip-flops and its reachable states.
List the states by hand from the initial one, as the example does, and compare your count with the one shown.
If the count is off, find the first state where your list and your design part ways, and read the assignment that leads out of it.
Kata 7.1 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.