Designing a sequence detector(0110)












2














I asked to design a sequence detector to detect 0110 and when this sequence happend turn it's output to 1 for 2 clock cycles.



Here is what I designed:
enter image description hereenter image description here



But the problem is it turns the output to 1, one clock cycle late IE if it encountered 0110 it doesn't turn output to 1 but instead it turns output to 1 on next positive edge of clk as you can see in below timing diagram.



I tried so much to solve it but I can't :(
Can someone help me please



enter image description here



Edit: I have to add I know the problem is: y2 D flip flop is synchronised with Q1 D flip flop but what to do instead?



Edit 2:



New state diagram



enter image description here



Edit 3:



New state diagram



enter image description here










share|improve this question
























  • Its also worth mentioning that you can use multiplexers to build FSMs too (in fact, this is the most common way). This is done by using the output bits from the flipflops as the address bits for the MUX, thus you can design most FSMs relatively easily using the transition table, without the need to solve Karnaugh maps. decoding Mealey and Moore outputs is then a fairly mundane task you are probably familiar with already :)
    – Thefoilist
    29 mins ago
















2














I asked to design a sequence detector to detect 0110 and when this sequence happend turn it's output to 1 for 2 clock cycles.



Here is what I designed:
enter image description hereenter image description here



But the problem is it turns the output to 1, one clock cycle late IE if it encountered 0110 it doesn't turn output to 1 but instead it turns output to 1 on next positive edge of clk as you can see in below timing diagram.



I tried so much to solve it but I can't :(
Can someone help me please



enter image description here



Edit: I have to add I know the problem is: y2 D flip flop is synchronised with Q1 D flip flop but what to do instead?



Edit 2:



New state diagram



enter image description here



Edit 3:



New state diagram



enter image description here










share|improve this question
























  • Its also worth mentioning that you can use multiplexers to build FSMs too (in fact, this is the most common way). This is done by using the output bits from the flipflops as the address bits for the MUX, thus you can design most FSMs relatively easily using the transition table, without the need to solve Karnaugh maps. decoding Mealey and Moore outputs is then a fairly mundane task you are probably familiar with already :)
    – Thefoilist
    29 mins ago














2












2








2







I asked to design a sequence detector to detect 0110 and when this sequence happend turn it's output to 1 for 2 clock cycles.



Here is what I designed:
enter image description hereenter image description here



But the problem is it turns the output to 1, one clock cycle late IE if it encountered 0110 it doesn't turn output to 1 but instead it turns output to 1 on next positive edge of clk as you can see in below timing diagram.



I tried so much to solve it but I can't :(
Can someone help me please



enter image description here



Edit: I have to add I know the problem is: y2 D flip flop is synchronised with Q1 D flip flop but what to do instead?



Edit 2:



New state diagram



enter image description here



Edit 3:



New state diagram



enter image description here










share|improve this question















I asked to design a sequence detector to detect 0110 and when this sequence happend turn it's output to 1 for 2 clock cycles.



Here is what I designed:
enter image description hereenter image description here



But the problem is it turns the output to 1, one clock cycle late IE if it encountered 0110 it doesn't turn output to 1 but instead it turns output to 1 on next positive edge of clk as you can see in below timing diagram.



I tried so much to solve it but I can't :(
Can someone help me please



enter image description here



Edit: I have to add I know the problem is: y2 D flip flop is synchronised with Q1 D flip flop but what to do instead?



Edit 2:



New state diagram



enter image description here



Edit 3:



New state diagram



enter image description here







digital-logic circuit-design sequence-detector






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago

























asked 3 hours ago









Me.

185




185












  • Its also worth mentioning that you can use multiplexers to build FSMs too (in fact, this is the most common way). This is done by using the output bits from the flipflops as the address bits for the MUX, thus you can design most FSMs relatively easily using the transition table, without the need to solve Karnaugh maps. decoding Mealey and Moore outputs is then a fairly mundane task you are probably familiar with already :)
    – Thefoilist
    29 mins ago


















  • Its also worth mentioning that you can use multiplexers to build FSMs too (in fact, this is the most common way). This is done by using the output bits from the flipflops as the address bits for the MUX, thus you can design most FSMs relatively easily using the transition table, without the need to solve Karnaugh maps. decoding Mealey and Moore outputs is then a fairly mundane task you are probably familiar with already :)
    – Thefoilist
    29 mins ago
















