2012-08-07 59 views
3

的信號,我想在VHDL延遲的信號數個週期,但我一直在使用how to delay a signal for several cycles in vhdl延遲VHDL

難道我需要註冊的信號問題?我的意思是,是這樣的:


a_store and a_store_registered would be std_logic_vector(cycles_delayed-1 downto 0) 

process(clk) 
begin 
    if rising_edge(clk) then 
     a_store_registered <= a_store; 
    end if; 
end process;  
a_out <= a_store_registered(cycles_delayed-1); 

process(a_store_registered, a) 
begin  
     a_store <= a_store_registered(size-2 downto 0) & a; 
end process; 

回答

4

您鏈接到的解決方案是註冊信號 - 裏面寫入信號非常行爲用rising_edge(clk)限定符處理創建寄存器。

一個更簡單的實現延遲線可以在一行代碼(+另外一個,如果你想在高位複製到一個輸出)

a_store <= (a_store(a_store'high-1 downto 0) & a) when rising_edge(clk); 
a_out <= a_store(a_store'high); 

不知道爲什麼我沒有來了」在我對這個相關問題的回答中提到這一點!

3

我不知道你是爲什麼你正在接近的問題;這裏不需要第二個過程。鏈接問題中提出的方法有什麼問題?

if rising_edge(clk) then 
    a_store <= a_store(store'high-1 downto 0) & a; 
    a_out <= a_store(a_store'high); 
end if; 

在這種情況下,你輸入a和你的輸出a_out。如果要延長時間,請調整信號聲明的大小以增加a_store的大小。

如果你要訪問其他原因中間信號,你可以這樣做:

a_store <= a_store_registered(cycles_delayed-2 downto 0) & a; 
process(clk) 
begin 
    if rising_edge(clk) then 
     a_store_registered <= a_store; 
    end if; 
end process;  
a_out <= a_store_registered(cycles_delayed-1); 
1

請記住,您可以在模擬中使用foo'delayed(N ns)屬性或foo <= sig after N ns