2017-05-14 55 views
-1

我有VHDL綜合的這個問題。我在多篇文章中讀到,如果我只使用一個「等到」/進程,那麼「等待」語句是可綜合的,所以這就是我所做的。所以我試圖製作一個櫃檯,顯示我在哪個樓層(我的項目包含邏輯設計中的電梯),並且應該在訂購的樓層打開5秒鐘的門。問題在於等待聲明。我不知道該如何取代它才能在ISE中運行。等待語句可以合成

library ieee; 
use ieee.std_logic_1164.all; 
use ieee.std_logic_unsigned.all; 
use ieee.std_logic_arith.all; 

entity counter is 
port(clk1: in std_logic; 
enable2:in std_logic; 
input_mux: in std_logic; 
dir: in std_logic; 
reset,s_g,s_u: in std_logic; 
q_open: out std_logic; 
q: out std_logic_vector(3 downto 0)); 
end counter; 

architecture c1 of counter is 

signal flag: std_logic:='0'; 

component test 
port(clock: in std_logic; 
a: in std_logic_vector(3 downto 0); 
notify: out std_logic); 
end component;  



begin 
delay: test port map(clk1,"0101",flag); 
process 
variable temp:std_logic_vector(3 downto 0):="0000"; 
variable q_open_var:std_logic:='0'; 

begin 
    if (enable2='1') then 
    if (s_g='1' and s_u='1') then 


    if (RESET='1') then temp:="0000"; 
    else if (CLK1'EVENT and CLK1='1') then 
    if (DIR='1') then temp:=temp+1; 
    elsif(DIR='0') then temp:=temp-1; 
    end if; 
    end if; 
    end if; 
    end if; 
    end if; 
    if (input_mux='1') then q_open_var:='1'; 
     q_open<=q_open_var; 
     wait until (flag'event and flag='1'); 
     q_open_var:='0'; 
     end if; 
    q<=temp; 
    q_open<=q_open_var; 
wait on clk1, reset; 
end process; 
end c1; 
+1

XST.pdf,Ch。 14 XST VHDL語言支持,VHDL順序電路,[沒有靈敏度列表的VHDL順序過程](https://i.stack.imgur.com/Ug​​ypl.jpg)。另請參見[VHDL多等待語句描述](https://i.stack.imgur.com/4eZ4i.jpg),注意支持可能因設備系列而異,Xilinx將通過工具過渡到Vivaldo。閱讀精細手冊,顯示錯誤消息,提供[最小,完整和可驗證示例](https://stackoverflow.com/help/mcve)。 – user1155120

+0

不要相信任何支持合成的文章。您只能依靠設備製造商提供的文檔。閱讀@ user1155120提供的內容。 – Staszek

回答

1

儘管支持此結構,但您超出了所支持的範圍。綜合工具必須根據您的代碼生成寄存器。寄存器確實有一個時鐘和一個復位輸入,但合成工具不知道文字clk1reset。即你寫了嗎

wait on clk1, reset; 

該工具不知道重置是什麼,也不知道什麼是時鐘。實際上,這兩個信號都被認爲是時鐘觸發器。

但是你的設計更麻煩,因爲你有異步復位和時鐘觸發前的if語句。儘管支持時鐘門控,但您可能並不打算。

然後在您聲明中有一個/秒/時鐘觸發器:wait until (flag'event and flag='1');。我不知道你在那裏做什麼,但你會如何想象這是通過硬件實現的?

對於可預測的行爲,您應該堅持使用標準/建議的編碼風格。即

library ieee; 
use ieee.numeric_std.all; 

[...] 
    signal temp : unsigned(3 downto 0) := (others => '0'); 
begin 
    temp_proc: process(clk1, reset) 
     variable q_open_var : std_logic := '0'; 
    begin 
    if rising_edge(clk1) then 
     if enable2='1' and s_g='1' and s_u='1' then 
      if dir = '1' then 
       temp <= temp + 1; 
      elsif dir = '0' then 
       temp <= temp - 1; 
      end if; 
     end if; 
    end if; 
    if reset = '1' then 
     temp <= (others => '0'); 
    end if; 
end process; 

q <= std_logic_vector(temp); 

(我離開了q_open部分,因爲它是不清楚你想要什麼。讓一個單獨的進程爲,因爲它不依賴於reset

附:我最喜歡end if;的五行;)下次請使用適當的縮進。並且使用'elsif'而不是'else if'。

+0

是的,對於那些「結束如果」的行哈哈抱歉。當input_mux爲1時,我想讓q_open等於'1'5個時鐘脈衝(當然可以合成)。我怎麼做? –

+0

@AndreiBraşoveanu有兩種選擇:1)引入一個從4到0計數的「計數器」:設置'q_open <='1'; count <= 4;'然後'if count = 0 then q_open <='0''。 2)使用一行中的寄存器來傳播一個信號5個時鐘脈衝,並將其與一個ser-reset觸發器結合起來。 – JHBonarius

+0

我做到了,它工作正常。儘管在復位之前我無法獲得D觸發器內容(因爲我連接了信號的端口映射)。我如何才能將復位延遲很少,因此我可以先使用它的內容? (可合成) –