2017-03-26 108 views
-3

我写了一个代码,我定义了一个问题if语句VHDL与选与“和”

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 then 0001

+0

错误(10500):在HW31911.vhd(24)附近的文本 “” VHDL语法错误;期待“<=” –

+0

我已经拥有模式:在std ....以及固定回合:输出... –

+0

带状态选择state_next <= “0001”当“0000”, “0010”当“0001” &(mode ='0');当“0100”&(mode ='0')时,当“0011”&(mode ='0')时, “0100”, “0101”当“0110”&(mode ='1'), “1000”,当“0111”&(mode ='1')时, “0111”, “0111” ), 当“1000”&(mode ='1'), –

回答

0

with.. select不是if语句。但无论如何。去谷歌上查询! vhdl with select

符号;结束语句。它在错误的地方。

由于您正在使用两个输入进行选择,所以在使用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!