2
$\begingroup$

My task is to design a FSM whose output goes high for a single cycle whenever the pattern 0110 is detected on its input. The patterns may overlap, so an input 0110110 of would cause the output to go high twice- once for the first pattern (0110110), and once for the second pattern (0110110). a is used for the input and f is used for the output.

I am assuming I will need five state bubbles like this.

Is this correct or am I missing some cases based on the pattern going high twice if the pattern overlaps?

babou
19.6k43 silver badges77 bronze badges
asked Jul 25, 2013 at 1:30
$\endgroup$
8
  • 1
    $\begingroup$ The idea of output going "high" or "low" is probably not particularly familiar to Computer Scientists. I suspect most people here learned finite automata in terms of acceptor machines, reading in a string then either accepting or rejecting it. Are you using this for circuit/electrical design? $\endgroup$ Commented Jul 25, 2013 at 6:31
  • $\begingroup$ Possible dup: cs.stackexchange.com/q/11780/755 $\endgroup$ Commented Jul 26, 2013 at 6:10
  • 1
    $\begingroup$ @jmite: I know Computer Science is not about computers, but let's be honest: we know that much. At least I do :) $\endgroup$ Commented Aug 1, 2013 at 15:47
  • 1
    $\begingroup$ It depends highly on the type of CS education, particularly whether a school does it as part of science or engineering. I'm not saying it's off topic, I'm just asking for some background. $\endgroup$ Commented Aug 1, 2013 at 16:12
  • 1
    $\begingroup$ This is certainly not a duplicate of a question about nondeterministic finite automata: the asker seems to be looking for a circuit design and real electronic circuits are not nondeterministic. I also don't think the question is unclear so I'm voting to leave open. $\endgroup$ Commented Apr 1, 2015 at 7:46

2 Answers 2

3
$\begingroup$

It looks like you're missing the overlap case, if I understand your diagram correctly. This does the trick:

A // goto B if read 0 else stay
B // goto C if read 1 else stay
C // goto D if read 1 else goto B
D // goto E if read 0 else goto A
E // emit rising edge, goto B

assuming that you have a falling edge after every read.

answered Jul 25, 2013 at 8:13
$\endgroup$
0
1
$\begingroup$

This problem is just an instance of the substring searching problem, for the specific substring 0110ドル$. There are several algorithms that solve it.

Given that the search is to be done in real-time, I guess the best algorithm is the Knuth-Morris-Pratt algorithm. For any string to be searched, the KMP algorithm will compute the table for a DFA that recognizes all occurences of that string in any string given as input.

Note however that the finite state device to be constructed is not really a DFA, but a deterministic finite state transducer (also known as Generalized sequential machines - GSM), as it has an output for each transition, which is either low or high. The words low and high may be taken as symbol of an output alphabet, even if they have physical meaning in the context of the question.

I leave it as an exercise to apply the KMP algorithm to the specific example of the question, since the question is actually asking how to design the finite state transducer, and is not asking to actually do it.

answered Apr 1, 2015 at 8:19
$\endgroup$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.