Next-State Tables

digital-logicstate-machines

Could someone give me some tips on how to approach state tables? I'm working through my textbook for an upcoming exam and I'm stuck at this problem:

17) Design a circuit that has an input clk, and an output Q which has three bits. At the rising edge of the clk, the unsigned binary number represented by Q changes according to the pattern: 04725631047256310…In other words, it starts with 0 and repeats 04725631 every 8 clock cycles.

I then have to fill out a state-table with Q2, Q1, Q0, D2, D2, D1.

How would one approach this?

Best Answer

You start with the basic form:

Inputs  |  Outputs
------------------
        |

Then you figure out what your inputs and your outputs are. In this case, your inputs are just the current state, and the output is the next state you're going to switch to:

Q2 Q1 Q0 | Q2' Q1' Q0'
----------------------
         |

Now just start filling it in. To get started, when the current state is 0, according to your spec the next state is 4:

Q2 Q1 Q0 | Q2' Q1' Q0'
----------------------
0   0  0 |  1   0   0
0   0  1 |  
0   1  0 |  
0   1  1 | 
...

You just need to fill in the rest of the outputs according to the sequence you want to count over.