Its also worth mentioning that you can use multiplexers to build FSMs too (in fact, this is the most common way). This is done by using the output bits from the flipflops as the address bits for the MUX, thus you can design most FSMs relatively easily using the transition table, without the need to solve Karnaugh maps. decoding Mealey and Moore outputs is then a fairly mundane task you are probably familiar with already :)
– Thefoilist
29 mins ago




Its also worth mentioning that you can use multiplexers to build FSMs too (in fact, this is the most common way). This is done by using the output bits from the flipflops as the address bits for the MUX, thus you can design most FSMs relatively easily using the transition table, without the need to solve Karnaugh maps. decoding Mealey and Moore outputs is then a fairly mundane task you are probably familiar with already :)
– Thefoilist
29 mins ago










1 Answer
1






active

oldest

votes


















4














You need to come up with a state diagram (your very first step) that actually does what you want, before going through all of the detailed logic design.



With a Moore-type machine (outputs associated with states), it requires 5 states to recognize the sequence and then output a "1". Then, you need to replicate 2 of the states in order to output a "1" for a second clock while continuing to search for another copy of the pattern. Therefore, a total of 7 states is required.



I hope this is enough of a hint to get you on the right track.





Just for completeness, following your third edit, here is my version of the state diagram:



enter image description here



I find it helpful to label each state with what part of the sequence has been recognized so far. Some notes:




  • S0 represents finding 3 or more ones in a row. Since the pattern we're looking for starts with a zero, this also becomes our "start" state.


  • S1 represents finding any number of zeros, the last one of which could be the first bit of our pattern.


  • S4 represents finding the full pattern. The last bit is zero, which could also be the first bit of another pattern. Therefore, if the next bit is also zero, we go to state S1a, which is equivalent to S1, but with an output of "1". Similarly, if the next bit is "1", we've got the first two bits of a new pattern, so we go to S2a.


  • The transitions out of S1a are the same as those from S1, and the transitions from S2a are the same as those for S2.







share|improve this answer























  • I didn't see any question like this before in our sourcebook, can you please give an example. oh and isn't there a way to store output in a shift register like what I did?
    – Me.
    2 hours ago










  • can you please check the new state diagram to see if is correct right now? if yes why not simply add one more state instead of two states?
    – Me.
    2 hours ago










  • You need two extra states because once you get to state S4 after recognizing the full sequence, you need to output a "1" on the next state after that regardless of whether the next input is "0" or "1". Your new diagram still does not do that -- if you get a "1" in state S4, you go to a state that outputs "0".
    – Dave Tweed
    2 hours ago










  • think got it, can you just see this too? thanks for your time
    – Me.
    1 hour ago










  • OK, your "Edit 3" version now looks like mine. You can proceed with the rest of the detailed design.
    – Dave Tweed
    1 hour ago











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");

StackExchange.ifUsing("editor", function () {
return StackExchange.using("schematics", function () {
StackExchange.schematics.init();
});
}, "cicuitlab");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "135"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f414585%2fdesigning-a-sequence-detector0110%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














You need to come up with a state diagram (your very first step) that actually does what you want, before going through all of the detailed logic design.



With a Moore-type machine (outputs associated with states), it requires 5 states to recognize the sequence and then output a "1". Then, you need to replicate 2 of the states in order to output a "1" for a second clock while continuing to search for another copy of the pattern. Therefore, a total of 7 states is required.



I hope this is enough of a hint to get you on the right track.





Just for completeness, following your third edit, here is my version of the state diagram:



enter image description here



I find it helpful to label each state with what part of the sequence has been recognized so far. Some notes:




  • S0 represents finding 3 or more ones in a row. Since the pattern we're looking for starts with a zero, this also becomes our "start" state.


  • S1 represents finding any number of zeros, the last one of which could be the first bit of our pattern.


  • S4 represents finding the full pattern. The last bit is zero, which could also be the first bit of another pattern. Therefore, if the next bit is also zero, we go to state S1a, which is equivalent to S1, but with an output of "1". Similarly, if the next bit is "1", we've got the first two bits of a new pattern, so we go to S2a.


  • The transitions out of S1a are the same as those from S1, and the transitions from S2a are the same as those for S2.







