Designing a sequence detector(0110)
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:
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
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
Edit 3:
New state diagram
digital-logic circuit-design sequence-detector
add a comment |
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:
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
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
Edit 3:
New state diagram
digital-logic circuit-design sequence-detector
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
add a comment |
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:
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
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
Edit 3:
New state diagram
digital-logic circuit-design sequence-detector
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:
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
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
Edit 3:
New state diagram
digital-logic circuit-design sequence-detector
digital-logic circuit-design sequence-detector
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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:
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.
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
|
show 1 more comment
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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:
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.
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
|
show 1 more comment
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:
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.
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
|
show 1 more comment
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:
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.
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:
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.
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
|
show 1 more comment
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
|
show 1 more comment
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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