Buttons release VHDL
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I need to press some buttons and then release them to go into the next state (if it's the right combination etc)
I searched into my lecturer slides
when s1 =>
temp_unlock <= '1';
unlock <= '0';
if (badge = "00" and col ="001" and row = "0001" and timeover = '0') then
next_state <= s1;
elsif (col = "000" and row = "0000") then
next_state <= s2;
elsif (timeover ='1' or badge = "10") then
next_state <= s0;
else
if (try_counter = 0) then
try_counter := try_counter+1;
next_state <= s1;
elsif (try_counter = 1) then
try_counter := try_counter+1;
next_state <= s1;
elsif (try_counter = 2) then
next_State <= s0;
end if;
end if;
I'm expecting my code to work in this way: one person press the correct button, then he/she releases it and then the machine goes into the next state, I have a doubt about the first elsif, will that condition be enough? I'm not totally sure but according to my lecturer's slide, it is.
vhdl
add a comment |
I need to press some buttons and then release them to go into the next state (if it's the right combination etc)
I searched into my lecturer slides
when s1 =>
temp_unlock <= '1';
unlock <= '0';
if (badge = "00" and col ="001" and row = "0001" and timeover = '0') then
next_state <= s1;
elsif (col = "000" and row = "0000") then
next_state <= s2;
elsif (timeover ='1' or badge = "10") then
next_state <= s0;
else
if (try_counter = 0) then
try_counter := try_counter+1;
next_state <= s1;
elsif (try_counter = 1) then
try_counter := try_counter+1;
next_state <= s1;
elsif (try_counter = 2) then
next_State <= s0;
end if;
end if;
I'm expecting my code to work in this way: one person press the correct button, then he/she releases it and then the machine goes into the next state, I have a doubt about the first elsif, will that condition be enough? I'm not totally sure but according to my lecturer's slide, it is.
vhdl
add a comment |
I need to press some buttons and then release them to go into the next state (if it's the right combination etc)
I searched into my lecturer slides
when s1 =>
temp_unlock <= '1';
unlock <= '0';
if (badge = "00" and col ="001" and row = "0001" and timeover = '0') then
next_state <= s1;
elsif (col = "000" and row = "0000") then
next_state <= s2;
elsif (timeover ='1' or badge = "10") then
next_state <= s0;
else
if (try_counter = 0) then
try_counter := try_counter+1;
next_state <= s1;
elsif (try_counter = 1) then
try_counter := try_counter+1;
next_state <= s1;
elsif (try_counter = 2) then
next_State <= s0;
end if;
end if;
I'm expecting my code to work in this way: one person press the correct button, then he/she releases it and then the machine goes into the next state, I have a doubt about the first elsif, will that condition be enough? I'm not totally sure but according to my lecturer's slide, it is.
vhdl
I need to press some buttons and then release them to go into the next state (if it's the right combination etc)
I searched into my lecturer slides
when s1 =>
temp_unlock <= '1';
unlock <= '0';
if (badge = "00" and col ="001" and row = "0001" and timeover = '0') then
next_state <= s1;
elsif (col = "000" and row = "0000") then
next_state <= s2;
elsif (timeover ='1' or badge = "10") then
next_state <= s0;
else
if (try_counter = 0) then
try_counter := try_counter+1;
next_state <= s1;
elsif (try_counter = 1) then
try_counter := try_counter+1;
next_state <= s1;
elsif (try_counter = 2) then
next_State <= s0;
end if;
end if;
I'm expecting my code to work in this way: one person press the correct button, then he/she releases it and then the machine goes into the next state, I have a doubt about the first elsif, will that condition be enough? I'm not totally sure but according to my lecturer's slide, it is.
vhdl
vhdl
asked Jan 4 at 9:06
AlessandroAlessandro
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I assume s0 is the initial state and s2 is the next state where you wish to jump in case of successful authorization. I also assume badge is the button signal and col ="001" and row = "0001" is the correct combination. Your code has several problems including the following:
First of all, you don't assign value to timeover yet check it twice. Your else statement should handle this. Secondly, you should temporarily unlock the door in the first if condition is satisfied and check for it in the first elsif condition. And finally, := is used for variable assignment, which you rarely deal with. As a synthesizable coding practice, prefer signal assignments with <=.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fstackoverflow.com%2fquestions%2f54035860%2fbuttons-release-vhdl%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
I assume s0 is the initial state and s2 is the next state where you wish to jump in case of successful authorization. I also assume badge is the button signal and col ="001" and row = "0001" is the correct combination. Your code has several problems including the following:
First of all, you don't assign value to timeover yet check it twice. Your else statement should handle this. Secondly, you should temporarily unlock the door in the first if condition is satisfied and check for it in the first elsif condition. And finally, := is used for variable assignment, which you rarely deal with. As a synthesizable coding practice, prefer signal assignments with <=.
add a comment |
I assume s0 is the initial state and s2 is the next state where you wish to jump in case of successful authorization. I also assume badge is the button signal and col ="001" and row = "0001" is the correct combination. Your code has several problems including the following:
First of all, you don't assign value to timeover yet check it twice. Your else statement should handle this. Secondly, you should temporarily unlock the door in the first if condition is satisfied and check for it in the first elsif condition. And finally, := is used for variable assignment, which you rarely deal with. As a synthesizable coding practice, prefer signal assignments with <=.
add a comment |
I assume s0 is the initial state and s2 is the next state where you wish to jump in case of successful authorization. I also assume badge is the button signal and col ="001" and row = "0001" is the correct combination. Your code has several problems including the following:
First of all, you don't assign value to timeover yet check it twice. Your else statement should handle this. Secondly, you should temporarily unlock the door in the first if condition is satisfied and check for it in the first elsif condition. And finally, := is used for variable assignment, which you rarely deal with. As a synthesizable coding practice, prefer signal assignments with <=.
I assume s0 is the initial state and s2 is the next state where you wish to jump in case of successful authorization. I also assume badge is the button signal and col ="001" and row = "0001" is the correct combination. Your code has several problems including the following:
First of all, you don't assign value to timeover yet check it twice. Your else statement should handle this. Secondly, you should temporarily unlock the door in the first if condition is satisfied and check for it in the first elsif condition. And finally, := is used for variable assignment, which you rarely deal with. As a synthesizable coding practice, prefer signal assignments with <=.
answered Jan 9 at 16:46
HusrevHusrev
12
12
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f54035860%2fbuttons-release-vhdl%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