share|improve this answer























  • I didn't see any question like this before in our sourcebook, can you please give an example. oh and isn't there a way to store output in a shift register like what I did?
    – Me.
    2 hours ago










  • can you please check the new state diagram to see if is correct right now? if yes why not simply add one more state instead of two states?
    – Me.
    2 hours ago










  • You need two extra states because once you get to state S4 after recognizing the full sequence, you need to output a "1" on the next state after that regardless of whether the next input is "0" or "1". Your new diagram still does not do that -- if you get a "1" in state S4, you go to a state that outputs "0".
    – Dave Tweed
    2 hours ago










  • think got it, can you just see this too? thanks for your time
    – Me.
    1 hour ago










  • OK, your "Edit 3" version now looks like mine. You can proceed with the rest of the detailed design.
    – Dave Tweed
    1 hour ago
















4














You need to come up with a state diagram (your very first step) that actually does what you want, before going through all of the detailed logic design.



With a Moore-type machine (outputs associated with states), it requires 5 states to recognize the sequence and then output a "1". Then, you need to replicate 2 of the states in order to output a "1" for a second clock while continuing to search for another copy of the pattern. Therefore, a total of 7 states is required.



I hope this is enough of a hint to get you on the right track.





Just for completeness, following your third edit, here is my version of the state diagram:



enter image description here



I find it helpful to label each state with what part of the sequence has been recognized so far. Some notes:




  • S0 represents finding 3 or more ones in a row. Since the pattern we're looking for starts with a zero, this also becomes our "start" state.


  • S1 represents finding any number of zeros, the last one of which could be the first bit of our pattern.


  • S4 represents finding the full pattern. The last bit is zero, which could also be the first bit of another pattern. Therefore, if the next bit is also zero, we go to state S1a, which is equivalent to S1, but with an output of "1". Similarly, if the next bit is "1", we've got the first two bits of a new pattern, so we go to S2a.


  • The transitions out of S1a are the same as those from S1, and the transitions from S2a are the same as those for S2.







share|improve this answer























  • I didn't see any question like this before in our sourcebook, can you please give an example. oh and isn't there a way to store output in a shift register like what I did?
    – Me.
    2 hours ago










  • can you please check the new state diagram to see if is correct right now? if yes why not simply add one more state instead of two states?
    – Me.
    2 hours ago










  • You need two extra states because once you get to state S4 after recognizing the full sequence, you need to output a "1" on the next state after that regardless of whether the next input is "0" or "1". Your new diagram still does not do that -- if you get a "1" in state S4, you go to a state that outputs "0".
    – Dave Tweed
    2 hours ago










  • think got it, can you just see this too? thanks for your time
    – Me.
    1 hour ago










  • OK, your "Edit 3" version now looks like mine. You can proceed with the rest of the detailed design.
    – Dave Tweed
    1 hour ago














4












4








4






You need to come up with a state diagram (your very first step) that actually does what you want, before going through all of the detailed logic design.



With a Moore-type machine (outputs associated with states), it requires 5 states to recognize the sequence and then output a "1". Then, you need to replicate 2 of the states in order to output a "1" for a second clock while continuing to search for another copy of the pattern. Therefore, a total of 7 states is required.



I hope this is enough of a hint to get you on the right track.





Just for completeness, following your third edit, here is my version of the state diagram:



enter image description here



I find it helpful to label each state with what part of the sequence has been recognized so far. Some notes:




  • S0 represents finding 3 or more ones in a row. Since the pattern we're looking for starts with a zero, this also becomes our "start" state.


  • S1 represents finding any number of zeros, the last one of which could be the first bit of our pattern.


  • S4 represents finding the full pattern. The last bit is zero, which could also be the first bit of another pattern. Therefore, if the next bit is also zero, we go to state S1a, which is equivalent to S1, but with an output of "1". Similarly, if the next bit is "1", we've got the first two bits of a new pattern, so we go to S2a.


  • The transitions out of S1a are the same as those from S1, and the transitions from S2a are the same as those for S2.







share|improve this answer














You need to come up with a state diagram (your very first step) that actually does what you want, before going through all of the detailed logic design.



With a Moore-type machine (outputs associated with states), it requires 5 states to recognize the sequence and then output a "1". Then, you need to replicate 2 of the states in order to output a "1" for a second clock while continuing to search for another copy of the pattern. Therefore, a total of 7 states is required.



I hope this is enough of a hint to get you on the right track.





