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

Discussion Overview

The discussion revolves around the design of a clocked synchronous state machine that counts the number of 1 inputs from two inputs, X and Y, and outputs a signal Z based on whether this count is a multiple of 4. The participants explore the number of flip-flops required for this design, considering the implications of state representation and the handling of unused states.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant suggests that 2 flip-flops are sufficient since each can represent two states, leading to a total of four states needed for counting modulo 4.
  • Another participant argues that 3 flip-flops may be necessary, citing the importance of including a Reset state in the state diagram.
  • A further contribution notes that with 3 flip-flops, there will be unused states, and emphasizes the need for logic design to ensure that any illegal states revert to a legal state, typically the Reset state.
  • One participant expresses confusion regarding the output condition for Z, questioning the relationship between the inputs X and Y and the requirement for four states.
  • A later reply provides a hint by suggesting a state list that outlines the conditions under which Z outputs 1, indicating the need for clarity on how states correspond to multiples of the input sum.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the number of flip-flops required, with differing opinions on whether 2 or 3 flip-flops are necessary. The discussion includes uncertainty regarding the output conditions and the handling of unused states.

Contextual Notes

There are unresolved assumptions about the state representation and the specific conditions under which the output Z is activated. The discussion also highlights potential dependencies on the definitions of states and the handling of illegal states in the design.

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
4K
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