2016-06-23 60 views
0

大家好,我試圖綜合使用聯盟工具的VHDL代碼。但即時通訊有一個非法的併發聲明錯誤。我是VHDL的新手,我試圖理解併發和順序語句,所以我不明白爲什麼我會在案例中獲得非法的併發語句。你能幫我解決這個錯誤嗎?關於案例的並行聲明VHDL

以下是一段代碼,但基本上是一樣的:

library ieee; 
use ieee.std_logic_1164.all; 
use ieee.numeric_std.all; 

entity reg_P is 
port (
    A : in unsigned(7 downto 0); 
    CLK : in std_logic; 
    EstPresente : in unsigned(7 downto 0); 
    P : out unsigned(7 downto 0); 
    RI : in unsigned(7 downto 0); 
    RPS : in std_logic 
); 
end reg_P; 
architecture FromVerilog of reg_P is 
signal P_Reg : unsigned(7 downto 0); 
begin 
P <= P_Reg; 
process (CLK) 
    begin 
    if (rising_edge(CLK)) then 
    if ((not RPS) = '1') then 
     P_Reg <= X"00"; 
    else 
     case EstPresente is 
     when X"02" then 
     case RI is 
      when X"16" then 
      P_Reg <= A; 
      when X"36" then 
      P_Reg <= (P_Reg - X"01"); 
      when X"26" then 
      P_Reg <= (P_Reg - X"01"); 
      when others then 
      P_Reg <= P_Reg; 
     end case; 
     when others then 
     P_Reg <= P_Reg; 
     end case; 
    end if; 
    end if; 
end process; 
end architecture; 

回答

3

then在你的case語句的選擇應該是複合分隔符=>

替換這6個實例和您的代碼分析。

 case EstePresente is 
     when X"02" => 
     case RI is 
      when X"16" => 
      P_Reg <= A; 
      when X"36" => 
      P_Reg <= (P_Reg - X"01"); 
      when X"26" => 
      P_Reg <= (P_Reg - X"01"); 
      when others => 
      P_Reg <= P_Reg; 
     end case; 
     when others => 
     P_Reg <= P_Reg; 
     end case; 

ghdl -a reg_p.vhdl
reg_p.vhdl:26:19:預計 '=>' 代替 '然後'
ghdl:編譯錯誤

從歷史視角綜合是如此昂貴,你期望在綜合之前通過模擬驗證你的模型。

仿真工具往往有更好的錯誤報告。