我有這個簡單的VHDL代碼aufg4.vhd
:VHDL重新分配整數信號不按`report`聲明不行
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity aufg4 is
Port (
clock : in std_logic
);
end aufg4;
architecture Behavioral of aufg4 is
signal tut_counter : integer range 0 to 90 := 0; -- counts tutorial time
begin
do_process :process(clock)
begin
if(rising_edge(clock)) then
report "tut_counter " & integer'image(tut_counter);
if(tut_counter >= 90) then
tut_counter <= 0;
report "tut_counter reset";
end if;
tut_counter <= tut_counter + 1;
end if;
end process;
end Behavioral;
而且測試平臺aufg4_tb.vhd
:
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY aufg4_tb IS
END aufg4_tb;
ARCHITECTURE behavior OF aufg4_tb IS
COMPONENT aufg4
PORT(
clock : IN std_logic
);
END COMPONENT;
--Inputs
signal clock : std_logic := '0';
-- Clock period definitions
constant clock_period : time := 10 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: aufg4 PORT MAP (
clock => clock
);
-- Clock process definitions
clock_process :process
begin
clock <= '0';
wait for clock_period/2;
clock <= '1';
wait for clock_period/2;
end process;
END;
當我模擬行爲模型report
輸出:
...
at 885 ns(1): Note: tut_counter 88 (/aufg4_tb/uut/).
at 895 ns(1): Note: tut_counter 89 (/aufg4_tb/uut/).
at 905 ns(1): Note: tut_counter 90 (/aufg4_tb/uut/).
at 905 ns(1): Note: tut_counter reset (/aufg4_tb/uut/).
at 915 ns(1): Note: tut_counter 91 (/aufg4_tb/uut/).
at 915 ns(1): Note: tut_counter reset (/aufg4_tb/uut/).
at 925 ns(1): Note: tut_counter 92 (/aufg4_tb/uut/).
at 925 ns(1): Note: tut_counter reset (/aufg4_tb/uut/).
at 935 ns(1): Note: tut_counter 93 (/aufg4_tb/uut/).
...
所以if
-statement正常工作,但信號tut_counter
的重新分配不起作用。
那麼爲什麼呢?
爲什麼模擬不會通過一個錯誤,因爲tut_counter
只有一個範圍從0 to 90
?
http://stackoverflow.com/questions/13954193/is-process-in-vhdl-reentrant/13956532#13956532 –
+1了良好問順便問一下。至於爲什麼它沒有報告錯誤 - 無可否認,您正在使用Xilinx ISIM。這是默認情況下打破,並且多年來一直這樣,但有一個「屬性」選項(我認爲在「高級」選項卡下)來打開範圍檢查並修復它。 –
@BrianDrummond我怎樣才能得到這種重新分配'事件'正常工作? – goulashsoup