vhdl中的“意想不到的其他人”

时间:2013-07-29 15:32:07

标签: vhdl xilinx hdl

所以我对vhdl错误有疑问IT说:意外的其他。

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 ;

2 个答案:

答案 0 :(得分:3)

您无需撰写others。这样做:

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" ;

答案 1 :(得分:1)

更为标准的方法是。

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;

你必须使用others。因为未涵盖所有count值。