Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6827211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:14:22+00:00 2026-05-26T22:14:22+00:00

This is the full code library ieee; use ieee.std_logic_1164.all; entity move_key_detector is PORT( clk

  • 0

This is the full code

library ieee;
use ieee.std_logic_1164.all;

entity move_key_detector is
    PORT(
        clk : IN STD_LOGIC;
        done : IN STD_LOGIC;
        hex : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
        up, down : out std_logic
    );
END move_key_detector;

architecture arch of move_key_detector is

    type statetype is (IDLE, RECEIVED_BREAK);
    signal next_state, current_state : statetype :=IDLE;

begin

process (Clk) begin
    if(rising_edge(Clk)) then
        current_state <= next_state;
    end if;
end process;


process(done) begin
next_state <= current_state;
    case current_state is
        when IDLE=>
            if(done = '1') then
                if (hex = "00011101") then up <= '1';
                elsif(hex = "00011011") then down <= '1';
                --check to see if a break code is sent
                elsif (hex = "11110000") then next_state <= RECEIVED_BREAK; 
                end if;
            end if;
        when RECEIVED_BREAK=>
            if(done ='1') then
                if (hex = "00011101") then up <= '0';
                elsif(hex="00011011") then down <= '0';
                end if;
                next_state <= IDLE;
            end if;
        end case;
end process;

The errors are:

Error (10821): HDL error at move_key_detector.vhd(31): can’t infer register for “down” because its behavior does not match any supported register model

Info (10041): Inferred latch for “down” at move_key_detector.vhd(29)

Error (10821): HDL error at move_key_detector.vhd(31): can’t infer register for “up” because its behavior does not match any supported register model

Info (10041): Inferred latch for “up” at move_key_detector.vhd(29)

Error (10818): Can’t infer register for “next_state” at move_key_detector.vhd(41) because it does not hold its value outside the clock edge

Error (10818): Can’t infer register for “next_state” at move_key_detector.vhd(33) because it does not hold its value outside the clock edge

I have been getting this kind of errors. I followed this recommendation, reading the HDL Manual,and I still don’t know how to fix this.

Can anyone help me? Thank you very much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:14:22+00:00Added an answer on May 26, 2026 at 10:14 pm

    Why do you have a second process? It looks like it contains what is intended to be asynchronous code.

    If you need the process so you can use if and case constructs, you need to put anything that can affect the desired output into the process sensitivity list (ie: done AND current_state & hex).

    You are also potentially assigning next_state two different values, which is generally a bad thing when targeting an FPGA. I suggest moving the “next_state <= current_state” inside the case statement and explicitly assigning all terms in all branches of your case/if statements (I’m guessing a bit at what you’re expecting for behavior, but you should get the general idea):

    case current_state is
        when IDLE=>
            if(done = '1') then
                if (hex = "00011101") then 
                    up <= '1';
                    down <= '0';
                    next_state <= current_state;
                elsif(hex = "00011011") then 
                    up <= '0';
                    down <= '1';
                    next_state <= current_state;
                --check to see if a break code is sent
                elsif (hex = "11110000") then 
                    up <= '0';
                    down <= '0';
                    next_state <= RECEIVED_BREAK; 
                ...
    

    You could also use a selected signal assignment outside of a process if you are intending to generate asynchronous logic.

    If you are really attempting to infer latches for the up/down/next_state signals, you need to be a lot more explicit about what you want to happen, either directly in your code or in your question to us so we can help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im re-factoring php on zend code and all the code is full of $_GET[this]
Ho to make this simple xml with php using DOM? Full code will be
How i can get full right name of generic type? For example: This code
And set the 'height' 1/2 of full screen. This is my code: <!DOCTYPE html
Question for the SO community. I have a C++ library with full source code
Full disclosure : This is for a homework assignment. This is driving me nuts.
This is based on my full question . I decided to take it in
The full error I'm getting is this: error: ambiguous overload for ‘operator[]’ in ‘a[boost::_bi::storage4<A1,
i have this function to return the full directory tree : function getDirectory( $path
Full disclaimer: I'm a CS student, and this question is related to a recently

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.