Buttons release VHDL





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















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.










share|improve this question





























    0















    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.










    share|improve this question

























      0












      0








      0








      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.










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 4 at 9:06









      AlessandroAlessandro

      1




      1
























          1 Answer
          1






          active

          oldest

          votes


















          0














          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 <=.






          share|improve this answer
























            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
            });


            }
            });














            draft saved

            draft discarded


















            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









            0














            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 <=.






            share|improve this answer




























              0














              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 <=.






              share|improve this answer


























                0












                0








                0







                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 <=.






                share|improve this answer













                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 <=.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 9 at 16:46









                HusrevHusrev

                12




                12
































                    draft saved

                    draft discarded




















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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

                    Mossoró

                    Error while reading .h5 file using the rhdf5 package in R

                    Pushsharp Apns notification error: 'InvalidToken'