Domanda

so I have a question to a vhdl error IT says: unexpected OTHER.

led <= "0000001" when count = "0000" else
        "1001111" when count = "0001" else
        "0010010" when count = "0010" else
        "0110000" when count = "0011" else
        "1001101" when count = "0100" else
        "0100101" when count = "0101" else
        "0100000" when count = "0110" else
        "0001111" when count = "0111" else
        "1111111" when count = "1000" else
        "0000100" when count = "1001" else
         "1111110" when others ;
È stato utile?

Soluzione

You don't need to write others. Do it like this:

led <= "0000001" when count = "0000" else
    "1001111" when count = "0001" else
    "0010010" when count = "0010" else
    "0110000" when count = "0011" else
    "1001101" when count = "0100" else
    "0100101" when count = "0101" else
    "0100000" when count = "0110" else
    "0001111" when count = "0111" else
    "1111111" when count = "1000" else
    "0000100" when count = "1001" else
     "1111110" ;

Altri suggerimenti

A more standard way to do this would be.

with count select 
led <=  "0000001" when "0000",
        "1001111" when "0001",
        "0010010" when "0010",
        "0110000" when "0011",
        "1001101" when "0100",
        "0100101" when "0101",
        "0100000" when "0110",
        "0001111" when "0111",
        "1111111" when "1000",
        "0000100" when "1001",
        "1111110" when others;

And you have to use others. Because all the count values are not covered.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top