2017-03-26 15 views
-3

私はコードを書いたと私は声明と選択VHDLおよび「AND」

port ( 
    clk: in std_logic; 
    restb: in std_logic; 
    bout : std_logic_vector(3 downto 0) 
); 
    end entity; 

    architecture behave of mod9and5 is 

    signal state: unsigned(3 downto 0); 
    signal state_next: unsigned(3 downto 0); 

    begin 

    with state select state_next <= 
    "0001" when (state <= "0000") and (mode = '0'); 


    "0000" when others; 

場合は定義の問題だ - ここでは私の問題 ある - 私がやりたいことされている場合は、入力0000モード0の場合は0001

+0

エラー(10500): "" テキストの近くにHW31911.vhd(24)で、VHDLの構文エラー。期待 "<=" –

+0

私はすでにモードがあります:STDに....とも固定試合:状態選択state_nextで出... –

+0

を<= "0001" "0000"、 "0010" 時に "0001" &(mode = '0'); (0100)&(mode = '0')の場合 「0101」の場合、 「0100」、「0011」&(mode = '0')、 「0010」&(mode = '0' "0111"&(mode = '1')のとき "1000"のとき "0110"&(mode = '1')、 "0111" )、 "1000"&(mode = '1')の場合 "1001"、 –

答えて

0

with.. selectはif文ではありません。しかし、とにかく。 Googleそれ! vhdl with select

記号;は文を終了します。それは間違った場所にある。

選択に2つの入力を使用しているので、selectを使用する前に連結する必要があります。 したがって:

signal select_input : std_logic_vector(4 downto 0); 
begin 
    select_input <= state & mode; 
    with select_input select state_next <= 
     "0001" when "00000", 
     "0010" when "00010", 
     "0011" when "00100", 
     "0100" when "00110", 
     "0101" when "01000", 
     "0110" when "01011", 
     "0111" when "01101", 
     "1000" when "01111", 
     "1001" when "10001", 
     "0000" when others; -- required! 
関連する問題