Are Two Flip-Flops Sufficient for a Modulo 4 State Machine?

  • Thread starter Thread starter success2be
  • Start date Start date
  • Tags Tags
    Per State
Click For Summary
SUMMARY

The discussion centers on designing a clocked synchronous state machine that counts the number of 1 inputs from two inputs, X and Y, and outputs Z based on whether this count is a multiple of 4. It is established that a modulo 4 state machine requires four distinct states, which can be represented using two flip-flops. However, some participants suggest that three flip-flops may be necessary to account for unused states and the reset condition. The importance of designing the logic circuit to handle illegal states by reverting to a legal reset state is emphasized.

PREREQUISITES
  • Understanding of synchronous state machines
  • Knowledge of flip-flop functionality and state representation
  • Familiarity with modulo operations in digital design
  • Experience with state diagram creation and logic circuit design
NEXT STEPS
  • Research the design of synchronous state machines using Verilog or VHDL
  • Study the implementation of modulo counters in digital circuits
  • Learn about handling illegal states in state machine design
  • Explore the use of state diagrams for visualizing state transitions
USEFUL FOR

Digital circuit designers, electrical engineering students, and professionals involved in state machine design and implementation will benefit from this discussion.

success2be
Messages
9
Reaction score
0
How many flip-flops do I need based on the following requirement? I'm thinking 2 flip-flop since each flip-flop can be a 0 or 1. So each flip-flop holds 2 states.

Design a clocked synchronous state machine with two inputs, X and Y, and one output, Z. The output should be 1 if the number of 1 inputs on X and Y since reset is a multiple of 4, and 0 otherwise.

At first glance, you might think the machine needs an infinite number of states, since it counts 1 inputs over an arbitrarily long time. However, since the output indicates the number of inputs received modulo 4, four states are sufficient.
 
Engineering news on Phys.org
I think it may require one more FF for a total of three FFs. Hint -- don't forget the Reset state in your state diagram...
 
Oh, and with 3 FFs, you will end up having some unused states. Be sure to design your logic circuit so that if you end up in one of those illegal states, you vector back to a legal state (usually the Reset state).
 
I don't think I'm understanding the requirements correctly.

When does Z output 1? It reads as if Z outputs 1 when X & Y are 1, but then why do I need 4 states / 4 modulus?
 
Here's a little bigger hint, but hopefully not the whole answer. I'd start with a list of the states something like the following:

0 = 0b000 = reset or idle state (or sum=0 for multiple clocks)
1 = 0b001 : sum=sum+X+Y=multiple of 1; Z=0
2 = 0b002 : sum=sum+X+Y=multiple of 2; Z=0
3 = 0b003 : sum=sum+X+Y=multiple of 3; Z=0
4 = 0b004 : sum=sum+X+Y=multiple of 4; Z=1
5 unused state
6 unused state
7 unused state
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
9K
Replies
20
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K
Replies
5
Views
9K
  • · Replies 1 ·
Replies
1
Views
28K
  • · Replies 2 ·
Replies
2
Views
18K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
3K
Replies
1
Views
3K