Just for completeness, following your third edit, here is my version of the state diagram:



enter image description here



I find it helpful to label each state with what part of the sequence has been recognized so far. Some notes:




  • S0 represents finding 3 or more ones in a row. Since the pattern we're looking for starts with a zero, this also becomes our "start" state.


  • S1 represents finding any number of zeros, the last one of which could be the first bit of our pattern.


  • S4 represents finding the full pattern. The last bit is zero, which could also be the first bit of another pattern. Therefore, if the next bit is also zero, we go to state S1a, which is equivalent to S1, but with an output of "1". Similarly, if the next bit is "1", we've got the first two bits of a new pattern, so we go to S2a.


  • The transitions out of S1a are the same as those from S1, and the transitions from S2a are the same as those for S2.








share|improve this answer














share|improve this answer



share|improve this answer








edited 1 hour ago

























answered 2 hours ago









Dave Tweed

117k9144256




117k9144256












  • I didn't see any question like this before in our sourcebook, can you please give an example. oh and isn't there a way to store output in a shift register like what I did?
    – Me.
    2 hours ago










  • can you please check the new state diagram to see if is correct right now? if yes why not simply add one more state instead of two states?
    – Me.
    2 hours ago










  • You need two extra states because once you get to state S4 after recognizing the full sequence, you need to output a "1" on the next state after that regardless of whether the next input is "0" or "1". Your new diagram still does not do that -- if you get a "1" in state S4, you go to a state that outputs "0".
    – Dave Tweed
    2 hours ago










  • think got it, can you just see this too? thanks for your time
    – Me.
    1 hour ago










  • OK, your "Edit 3" version now looks like mine. You can proceed with the rest of the detailed design.
    – Dave Tweed
    1 hour ago


















  • I didn't see any question like this before in our sourcebook, can you please give an example. oh and isn't there a way to store output in a shift register like what I did?
    – Me.
    2 hours ago










  • can you please check the new state diagram to see if is correct right now? if yes why not simply add one more state instead of two states?
    – Me.
    2 hours ago










  • You need two extra states because once you get to state S4 after recognizing the full sequence, you need to output a "1" on the next state after that regardless of whether the next input is "0" or "1". Your new diagram still does not do that -- if you get a "1" in state S4, you go to a state that outputs "0".
    – Dave Tweed
    2 hours ago










  • think got it, can you just see this too? thanks for your time
    – Me.
    1 hour ago










  • OK, your "Edit 3" version now looks like mine. You can proceed with the rest of the detailed design.
    – Dave Tweed
    1 hour ago
















I didn't see any question like this before in our sourcebook, can you please give an example. oh and isn't there a way to store output in a shift register like what I did?
– Me.
2 hours ago




I didn't see any question like this before in our sourcebook, can you please give an example. oh and isn't there a way to store output in a shift register like what I did?
– Me.
2 hours ago












can you please check the new state diagram to see if is correct right now? if yes why not simply add one more state instead of two states?
– Me.
2 hours ago




can you please check the new state diagram to see if is correct right now? if yes why not simply add one more state instead of two states?
– Me.
2 hours ago












You need two extra states because once you get to state S4 after recognizing the full sequence, you need to output a "1" on the next state after that regardless of whether the next input is "0" or "1". Your new diagram still does not do that -- if you get a "1" in state S4, you go to a state that outputs "0".
– Dave Tweed
2 hours ago




You need two extra states because once you get to state S4 after recognizing the full sequence, you need to output a "1" on the next state after that regardless of whether the next input is "0" or "1". Your new diagram still does not do that -- if you get a "1" in state S4, you go to a state that outputs "0".
– Dave Tweed
2 hours ago












think got it, can you just see this too? thanks for your time
– Me.
1 hour ago




think got it, can you just see this too? thanks for your time
– Me.
1 hour ago












OK, your "Edit 3" version now looks like mine. You can proceed with the rest of the detailed design.
– Dave Tweed
1 hour ago




OK, your "Edit 3" version now looks like mine. You can proceed with the rest of the detailed design.
– Dave Tweed
1 hour ago


















draft saved

draft discarded




















































Thanks for contributing an answer to Electrical Engineering Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f414585%2fdesigning-a-sequence-detector0110%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bundesstraße 106

Verónica Boquete

Ida-Boy-Ed-Garten